diff --git a/nummi/main/locale/fr/LC_MESSAGES/django.mo b/nummi/main/locale/fr/LC_MESSAGES/django.mo index e5a3e89..fc82244 100644 Binary files a/nummi/main/locale/fr/LC_MESSAGES/django.mo and b/nummi/main/locale/fr/LC_MESSAGES/django.mo differ diff --git a/nummi/main/locale/fr/LC_MESSAGES/django.po b/nummi/main/locale/fr/LC_MESSAGES/django.po index 87315a2..15a6d59 100644 --- a/nummi/main/locale/fr/LC_MESSAGES/django.po +++ b/nummi/main/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-04-20 09:39+0200\n" +"POT-Creation-Date: 2023-04-20 12:00+0200\n" "PO-Revision-Date: 2022-12-21 17:30+0100\n" "Last-Translator: edpibu \n" "Language-Team: edpibu \n" @@ -32,19 +32,19 @@ msgstr "Rechercher" msgid "User" msgstr "Utilisateur" -#: .\models.py:38 .\models.py:72 .\models.py:80 .\models.py:230 +#: .\models.py:38 .\models.py:75 .\models.py:83 .\models.py:239 #: .\templates\main\table\snapshot.html:24 #: .\templates\main\table\transaction.html:35 msgid "Account" msgstr "Compte" -#: .\models.py:38 .\models.py:90 .\models.py:201 .\models.py:271 +#: .\models.py:38 .\models.py:93 .\models.py:210 .\models.py:283 #: .\templates\main\table\invoice.html:9 #: .\templates\main\table\transaction.html:28 msgid "Name" msgstr "Nom" -#: .\models.py:42 .\models.py:95 +#: .\models.py:42 .\models.py:98 msgid "Icon" msgstr "Icône" @@ -52,113 +52,113 @@ msgstr "Icône" msgid "Default" msgstr "Défaut" -#: .\models.py:73 .\templates\main\index.html:16 +#: .\models.py:76 .\templates\main\index.html:16 msgid "Accounts" msgstr "Comptes" -#: .\models.py:90 .\models.py:114 .\models.py:220 +#: .\models.py:93 .\models.py:120 .\models.py:229 #: .\templates\main\plot\category.html:14 #: .\templates\main\table\transaction.html:32 msgid "Category" msgstr "Catégorie" -#: .\models.py:97 +#: .\models.py:100 msgid "Budget" msgstr "Budget" -#: .\models.py:115 .\templates\main\form\snapshot.html:29 +#: .\models.py:121 .\templates\main\form\snapshot.html:10 #: .\templates\main\index.html:32 msgid "Categories" msgstr "Catégories" -#: .\models.py:120 +#: .\models.py:126 msgid "End date" msgstr "Date de fin" -#: .\models.py:122 +#: .\models.py:128 msgid "Start date" msgstr "Date de début" -#: .\models.py:125 +#: .\models.py:131 msgid "End value" msgstr "Valeur de fin" -#: .\models.py:128 +#: .\models.py:134 msgid "Start value" msgstr "Valeur de début" -#: .\models.py:134 .\templates\main\table\snapshot.html:27 +#: .\models.py:140 .\templates\main\table\snapshot.html:27 msgid "Difference" msgstr "Différence" -#: .\models.py:141 +#: .\models.py:147 msgid "Transaction difference" msgstr "Différence des transactions" -#: .\models.py:147 .\models.py:276 .\templates\main\form\fileinput.html:8 +#: .\models.py:153 .\models.py:288 .\templates\main\form\fileinput.html:8 #: .\templates\main\table\invoice.html:10 #: .\templates\main\table\invoice.html:21 msgid "File" msgstr "Fichier" -#: .\models.py:154 +#: .\models.py:160 #, python-format msgid "%(date)s statement" msgstr "Relevé du %(date)s" -#: .\models.py:194 .\models.py:225 +#: .\models.py:203 .\models.py:234 msgid "Statement" msgstr "Relevé" -#: .\models.py:195 .\templates\main\form\account.html:25 +#: .\models.py:204 .\templates\main\form\account.html:7 #: .\templates\main\list\snapshot.html:6 .\templates\main\list\snapshot.html:20 msgid "Statements" msgstr "Relevés" -#: .\models.py:201 .\models.py:264 +#: .\models.py:210 .\models.py:276 msgid "Transaction" msgstr "Transaction" -#: .\models.py:203 +#: .\models.py:212 msgid "Description" msgstr "Description" -#: .\models.py:205 .\templates\main\table\snapshot.html:26 +#: .\models.py:214 .\templates\main\table\snapshot.html:26 #: .\templates\main\table\transaction.html:29 msgid "Value" msgstr "Valeur" -#: .\models.py:207 .\templates\main\table\snapshot.html:22 +#: .\models.py:216 .\templates\main\table\snapshot.html:22 #: .\templates\main\table\transaction.html:27 msgid "Date" msgstr "Date" -#: .\models.py:208 +#: .\models.py:217 msgid "Real date" msgstr "Date réelle" -#: .\models.py:210 .\templates\main\table\transaction.html:30 +#: .\models.py:219 .\templates\main\table\transaction.html:30 msgid "Trader" msgstr "Commerçant" -#: .\models.py:213 +#: .\models.py:222 msgid "Payment" msgstr "Paiement" -#: .\models.py:265 .\templates\main\base.html:50 -#: .\templates\main\form\account.html:29 .\templates\main\form\category.html:25 -#: .\templates\main\form\snapshot.html:33 .\templates\main\index.html:26 +#: .\models.py:277 .\templates\main\base.html:50 +#: .\templates\main\form\account.html:11 .\templates\main\form\category.html:7 +#: .\templates\main\form\snapshot.html:14 .\templates\main\index.html:26 #: .\templates\main\list\transaction.html:6 #: .\templates\main\list\transaction.html:23 #: .\templates\main\table\snapshot.html:28 msgid "Transactions" msgstr "Transactions" -#: .\models.py:271 .\models.py:308 +#: .\models.py:283 .\models.py:323 msgid "Invoice" msgstr "Facture" -#: .\models.py:309 .\templates\main\form\transaction.html:24 +#: .\models.py:324 .\templates\main\form\transaction.html:5 msgid "Invoices" msgstr "Factures" @@ -175,26 +175,26 @@ msgid "Snapshots" msgstr "Relevés" #: .\templates\main\base.html:56 -msgid "New account" -msgstr "Nouveau compte" +msgid "Create account" +msgstr "Créer compte" #: .\templates\main\base.html:61 -msgid "New snapshot" -msgstr "Nouveau relevé" +msgid "Create snapshot" +msgstr "Créer relevé" #: .\templates\main\base.html:66 -msgid "New category" -msgstr "Nouvelle catégorie" +msgid "Create category" +msgstr "Créer catégorie" -#: .\templates\main\base.html:71 .\templates\main\table\transaction.html:5 -msgid "New transaction" -msgstr "Nouvelle transaction" +#: .\templates\main\base.html:71 +msgid "Create transaction" +msgstr "Créer transaction" #: .\templates\main\base.html:79 msgid "Log out" msgstr "Se déconnecter" -#: .\templates\main\base.html:84 .\templates\main\form\login.html:7 +#: .\templates\main\base.html:84 .\templates\main\form\login.html:6 msgid "Log in" msgstr "Se connecter" @@ -211,25 +211,27 @@ msgstr "Annuler" msgid "Confirm" msgstr "Confirmer" -#: .\templates\main\form\account.html:31 .\templates\main\form\category.html:27 +#: .\templates\main\form\account.html:13 .\templates\main\form\category.html:9 #: .\templates\main\index.html:28 msgid "History" msgstr "Historique" -#: .\templates\main\form\base.html:27 -msgid "Add another" -msgstr "Continuer à ajouter" +#: .\templates\main\form\base.html:7 .\templates\main\form\base.html:28 +#, python-format +msgid "Create %(name)s" +msgstr "Créer %(name)s" -#: .\templates\main\form\base.html:38 .\templates\main\table\invoice.html:11 +#: .\templates\main\form\form_base.html:29 +#: .\templates\main\table\invoice.html:11 #: .\templates\main\table\invoice.html:24 msgid "Delete" msgstr "Supprimer" -#: .\templates\main\form\base.html:40 +#: .\templates\main\form\form_base.html:31 msgid "Reset" msgstr "Réinitialiser" -#: .\templates\main\form\base.html:41 +#: .\templates\main\form\form_base.html:32 msgid "Save" msgstr "Enregistrer" @@ -273,9 +275,10 @@ msgstr "Nouveau relevé" msgid "View all statements" msgstr "Voir tous les relevés" +#: .\templates\main\table\transaction.html:5 +msgid "New transaction" +msgstr "Nouvelle transaction" + #: .\templates\main\table\transaction.html:73 msgid "View all transactions" msgstr "Voir toutes les transactions" - -#~ msgid "Valid" -#~ msgstr "Valide" diff --git a/nummi/main/templates/main/base.html b/nummi/main/templates/main/base.html index c9550e6..9eb489c 100644 --- a/nummi/main/templates/main/base.html +++ b/nummi/main/templates/main/base.html @@ -53,22 +53,22 @@
  • {% translate "New account" %} + accesskey="a">{% translate "Create account" %}
  • {% translate "New snapshot" %} + accesskey="s">{% translate "Create snapshot" %}
  • {% translate "New category" %} + accesskey="c">{% translate "Create category" %}
  • {% translate "New transaction" %} + accesskey="t">{% translate "Create transaction" %}
  • - - -{% endblock %} -{% block body %} - {% with account=form.instance %} - {% if account.adding %} -

    {% translate "New account" %}

    - {% else %} -

    {{ account.icon|remix }}{{ account }}

    - {% endif %} -
    - {% csrf_token %} - {{ form }} -
    - {% if not account.adding %} -

    {% translate "Statements" %}

    - {% include "main/table/snapshot.html" %} - {% endif %} - {% if transactions %} -

    {% translate "Transactions" %}

    - {% include "main/table/transaction.html" %} -

    {% translate "History" %}

    - {% include "main/plot/history.html" %} - {% endif %} - {% endwith %} +{% block h1 %}{{ form.instance.icon|remix }}{{ form.instance }}{% endblock %} +{% block tables %} + {% if not form.instance.adding %} +

    {% translate "Statements" %}

    + {% include "main/table/snapshot.html" %} + {% endif %} + {% if transactions %} +

    {% translate "Transactions" %}

    + {% include "main/table/transaction.html" %} +

    {% translate "History" %}

    + {% include "main/plot/history.html" %} + {% endif %} {% endblock %} diff --git a/nummi/main/templates/main/form/base.html b/nummi/main/templates/main/form/base.html new file mode 100644 index 0000000..2b71ee6 --- /dev/null +++ b/nummi/main/templates/main/form/base.html @@ -0,0 +1,40 @@ +{% extends "main/base.html" %} +{% load static %} +{% load main_extras %} +{% load i18n %} +{% block title %} + {% if form.instance.adding %} + {% blocktranslate with name=form.instance|verbose_name|lower %}Create {{ name }}{% endblocktranslate %} + {% else %} + {{ form.instance }} + {% endif %} + – Nummi +{% endblock %} +{% block link %} + {{ block.super }} + + + +{% endblock %} +{% block body %} + {% with instance=form.instance %} + {% if instance.adding %} +

    {% blocktranslate with name=instance|verbose_name|lower %}Create {{ name }}{% endblocktranslate %}

    + {% else %} +

    + {% block h1 %}{{ instance }}{% endblock %} +

    + {% endif %} +
    + {% csrf_token %} + {{ form }} +
    + {% block tables %}{% endblock %} + {% endwith %} +{% endblock %} diff --git a/nummi/main/templates/main/form/category.html b/nummi/main/templates/main/form/category.html index c5dd794..b07b45e 100644 --- a/nummi/main/templates/main/form/category.html +++ b/nummi/main/templates/main/form/category.html @@ -1,36 +1,12 @@ -{% extends "main/base.html" %} -{% load static %} +{% extends "main/form/base.html" %} {% load main_extras %} {% load i18n %} -{% block title %}{{ form.instance }} – Nummi{% endblock %} -{% block link %} - {{ block.super }} - - - -{% endblock %} -{% block body %} - {% with category=form.instance %} - {% if category.adding %} -

    {% translate "New category" %}

    - {% else %} -

    {{ category.icon|remix }}{{ category }}

    - {% endif %} -
    - {% csrf_token %} - {{ form }} -
    - {% if category.transactions %} -

    {% translate "Transactions" %}

    - {% include "main/table/transaction.html" %} -

    {% translate "History" %}

    - {% include "main/plot/history.html" %} - {% endif %} - {% endwith %} +{% block h1 %}{{ form.instance.icon|remix }}{{ form.instance }}{% endblock %} +{% block tables %} + {% if form.instance.transactions %} +

    {% translate "Transactions" %}

    + {% include "main/table/transaction.html" %} +

    {% translate "History" %}

    + {% include "main/plot/history.html" %} + {% endif %} {% endblock %} diff --git a/nummi/main/templates/main/form/invoice.html b/nummi/main/templates/main/form/invoice.html index 95afb16..53171dc 100644 --- a/nummi/main/templates/main/form/invoice.html +++ b/nummi/main/templates/main/form/invoice.html @@ -1,32 +1 @@ -{% extends "main/base.html" %} -{% load static %} -{% load main_extras %} -{% load i18n %} -{% block title %}{{ form.instance }} – Nummi{% endblock %} -{% block link %} - {{ block.super }} - - -{% endblock %} -{% block body %} - {% with invoice=form.instance %} - {% if invoice.adding %} -

    {% translate "New invoice" %}

    - {% else %} -

    {{ invoice }}

    - {% endif %} -

    - {{ invoice.transaction }} -

    - {% spaceless %} -
    - {% csrf_token %} - {{ form }} -
    - {% endspaceless %} - {% endwith %} -{% endblock %} +{% extends "main/form/base.html" %} diff --git a/nummi/main/templates/main/form/snapshot.html b/nummi/main/templates/main/form/snapshot.html index 54c7c18..31e639a 100644 --- a/nummi/main/templates/main/form/snapshot.html +++ b/nummi/main/templates/main/form/snapshot.html @@ -1,41 +1,17 @@ -{% extends "main/base.html" %} -{% load static %} +{% extends "main/form/base.html" %} {% load main_extras %} {% load i18n %} -{% block title %}{{ form.instance }} – Nummi{% endblock %} -{% block link %} - {{ block.super }} - - - +{% block h1 %} + {{ form.instance.sum|check:form.instance.diff }} + {{ form.instance }} {% endblock %} -{% block body %} - {% with snapshot=form.instance %} - {% if snapshot.adding %} -

    {% translate "New snapshot" %}

    - {% else %} -

    - - {{ snapshot }} -

    - {% endif %} -
    - {% csrf_token %} - {{ form }} -
    - {% if categories %} -

    {% translate "Categories" %}

    - {% include "main/plot/category.html" %} - {% endif %} - {% if not snapshot.adding %} -

    {% translate "Transactions" %} ({{ snapshot.sum|pmvalue }} / {{ snapshot.diff|pmvalue }})

    - {% include "main/table/transaction.html" %} - {% endif %} - {% endwith %} +{% block tables %} + {% if categories %} +

    {% translate "Categories" %}

    + {% include "main/plot/category.html" %} + {% endif %} + {% if not form.instance.adding %} +

    {% translate "Transactions" %} ({{ form.instance.sum|pmvalue }} / {{ form.instance.diff|pmvalue }})

    + {% include "main/table/transaction.html" %} + {% endif %} {% endblock %} diff --git a/nummi/main/templates/main/form/transaction.html b/nummi/main/templates/main/form/transaction.html index c70a855..77d19b2 100644 --- a/nummi/main/templates/main/form/transaction.html +++ b/nummi/main/templates/main/form/transaction.html @@ -1,33 +1,8 @@ -{% extends "main/base.html" %} -{% load static %} -{% load main_extras %} +{% extends "main/form/base.html" %} {% load i18n %} -{% block title %}{{ form.instance }} – Nummi{% endblock %} -{% block link %} - {{ block.super }} - - -{% endblock %} -{% block body %} - {% with transaction=form.instance %} - {% if transaction.adding %} -

    {% translate "New transaction" %}

    - {% else %} -

    {{ form.instance }}

    - {% endif %} - {% spaceless %} -
    - {% csrf_token %} - {{ form }} -
    - {% endspaceless %} - {% if not form.instance.adding %} -

    {% translate "Invoices" %}

    - {% include "main/table/invoice.html" %} - {% endif %} - {% endwith %} +{% block tables %} + {% if not form.instance.adding %} +

    {% translate "Invoices" %}

    + {% include "main/table/invoice.html" %} + {% endif %} {% endblock %} diff --git a/nummi/main/templatetags/main_extras.py b/nummi/main/templatetags/main_extras.py index 7558403..129c8a9 100644 --- a/nummi/main/templatetags/main_extras.py +++ b/nummi/main/templatetags/main_extras.py @@ -34,10 +34,23 @@ def pmrvalue(val): @register.filter -def remix(icon): - return mark_safe(f"""""") +def remix(icon, cls=""): + return mark_safe(f"""""") + + +@register.filter +def check(sum, diff): + if sum == diff: + return remix("check", "green") + else: + return remix("close", "red") @register.filter def extension(file): return file.name.split(".")[-1].upper() + + +@register.filter +def verbose_name(obj): + return obj._meta.verbose_name