Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add Djade formatter #105

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,9 @@ repos:
- id: djhtml
# djcss disabled for now
- id: djjs

- repo: https://github.com/adamchainz/djade-pre-commit
rev: "1.1.1"
hooks:
- id: djade
args: [--target-version, "4.2"]
22 changes: 21 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ dev = [
"django-watchfiles>=0.1.0",
"ruff>=0.1.6",
"mypy-to-codeclimate>=0.0.3",
"djade>=1.1.1",
]
tests = [
"pytest>=7.4.3",
Expand Down
6 changes: 3 additions & 3 deletions src/firefighter/confluence/templates/oncall_team.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h2><a href="{{oncall_page_link}}">On-call</a>:</h2>
<h2><a href="{{ oncall_page_link }}">On-call</a>:</h2>
<ul>
{% for team_name, user in users %}
<li>{{ team_name | upper }} {% if user.slack_user %}<a href="{{ user.slack_user.url}}">{% endif %}{{ user.full_name }}{% if user.slack_user %}</a>{% endif %}{% if user.pagerduty_user.phone_number %}: <a href="tel:+{{ user.pagerduty_user.phone_number }}">+{{ user.pagerduty_user.phone_number }}</a>{% endif %}</li>
{% endfor -%}
<li>{{ team_name|upper }} {% if user.slack_user %}<a href="{{ user.slack_user.url }}">{% endif %}{{ user.full_name }}{% if user.slack_user %}</a>{% endif %}{% if user.pagerduty_user.phone_number %}: <a href="tel:+{{ user.pagerduty_user.phone_number }}">+{{ user.pagerduty_user.phone_number }}</a>{% endif %}</li>
{% endfor - %}
</ul>
7 changes: 3 additions & 4 deletions src/firefighter/confluence/templates/pages/runbook_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
</svg>
<span class="sr-only">Loading...</span>
</div>
{% endblock%}
{% endblock page_title %}

{% block page_actions %}
{{ block.super }}
{% endblock%}

{% endblock page_actions %}

{% block page_content %}
{% include "./../layouts/partials/partial_table_list_paginated.html" %}
{% endblock%}
{% endblock page_content %}
5 changes: 3 additions & 2 deletions src/firefighter/firefighter/templates/admin/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{% load static %}
{% block extrahead %}{{ block.super }}
<link rel="icon" href="{% static 'img/favicon/favicon.ico' %}" sizes="48x48" />
{% endblock%}
{% endblock extrahead %}

{% block extrastyle %}{{ block.super }}
<style>
body {
Expand Down Expand Up @@ -103,4 +104,4 @@
}
}
</style>
{% endblock %}
{% endblock extrastyle %}
4 changes: 2 additions & 2 deletions src/firefighter/firefighter/templates/admin/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block content %}
<div style="padding:2rem; text-align: center;">
<a class="button" style="padding: 15px 20px; font-size:16px" href="{% url "oidc_authentication"%}?next={% if request.GET.next is not None %}{{ request.GET.next | default:"/" | urlencode}}{% else %}{{"/" | urlencode}}{% endif %}&fail=/admin/login/"/>Log in with SSO<a/>
<a class="button" style="padding: 15px 20px; font-size:16px" href="{% url "oidc_authentication" %}?next={% if request.GET.next is not None %}{{ request.GET.next|default:"/"|urlencode }}{% else %}{{ "/"|urlencode }}{% endif %}&fail=/admin/login/"/>Log in with SSO<a/>
</div>
{% if request.GET.error %}
<p class="errornote">
Expand All @@ -11,4 +11,4 @@
{% endif %}

{{ block.super }}
{% endblock %}
{% endblock content %}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% extends "admin/base_site.html" %}
{% load i18n l10n admin_urls static %}
{% load admin_urls i18n l10n static %}

{% comment %} TODO Proper form and HTML. {% endcomment %}

{% block extrahead %}
{{ block.super }}
{{ media }}
<script src="{% static 'admin/js/cancel.js' %}" async></script>
{% endblock %}
{% endblock extrahead %}

{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} send-message-conversation send-message-selected-conversation{% endblock %}

Expand All @@ -18,7 +18,7 @@
&rsaquo; <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>
&rsaquo; {% translate 'Send messages on conversations' %}
</div>
{% endblock %}
{% endblock breadcrumbs %}

{% block content %}
<h2>Targeted conversations</h2>
Expand All @@ -42,4 +42,4 @@ <h2>Targeted conversations</h2>
<a href="#" class="button cancel-link">{% translate "Cancel, take me back" %}</a>
</div>
</form>
{% endblock %}
{% endblock content %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends '../../layouts/index.html' %}

{% block content %}
<div class="min-h-full px-4 py-16 sm:px-6 sm:py-24 md:grid md:place-items-center lg:px-8">
<div class="mx-auto max-w-max">
Expand All @@ -18,4 +19,4 @@ <h1 class="text-4xl font-bold tracking-tight sm:text-5xl">{{ title }}</h1>
</main>
</div>
</div>
{% endblock%}
{% endblock content %}
36 changes: 18 additions & 18 deletions src/firefighter/incidents/templates/incidents/filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
<div class="px-2">
{% render_field filter.form.metrics_period class="input-ff" placeholder="e.g. 2022" %}
</div>
{%if filter.form.cleaned_data.metrics_period %}
{% with date_gte=filter.form.metrics_period.metrics_period.0 date_lte=filter.form.metrics_period.metrics_period.1%}
{%if date_gte and date_lte %}
{% if filter.form.cleaned_data.metrics_period %}
{% with date_gte=filter.form.metrics_period.metrics_period.0 date_lte=filter.form.metrics_period.metrics_period.1 %}
{% if date_gte and date_lte %}
<div class="mt-2">
<P class="my-auto text-xs "><span class="text-sm">From:</span> {{date_gte|date:"Y/m/d H:i:s e"}}</p>
<P class="my-auto text-xs"><span class="text-sm">To:</span> {{date_lte|date:"Y/m/d H:i:s e"}}</p>
{%if date_str %}<p class="my-auto text-xs">({{ date_str }})</p>{% endif %}
<P class="my-auto text-xs "><span class="text-sm">From:</span> {{ date_gte|date:"Y/m/d H:i:s e" }}</p>
<P class="my-auto text-xs"><span class="text-sm">To:</span> {{ date_lte|date:"Y/m/d H:i:s e" }}</p>
{% if date_str %}<p class="my-auto text-xs">({{ date_str }})</p>{% endif %}
</div>
{% endif %}
{% endwith%}
{% endwith %}
{% endif %}
</div>
{% elif filter_field == "created_at" %}
Expand All @@ -50,24 +50,24 @@
<div class="px-2">
{% render_field filter.form.created_at class="input-ff" placeholder="2021/Q4 - 2022/Q1" %}
</div>
{%if filter.form.cleaned_data.created_at %}
{% with date_gte=filter.form.cleaned_data.created_at.0 date_lte=filter.form.cleaned_data.created_at.1%}
{%if date_gte and date_lte %}
{% if filter.form.cleaned_data.created_at %}
{% with date_gte=filter.form.cleaned_data.created_at.0 date_lte=filter.form.cleaned_data.created_at.1 %}
{% if date_gte and date_lte %}
<div class="mt-2">
<P class="my-auto text-xs "><span class="text-sm">From:</span> {{date_gte|date:"Y/m/d H:i:s e"}}</p>
<P class="my-auto text-xs"><span class="text-sm">To:</span> {{date_lte|date:"Y/m/d H:i:s e"}}</p>
{%if date_str %}<p class="my-auto text-xs">({{ date_str }})</p>{% endif %}
<P class="my-auto text-xs "><span class="text-sm">From:</span> {{ date_gte|date:"Y/m/d H:i:s e" }}</p>
<P class="my-auto text-xs"><span class="text-sm">To:</span> {{ date_lte|date:"Y/m/d H:i:s e" }}</p>
{% if date_str %}<p class="my-auto text-xs">({{ date_str }})</p>{% endif %}
</div>
{% endif %}
{% endwith%}
{% endwith %}
{% endif %}
</div>
{% else %}
{% include "./widgets/form_container.html" with filter_form=field%}
{% endif%}
{% endwith%}
{% include "./widgets/form_container.html" with filter_form=field %}
{% endif %}
{% endwith %}
{% endif %}
{% endfor%}
{% endfor %}

<div class=" flex justify-center items-center">
<div class="w-max m-auto">
Expand Down
5 changes: 2 additions & 3 deletions src/firefighter/incidents/templates/incidents/table.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% load django_tables2 %}
{% load i18n %}
{% load django_tables2 i18n %}
{% block table-wrapper %}
<div class="table-container">
{% block table %}
Expand All @@ -11,7 +10,7 @@
{% for column in table.columns %}
<th {{ column.attrs.th.as_html }}>
{% if column.orderable %}
<a href="{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}">{% if "desc" in column.attrs.th.class%}&#8595; {% elif "asc" in column.attrs.th.class%}&#8593; {% endif%}{{ column.header }}</a>
<a href="{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}">{% if "desc" in column.attrs.th.class %}&#8595; {% elif "asc" in column.attrs.th.class %}&#8593; {% endif %}{{ column.header }}</a>
{% else %}
{{ column.header }}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="float-left h-6 w-6 mr-2 ">
{% with incident=record %}
{% include "../../layouts/partials/priority_icon.html" %}
{% endwith%}
{% endwith %}
</div>

</div> <span>{{ record.priority }}</span>
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h4 class="flow-root">
</svg>

</span>
<label class="font-medium ml-1"> {{ group}} </label>
<label class="font-medium ml-1"> {{ group }} </label>
</button>
<div display="contents" class="absolute right-0 top-0 bottom-0 items-center flex pr-2 hidden-child" tooltip="Check all">
<input type="checkbox" class="checkbox-style" group-select x-ref="checkAll_{{ group.order }}" x-on:click="toggleAllCheckboxesGroup(); " x-model="selectAll_{{ group.order }}">
Expand Down
6 changes: 3 additions & 3 deletions src/firefighter/incidents/templates/layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<script defer src="{% static "js/main.min.js" %}"></script>
<link rel="stylesheet" href="{% static "css/main.min.css" %}" crossorigin="anonymous">
<link rel="icon" type="image/png" href="{% static "img/favicon/favicon-32x32.png" %}">
<title>{{ page_title }}{% if APP_DISPLAY_NAME %} | {{APP_DISPLAY_NAME}}{% endif %}</title>
<title>{{ page_title }}{% if APP_DISPLAY_NAME %} | {{ APP_DISPLAY_NAME }}{% endif %}</title>
{% block head %}
{% endblock %}
{% endblock head %}
{% if PLAUSIBLE_DOMAIN and PLAUSIBLE_SCRIPT_URL %}
<script defer data-domain="{{ PLAUSIBLE_DOMAIN }}" src="{{ PLAUSIBLE_SCRIPT_URL }}"></script>
{% endif %}
Expand All @@ -18,7 +18,7 @@
{% include "./partials/header.html" %}
<div class="flex-grow">
{% block content %}
{% endblock %}
{% endblock content %}
</div>
{% include "./partials/footer.html" %}
</body>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{% component "modal" autoplay=False %}
{% fill "modal_header" %}
Time Range syntax
Expand Down
10 changes: 4 additions & 6 deletions src/firefighter/incidents/templates/layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{% load static %}

{% load simple_menu %}
{% load simple_menu static %}
{% generate_menu %}

<footer class="bg-base-200 text-base-content shadow-inner" aria-labelledby="footer-heading">
Expand All @@ -9,17 +7,17 @@ <h2 id="footer-heading" class="sr-only">Footer</h2>
<div class="md:grid md:grid-cols-3 md:gap-8">

<div class="mt-8 md:mt-0 text-base-content">
<p class="font-medium">{{APP_DISPLAY_NAME}}{% if FF_VERSION %} <span class="text-base-content text-opacity-70 text-sm font-normal"> {{ FF_VERSION }} </span>{% endif %}</p>
<p class="font-medium">{{ APP_DISPLAY_NAME }}{% if FF_VERSION %} <span class="text-base-content text-opacity-70 text-sm font-normal"> {{ FF_VERSION }} </span>{% endif %}</p>
<p class="mt-2 text-sm text-base-content text-opacity-80">Report, manage, escalate!</p>
</div>
<div class="grid grid-cols-3 gap-8 md:col-span-2">
{% for item in menus.footer %}
<div class="mt-12 md:mt-0">
<h3 class="text-base font-medium">{{item.title}}</h3>
<h3 class="text-base font-medium">{{ item.title }}</h3>
<ul role="list" class="mt-2 space-y-3 text-base-content text-opacity-70 text-sm">
{% for sub in item.children %}
<li>
<a href="{{sub.url}}">{{sub.title}}</a>
<a href="{{ sub.url }}">{{ sub.title }}</a>
</li>
{% endfor %}
</ul>
Expand Down
Loading