Add djhtml to pre-commit check (#382)

This commit is contained in:
TAKAHASHI Shuuji 2023-01-10 01:58:17 +09:00 committed by GitHub
parent 024d956e5e
commit 0c1e51322f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 780 additions and 767 deletions

View File

@ -55,3 +55,10 @@ repos:
types-cachetools,
types-python-dateutil,
]
- repo: https://github.com/rtts/djhtml
rev: v1.5.2
hooks:
- id: djhtml
- id: djcss
- id: djjs

View File

@ -12,7 +12,7 @@
</div>
{%- endif %}
{% endblock brand_content %}
</a>
</a>
<div class="sidebar-tree" style="margin-top:0">
<ul>
<li class="toctree-l1"><a class="reference" href="https://jointakahe.org">Homepage</a></li>

View File

@ -9,11 +9,11 @@
</div>
</div>
{% if request.htmx %}
<button class="add-image"
<button class="add-image"
hx-get='{% url "compose_image_upload" %}'
hx-target="this"
hx-swap="outerHTML"
_="on load if length of <.uploaded-image/> > 3 then hide me">
Add Image
</button>
</button>
{% endif %}

View File

@ -1,4 +1,5 @@
<script type="text/hyperscript">
{# fmt:off #}
def imageviewer.show(source)
set source_url to (<img /> in source) @data-original-url
set source_alt to (<img /> in source) @alt
@ -22,6 +23,7 @@
set <#image-viewer img /> @alt to ''
set <#image-viewer figcaption />'s textContent to ''
end
{# fmt:on #}
</script>
<figure id="image-viewer" _="on click imageviewer.close()">
<picture>

View File

@ -4,15 +4,15 @@
<div class="poll">
<h3 style="display: none;">Options: {% if post.type_data.mode == "oneOf" %}<small>(choose one)</small>{% endif %}</h3>
{% for item in post.type_data.options %}
{% if forloop.first %}<ul>{% endif %}{% widthratio item.votes post.type_data.voter_count 100 as item_percent %}
{% for item in post.type_data.options %}
{% if forloop.first %}<ul>{% endif %}{% widthratio item.votes post.type_data.voter_count 100 as item_percent %}
<li><label class="poll-option">
<input style="display:none" name="vote-options" type="{% if post.type_data.mode == "oneOf" %}radio{% else %}checkbox{% endif %}" value="0">
<span class="poll-number" title="{{ item.votes }} votes">{{ item_percent }}%</span>
<span class="poll-option-text">{{ item.name }}</span>
</label>
{% if forloop.last %}</ul>{% endif %}
{% endfor %}
{% if forloop.last %}</ul>{% endif %}
{% endfor %}
<div class="poll-footer">
<span class="vote-total">{{ post.type_data.voter_count }} people</span>
&mdash;

View File

@ -60,7 +60,7 @@
</div>
<div id="raw_response" class="hidden">
{{ raw_result|escape }}
{{ raw_result|escape }}
</div>
<div class="field payload">

View File

@ -3,14 +3,14 @@
{% block title %}#{{ hashtag.display_name }} Timeline{% endblock %}
{% block content %}
<div class="timeline-name">Explore Trending Tags</div>
<div class="timeline-name">Explore Trending Tags</div>
<section class="icon-menu">
<section class="icon-menu">
{% for hashtag in page_obj %}
{% include "activities/_hashtag.html" %}
{% empty %}
No tags are trending yet.
{% endfor %}
</section>
</section>
{% endblock %}

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<title>{% block title %}{% endblock %} - {{ config.site_name }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -31,8 +31,8 @@
{% endblock %}
{% block extra_head %}{% endblock %}
{% block custom_head %}{% if config.custom_head %}{{ config.custom_head|safe }}{% endif %}{% endblock %}
</head>
<body class="{% block body_class %}{% endblock %}" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
</head>
<body class="{% block body_class %}{% endblock %}" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
<a id='skip-to-main' class='screenreader-text' href='#main-content'>Skip to Content</a>
<a id='skip-to-nav' class='screenreader-text' href='#side-navigation'>Skip to Navigation</a>
<main>
@ -95,5 +95,5 @@
{% block footer %}
{% endblock %}
</body>
</body>
</html>

View File

@ -1,3 +1,3 @@
{% autoescape off %}
<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; margin-bottom: 15px;">{{ content }}</p>
<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; margin-bottom: 15px;">{{ content }}</p>
{% endautoescape %}

View File

@ -1,5 +1,5 @@
{% autoescape off %}
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; box-sizing: border-box; width: 100%;" width="100%">
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; box-sizing: border-box; width: 100%;" width="100%">
<tbody>
<tr>
<td align="left" style="font-family: sans-serif; font-size: 14px; vertical-align: top; padding-bottom: 15px;" valign="top">
@ -13,5 +13,5 @@
</td>
</tr>
</tbody>
</table>
</table>
{% endautoescape %}

View File

@ -1,7 +1,7 @@
{% autoescape off %}
<tr>
<tr>
<td class="content-block" style="font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; color: #999999; font-size: 12px; text-align: center;" valign="top" align="center">
{{ content }}
</td>
</tr>
</tr>
{% endautoescape %}

View File

@ -1,27 +1,27 @@
{% extends "emails/base.html" %}
{% load mail_tags %}
{% autoescape off %}
{% block title %}{{settings.MAIN_DOMAIN}} - New Account Created{% endblock title %}
{% block subtitle %}{{settings.MAIN_DOMAIN}} - New Account Created{% endblock subtitle %}
{% block title %}{{settings.MAIN_DOMAIN}} - New Account Created{% endblock title %}
{% block subtitle %}{{settings.MAIN_DOMAIN}} - New Account Created{% endblock subtitle %}
{% block body_greeting %}
{% block body_greeting %}
{% email_body_content "Hi there," %}
{% endblock body_greeting %}
{% endblock body_greeting %}
{% block body_content %}
{% block body_content %}
{% email_body_content "Your email address was used to create a new account at {{config.site_name}} (https://{{settings.MAIN_DOMAIN}})." %}
{% email_body_content "To confirm your new account, go to this link:" %}
{% endblock body_content %}
{% endblock body_content %}
{% block body_button %}
{% block body_button %}
{% email_button button_text="Confirm New Account" button_link="https://{{settings.MAIN_DOMAIN}}/auth/reset/{{reset.token}}/" %}
{% endblock body_button %}
{% endblock body_button %}
{% block body_signature %}
{% block body_signature %}
{% email_body_content "Thanks, Admins @{{settings.MAIN_DOMAIN}}" %}
{% endblock body_signature %}
{% endblock body_signature %}
{% block extra_footer %}
{% block extra_footer %}
{% email_footer "If this was not you, then please ignore this message - your email will not be used to make an account if this link is not visited." %}
{% endblock extra_footer %}
{% endblock extra_footer %}
{% endautoescape %}

View File

@ -1,12 +1,12 @@
{% autoescape off %}
<!doctype html>
<html>
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>{% block title %}{% endblock title %}</title>
<style>
@media only screen and (max-width: 620px) {
@media only screen and (max-width: 620px) {
table.body h1 {
font-size: 28px !important;
margin-bottom: 10px !important;
@ -54,8 +54,8 @@
max-width: 100% !important;
width: auto !important;
}
}
@media all {
}
@media all {
.ExternalClass {
width: 100%;
}
@ -95,8 +95,8 @@
background-color: #34495e !important;
border-color: #34495e !important;
}
}
</style>
}
</style>
</head>
<body style="background-color: #f6f6f6; font-family: sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.4; margin: 0; padding: 0; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;">
<span class="preheader" style="color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;">{% block subtitle %}{% endblock subtitle %}</span>
@ -159,5 +159,5 @@
</tr>
</table>
</body>
</html>
</html>
{% endautoescape %}

View File

@ -1,27 +1,27 @@
{% extends "emails/base.html" %}
{% load mail_tags %}
{% autoescape off %}
{% block title %}{{settings.MAIN_DOMAIN}} - Password Reset Requested{% endblock title %}
{% block subtitle %}{{settings.MAIN_DOMAIN}} - Password Reset Requested{% endblock subtitle %}
{% block title %}{{settings.MAIN_DOMAIN}} - Password Reset Requested{% endblock title %}
{% block subtitle %}{{settings.MAIN_DOMAIN}} - Password Reset Requested{% endblock subtitle %}
{% block body_greeting %}
{% block body_greeting %}
{% email_body_content "Hi there," %}
{% endblock body_greeting %}
{% endblock body_greeting %}
{% block body_content %}
{% block body_content %}
{% email_body_content "A password reset was requested for your account ({{reset.user.email}}) at {{Config.system.site_name}} (https://{{settings.MAIN_DOMAIN}})." %}
{% email_body_content "To reset your password, go to this link:" %}
{% endblock body_content %}
{% endblock body_content %}
{% block body_button %}
{% block body_button %}
{% email_button button_text="Reset Password" button_link="https://{{settings.MAIN_DOMAIN}}/auth/reset/{{reset.token}}/" %}
{% endblock body_button %}
{% endblock body_button %}
{% block body_signature %}
{% block body_signature %}
{% email_body_content "Thanks, Admins @{{settings.MAIN_DOMAIN}}" %}
{% endblock body_signature %}
{% endblock body_signature %}
{% block extra_footer %}
{% block extra_footer %}
{% email_footer "If this was not you, then please ignore this message - your password will not be reset if this link is not visited." %}
{% endblock extra_footer %}
{% endblock extra_footer %}
{% endautoescape %}

View File

@ -1,15 +1,15 @@
{% extends "emails/base.html" %}
{% load mail_tags %}
{% autoescape off %}
{% block title %}{{config.site_name}} - New Moderation Report{% endblock title %}
{% block subtitle %}{{config.site_name}} - New Moderation Report{% endblock subtitle %}
{% block title %}{{config.site_name}} - New Moderation Report{% endblock title %}
{% block subtitle %}{{config.site_name}} - New Moderation Report{% endblock subtitle %}
{% block body_greeting %}
{% block body_greeting %}
{% email_body_content "Moderation Team," %}
{% email_body_content "A new report has been recieved for {{config.site_name}}." %}
{% endblock body_greeting %}
{% endblock body_greeting %}
{% block body_content %}
{% block body_content %}
{% email_body_content "=============== Report Summary ===============" %}
{% if report.source_identity %}
@ -21,13 +21,13 @@
{% email_body_content "Reported Identity: {{report.subject_identity}}" %}
{% email_body_content "Complaint Type: {{report.type}}" %}
{% email_body_content "Complaint Notes: {{report.complaint}}" %}
{% endblock body_content %}
{% endblock body_content %}
{% block body_button %}
{% block body_button %}
{% email_button button_text="View Report" button_link="https://{{settings.MAIN_DOMAIN}}/admin/reports/{{report.id}}/" %}
{% endblock body_button %}
{% endblock body_button %}
{% block extra_footer %}
{% block extra_footer %}
{% email_footer "You are recieving this email because you are a moderator on the Takahe instance https://{{settings.MAIN_DOMAIN}}" %}
{% endblock extra_footer %}
{% endblock extra_footer %}
{% endautoescape %}

View File

@ -1,6 +1,7 @@
{% with name_one=field_name_one|default:"name" name_two=field_name_two|default:"value" %}
<script type="text/hyperscript">
<script type="text/hyperscript">
{# fmt:off #}
def {{ field.name }}.collect{{ field.name|title }}Fields()
set newdata to []
for item in <div.{{ field.name }}-row/>
@ -24,12 +25,14 @@
add .{{ field.name }}-row to foo
return foo
end
</script>
{# fmt:on #}
</script>
{% include "forms/_field.html" %}
{% include "forms/_field.html" %}
<div class="field multi-option">
<div class="field multi-option">
<section class="icon-menu">
{# fmt:off #}
<span id="new_{{ field.name }}" stlye="display: none"
_="on load
get the (value of #id_{{ field.name }}) as Object
@ -49,6 +52,7 @@
call {{ field.name }}.addEmptyField()
end
"></span>
{# fmt:on #}
<div class="option">
<span class="option-field">
@ -73,6 +77,6 @@
</section>
</div>
</div>
{% endwith %}

View File

@ -11,7 +11,7 @@
</fieldset>
<fieldset>
<legend>Password</legend>
<p>To change your password, please trigger a <a href="{% url "trigger_reset" %}">password reset</a>.
<p>To change your password, please trigger a <a href="{% url "trigger_reset" %}">password reset</a>.</p>
</fieldset>
</form>
{% endblock %}