Reformat template files with djLint

This commit is contained in:
Edgar P. Burkhart 2022-12-25 16:24:40 +01:00
parent 3a31eec326
commit 16dba43810
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
12 changed files with 384 additions and 398 deletions

View file

@ -5,14 +5,22 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>{% block title %}Nummi{% endblock %}</title>
<title>
{% block title %}Nummi{% endblock %}
</title>
{% block link %}
<link rel="icon" href="{% static 'main/svg/logo.svg' %}" type="image/svg+xml" />
<link rel="stylesheet" href="{% static 'main/css/main.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'main/css/nav.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'main/fontawesome/css/all.min.css' %}" type="text/css" />
<link rel="icon"
href="{% static 'main/svg/logo.svg' %}"
type="image/svg+xml"/>
<link rel="stylesheet"
href="{% static 'main/css/main.css' %}"
type="text/css"/>
<link rel="stylesheet"
href="{% static 'main/css/nav.css' %}"
type="text/css"/>
<link rel="stylesheet"
href="{% static 'main/fontawesome/css/all.min.css' %}"
type="text/css"/>
{% endblock %}
</head>
<body>
@ -22,7 +30,8 @@
<a href="{% url 'index' %}"
class="home{% if request.resolver_match.url_name == 'index' %} cur{% endif %}"
accesskey="h">
<img src="{% static 'main/svg/logo.svg' %}" alt="" />Nummi
<img src="{% static 'main/svg/logo.svg' %}" alt="" />
Nummi
</a>
<a href="{% url 'transaction' %}"
class="{% if request.resolver_match.url_name == 'transaction' %}cur{% endif %}"
@ -41,19 +50,18 @@
</a>
<form id="search" action="{% url 'search' %}" method="post">
{% csrf_token %}
<input type="text" name="search" placeholder="{% translate "Search" %}" {% if search %}value="{{ search }}"{% endif %} />
<input type="text"
name="search"
placeholder="{% translate "Search" %}"
{% if search %}value="{{ search }}"{% endif %}/>
<input type="submit" value="{% translate "Search" %}" />
</form>
<a href="{% url 'logout' %}"
class="logout"
accesskey="l">
<a href="{% url 'logout' %}" class="logout" accesskey="l">
<i class="fa fa-right-from-bracket"></i>
</a>
</nav>
{% endspaceless %}
{% endblock %}
{% block body %}
{% endblock %}
{% block body %}{% endblock %}
</body>
</html>

View file

@ -2,26 +2,28 @@
{% load static %}
{% load main_extras %}
{% load i18n %}
{% block link %}
{{ block.super }}
<link rel="stylesheet" href="{% static 'main/css/form.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'main/css/table.css' %}" type="text/css" />
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/form.css' %}"
type="text/css"/>
<link rel="stylesheet"
href="{% static 'main/css/table.css' %}"
type="text/css"/>
{% endblock %}
{% block body %}
<h1><i class="fa fa-{{ category.icon }}"></i> {{ category }}</h1>
<form action="{% url 'category' category.id %}" method="post">
<h1>
<i class="fa fa-{{ category.icon }}"></i> {{ category }}
</h1>
<form action="{% url 'category' category.id %}" method="post">
{% csrf_token %}
{{ form }}
{% form_buttons category %}
</form>
{% if transactions %}
<img src="{% url "plot-category" category.id %}" alt="Graph representing value over time" />
<h2>{% translate "Transactions" %}</h2>
{% transaction_table transactions %}
{% endif %}
{% endblock %}
</form>
{% if transactions %}
<img src="{% url "plot-category" category.id %}"
alt="Graph representing value over time"/>
<h2>{% translate "Transactions" %}</h2>
{% transaction_table transactions %}
{% endif %}
{% endblock %}

View file

@ -1,12 +1,10 @@
{% if form.non_field_errors %}
<ul class='errorlist'>
{% for error in form.non_field_errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
<ul class='errorlist'>
{% for error in form.non_field_errors %}<li>{{ error }}</li>{% endfor %}
</ul>
{% endif %}
{% for field in form %}
{{ field.errors }}
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
<div>{{ field }}</div>
{{ field.errors }}
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
<div>{{ field }}</div>
{% endfor %}

View file

@ -2,29 +2,31 @@
{% load static %}
{% load main_extras %}
{% load i18n %}
{% block link %}
{{ block.super }}
<link rel="stylesheet" href="{% static 'main/css/index.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'main/css/table.css' %}" type="text/css" />
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/index.css' %}"
type="text/css"/>
<link rel="stylesheet"
href="{% static 'main/css/table.css' %}"
type="text/css"/>
{% endblock %}
{% block body %}
{% if transactions %}
<h2>{% translate "Transactions" %} <a href="{% url "transactions" %}"><i class="fa fa-magnifying-glass-plus"></i></a></h2>
{% transaction_table transactions %}
{% endif %}
{% if categories %}
{% if transactions %}
<h2>
{% translate "Transactions" %} <a href="{% url "transactions" %}"><i class="fa fa-magnifying-glass-plus"></i></a>
</h2>
{% transaction_table transactions %}
{% endif %}
{% if categories %}
<h2>{% translate "Categories" %}</h2>
<div id="categories">
{% for cat in categories %}
<a href="{% url 'category' cat.id %}"><i class="fa fa-{{ cat.icon }}"></i>{{ cat }}</a>
{% endfor %}
</div>
{% endif %}
{% if snapshots %}
{% endif %}
{% if snapshots %}
<h2>{% translate "Snapshots" %}</h2>
<div id="snapshots" class="table col1-5">
<div class="header">
@ -48,13 +50,9 @@
<a href="{% url 'snapshot' snap.id %}">{{ snap.date|date:"Y-m-d" }}</a>
</span>
<span class="value num right">{{ snap.value|value }}</span>
<span class="diff num right">
{{ snap.diff|pmvalue }}
</span>
<span class="diff num right">{{ snap.diff|pmvalue }}</span>
{% with sum=snap.sum %}
<span class="sum num right">
{{ sum|pmvalue }}
</span>
<span class="sum num right">{{ sum|pmvalue }}</span>
<span class="valid center">
{% if snap.previous is not None %}
{% if sum == snap.diff %}
@ -68,6 +66,5 @@
</div>
{% endfor %}
</div>
{% endif %}
{% endif %}
{% endblock %}

View file

@ -1,23 +1,19 @@
{% extends "main/base.html" %}
{% load static %}
{% load i18n %}
{% block link %}
{{ block.super }}
<link rel="stylesheet" href="{% static 'main/css/form.css' %}" type="text/css" />
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/form.css' %}"
type="text/css"/>
{% endblock %}
{% block body %}
<h1>{% translate "Log In" %}</h1>
<form action="{% url 'login' %}" method="post">
<h1>{% translate "Log In" %}</h1>
<form action="{% url 'login' %}" method="post">
{% csrf_token %}
{% if form.non_field_errors %}
<ul class='errorlist'>
{% for error in form.non_field_errors %}
<li>{{ error }}</li>
{% endfor %}
{% for error in form.non_field_errors %}<li>{{ error }}</li>{% endfor %}
</ul>
{% endif %}
{% for field in form %}
@ -30,6 +26,5 @@
<input type="reset" />
<input type="submit" value="{% translate "Log In" %}" />
</div>
</form>
</form>
{% endblock %}

View file

@ -2,17 +2,21 @@
{% load static %}
{% load main_extras %}
{% load i18n %}
{% block link %}
{{ block.super }}
<link rel="stylesheet" href="{% static 'main/css/form.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'main/css/table.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'main/css/chart.css' %}" type="text/css" />
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/form.css' %}"
type="text/css"/>
<link rel="stylesheet"
href="{% static 'main/css/table.css' %}"
type="text/css"/>
<link rel="stylesheet"
href="{% static 'main/css/chart.css' %}"
type="text/css"/>
{% endblock %}
{% block body %}
{% with sum=snapshot.sum %}
<h1>
{% with sum=snapshot.sum %}
<h1>
{% if snapshot.previous is not None %}
{% if sum == snapshot.diff %}
<i class="fa fa-check green"></i>
@ -21,40 +25,33 @@
{% endif %}
{% endif %}
{{ snapshot }}
</h1>
<form action="{% url 'snapshot' snapshot.id %}" method="post" enctype="multipart/form-data">
</h1>
<form action="{% url 'snapshot' snapshot.id %}"
method="post"
enctype="multipart/form-data">
{% csrf_token %}
{{ form }}
{% form_buttons snapshot %}
</form>
{% if categories %}
<h2>{% translate "Categories" %}</h2>
<div class="chart">
</form>
{% if categories %}
<h2>{% translate "Categories" %}</h2>
<div class="chart">
{% for cat in categories %}
<div class="name">
{% if cat.category %}
<i class="fa fa-{{ cat.category__icon }}"></i>
<a href="{% url 'category' cat.category %}">
{{ cat.category__name }}
</a>
<a href="{% url 'category' cat.category %}">{{ cat.category__name }}</a>
{% else %}
<i class="fa fa-wallet"></i></i>
{% endif %}
</div>
<div class="value left">
{{ cat.sum_m|pmvalue }}
</div>
<div class="value left">{{ cat.sum_m|pmvalue }}</div>
<div class="left">
<div
class="bar bar_m"
<div class="bar bar_m"
style="width:{% widthratio cat.sum_m cat_lim_m 100 %}%"
title="{{ cat.sum_m }}">
</div>
title="{{ cat.sum_m }}"></div>
{% if cat.sum < 0 %}
<div
class="bar tot"
<div class="bar tot"
style="width:{% widthratio cat.sum cat_lim_m 100 %}%"
title="{{ cat.sum }}">
<span>{{ cat.sum|pmvalue }}</span>
@ -62,31 +59,24 @@
{% endif %}
</div>
<div class="right">
<div
class="bar bar_p"
<div class="bar bar_p"
style="width:{% widthratio cat.sum_p cat_lim 100 %}%"
title="{{ cat.sum_p }}">
</div>
title="{{ cat.sum_p }}"></div>
{% if cat.sum >= 0 %}
<div
class="bar tot"
<div class="bar tot"
style="width:{% widthratio cat.sum cat_lim 100 %}%"
title="{{ cat.sum }}">
<span>{{ cat.sum|pmvalue }}</span>
</div>
{% endif %}
</div>
<div class="value right">
{{ cat.sum_p|pmvalue }}
</div>
<div class="value right">{{ cat.sum_p|pmvalue }}</div>
{% endfor %}
</div>
{% endif %}
{% if snapshot.transactions %}
<h2>{% translate "Transactions" %} ({{ sum|pmvalue }} / {{ snapshot.diff|pmvalue }})</h2>
{% transaction_table snapshot.transactions %}
{% endif %}
{% endwith %}
{% endblock %}
</div>
{% endif %}
{% if snapshot.transactions %}
<h2>{% translate "Transactions" %} ({{ sum|pmvalue }} / {{ snapshot.diff|pmvalue }})</h2>
{% transaction_table snapshot.transactions %}
{% endif %}
{% endwith %}
{% endblock %}

View file

@ -2,13 +2,11 @@
<div class="buttons">
{% if not adding %}
{% translate "Delete" as del %}
<a
class="btn del"
onclick="return confirm('{{ del }} <{{ instance}}> ?')"
<a class="btn del"
onclick="return confirm('{{ del }} <{{ instance }}> ?')"
href="{% url del_url instance.id %}">
{{ del }}
</a>
{% endif %}
<input type="reset" />
<input type="submit" value="{% translate 'Save' %}" />

View file

@ -1,8 +1,9 @@
{% extends "main/tag/value.html" %}
{% block "value" %}
{% if value %}
{% if value > 0 %}+{% endif %}
{{ block.super }}
{% else %}{% endif %}
{% else %}
{% endif %}
{% endblock %}

View file

@ -1,6 +1,5 @@
{% load main_extras %}
{% load i18n %}
<div id="transactions" class="table col1-6">
<div class="header">
<strong class="attach center"><i class="fa fa-paperclip"></i></strong>
@ -29,9 +28,7 @@
<span class="category text center">
{% if trans.category %}
<i class="fa fa-{{ trans.category.icon }}"></i>
<a href="{% url 'category' trans.category.id %}">
{{ trans.category }}
</a>
<a href="{% url 'category' trans.category.id %}">{{ trans.category }}</a>
{% else %}
{% endif %}

View file

@ -1,7 +1,5 @@
{% spaceless %}
<span>
{% block "value" %}
{{ value }} €
{% endblock %}
</span>
<span>
{% block "value" %}{{ value }} €{% endblock %}
</span>
{% endspaceless %}

View file

@ -2,26 +2,28 @@
{% load static %}
{% load main_extras %}
{% load i18n %}
{% block link %}
{{ block.super }}
<link rel="stylesheet" href="{% static 'main/css/form.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'main/css/table.css' %}" type="text/css" />
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/form.css' %}"
type="text/css"/>
<link rel="stylesheet"
href="{% static 'main/css/table.css' %}"
type="text/css"/>
{% endblock %}
{% block body %}
<h1>{{ transaction }}</h1>
{% spaceless %}
<form id="transaction" action="{% url 'transaction' transaction.id %}" method="post">
<h1>{{ transaction }}</h1>
{% spaceless %}
<form id="transaction"
action="{% url 'transaction' transaction.id %}"
method="post">
{% csrf_token %}
<input type="hidden" name="form" value="transaction" />
{{ form }}
{% form_buttons transaction %}
</form>
{% endspaceless %}
<div class="split">
</form>
{% endspaceless %}
<div class="split">
{% if transaction.has_invoice %}
<div>
<h2>{% translate "Invoices" %}</h2>
@ -44,15 +46,18 @@
</div>
</div>
{% endif %}
<div>
<h3>{% translate "Add invoice" %}</h3>
<form action="{% url 'transaction' transaction.id %}" method="post" enctype="multipart/form-data">
<form action="{% url 'transaction' transaction.id %}"
method="post"
enctype="multipart/form-data">
{% csrf_token %}
<input type="hidden" name="form" value="invoice" />
{{ invoice_form }}
<div class="buttons"><input class="btn" type="submit" value="{% translate "Add" %}" /></div>
<div class="buttons">
<input class="btn" type="submit" value="{% translate "Add" %}" />
</div>
</form>
</div>
</div>
{% endblock %}
</div>
{% endblock %}

View file

@ -2,34 +2,31 @@
{% load static %}
{% load main_extras %}
{% load i18n %}
{% block link %}
{{ block.super }}
<link rel="stylesheet" href="{% static 'main/css/table.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'main/css/page.css' %}" type="text/css" />
{{ block.super }}
<link rel="stylesheet"
href="{% static 'main/css/table.css' %}"
type="text/css"/>
<link rel="stylesheet"
href="{% static 'main/css/page.css' %}"
type="text/css"/>
{% endblock %}
{% block body %}
<h1>{% translate "Transactions" %}</h1>
{% transaction_table transactions %}
{% if page_obj %}
<div class="pagination">
<h1>{% translate "Transactions" %}</h1>
{% transaction_table transactions %}
{% if page_obj %}
<div class="pagination">
<span class="step-links">
{% if page_obj.has_previous %}
<a href="?page=1"></a>
<a href="?page={{ page_obj.previous_page_number }}"></a>
{% endif %}
<span class="current">
{{ page_obj.number }}/{{ page_obj.paginator.num_pages }}
</span>
<span class="current">{{ page_obj.number }}/{{ page_obj.paginator.num_pages }}</span>
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}"></a>
<a href="?page={{ page_obj.paginator.num_pages }}"></a>
{% endif %}
</span>
</div>
{% endif %}
</div>
{% endif %}
{% endblock %}