Added the title_case filter and replaced the title filter with the title_case filter to display titles in American English.

This commit is contained in:
依瑪貓 2020-08-03 22:31:13 +08:00
parent 3babe8bc1f
commit 66f57b7b0d
13 changed files with 77 additions and 63 deletions

View File

@ -73,7 +73,7 @@ First written: 2020/7/20
{# The table for large screens #} {# The table for large screens #}
<div class="d-none d-lg-block report-block report-block-lg"> <div class="d-none d-lg-block report-block report-block-lg">
<div class="row justify-content-center"> <div class="row justify-content-center">
<h2>{{ title|escape }}</h2> <h2>{{ title|title_case }}</h2>
</div> </div>
<div class="row"> <div class="row">
@ -81,19 +81,19 @@ First written: 2020/7/20
<table class="table table-borderless table-hover table-sm balance-sheet-table"> <table class="table table-borderless table-hover table-sm balance-sheet-table">
<thead> <thead>
<tr> <tr>
<th colspan="3" scope="col">{{ assets.title|title }}</th> <th colspan="3" scope="col">{{ assets.title|title_case }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for group in assets.groups %} {% for group in assets.groups %}
<tr class="group-title"> <tr class="group-title">
<td><div>{{ group.title|title }}</div></td> <td><div>{{ group.title|title_case }}</div></td>
<td class="amount"></td> <td class="amount"></td>
<td class="actions"></td> <td class="actions"></td>
</tr> </tr>
{% for item in group.details %} {% for item in group.details %}
<tr> <tr>
<td><div class="account">{{ item.title|title }}</div></td> <td><div class="account">{{ item.title|title_case }}</div></td>
<td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td> <td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td>
<td class="actions"> <td class="actions">
<a href="{{ item.url }}" class="btn btn-info" role="button"> <a href="{{ item.url }}" class="btn btn-info" role="button">
@ -112,19 +112,19 @@ First written: 2020/7/20
<table class="table table-borderless table-hover table-sm balance-sheet-table"> <table class="table table-borderless table-hover table-sm balance-sheet-table">
<thead> <thead>
<tr> <tr>
<th colspan="3" scope="col">{{ liabilities.title|title }}</th> <th colspan="3" scope="col">{{ liabilities.title|title_case }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for group in liabilities.groups %} {% for group in liabilities.groups %}
<tr class="group-title"> <tr class="group-title">
<td><div>{{ group.title|title }}</div></td> <td><div>{{ group.title|title_case }}</div></td>
<td class="amount"></td> <td class="amount"></td>
<td class="actions"></td> <td class="actions"></td>
</tr> </tr>
{% for item in group.details %} {% for item in group.details %}
<tr> <tr>
<td><div class="account">{{ item.title|title }}</div></td> <td><div class="account">{{ item.title|title_case }}</div></td>
<td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td> <td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td>
<td class="actions"> <td class="actions">
<a href="{{ item.url }}" class="btn btn-info" role="button"> <a href="{{ item.url }}" class="btn btn-info" role="button">
@ -149,19 +149,19 @@ First written: 2020/7/20
<table class="table table-borderless table-hover table-sm balance-sheet-table"> <table class="table table-borderless table-hover table-sm balance-sheet-table">
<thead> <thead>
<tr> <tr>
<th colspan="3" scope="col">{{ owners_equity.title|title }}</th> <th colspan="3" scope="col">{{ owners_equity.title|title_case }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for group in owners_equity.groups %} {% for group in owners_equity.groups %}
<tr class="group-title"> <tr class="group-title">
<td><div>{{ group.title|title }}</div></td> <td><div>{{ group.title|title_case }}</div></td>
<td class="amount"></td> <td class="amount"></td>
<td class="actions"></td> <td class="actions"></td>
</tr> </tr>
{% for item in group.details %} {% for item in group.details %}
<tr> <tr>
<td><div class="account">{{ item.title|title }}</div></td> <td><div class="account">{{ item.title|title_case }}</div></td>
<td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td> <td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td>
<td class="actions"> <td class="actions">
<a href="{{ item.url }}" class="btn btn-info" role="button"> <a href="{{ item.url }}" class="btn btn-info" role="button">
@ -224,16 +224,16 @@ First written: 2020/7/20
<div class="col-sm-6"> <div class="col-sm-6">
<ul class="list-group balance-sheet-list"> <ul class="list-group balance-sheet-list">
<li class="list-group-item section-title"> <li class="list-group-item section-title">
{{ assets.title|title }} {{ assets.title|title_case }}
</li> </li>
{% for group in assets.groups %} {% for group in assets.groups %}
<li class="list-group-item d-flex justify-content-between align-items-center group-title"> <li class="list-group-item d-flex justify-content-between align-items-center group-title">
{{ group.title|title }} {{ group.title|title_case }}
</li> </li>
{% for item in group.details %} {% for item in group.details %}
<li class="list-group-item d-flex justify-content-between align-items-center account"> <li class="list-group-item d-flex justify-content-between align-items-center account">
<a class="list-group-item-action" href="{{ item.url }}"> <a class="list-group-item-action" href="{{ item.url }}">
{{ item.title|title }} {{ item.title|title_case }}
<div class="float-right"> <div class="float-right">
<span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill"> <span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ item.amount|accounting_amount }} {{ item.amount|accounting_amount }}
@ -255,16 +255,16 @@ First written: 2020/7/20
<div class="col-sm-6"> <div class="col-sm-6">
<ul class="list-group balance-sheet-list"> <ul class="list-group balance-sheet-list">
<li class="list-group-item section-title"> <li class="list-group-item section-title">
{{ liabilities.title|title }} {{ liabilities.title|title_case }}
</li> </li>
{% for group in liabilities.groups %} {% for group in liabilities.groups %}
<li class="list-group-item d-flex justify-content-between align-items-center group-title"> <li class="list-group-item d-flex justify-content-between align-items-center group-title">
{{ group.title|title }} {{ group.title|title_case }}
</li> </li>
{% for item in group.details %} {% for item in group.details %}
<li class="list-group-item d-flex justify-content-between align-items-center account"> <li class="list-group-item d-flex justify-content-between align-items-center account">
<a class="list-group-item-action" href="{{ item.url }}"> <a class="list-group-item-action" href="{{ item.url }}">
{{ item.title|title }} {{ item.title|title_case }}
<div class="float-right"> <div class="float-right">
<span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill"> <span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ item.amount|accounting_amount }} {{ item.amount|accounting_amount }}
@ -284,16 +284,16 @@ First written: 2020/7/20
<ul class="list-group balance-sheet-list"> <ul class="list-group balance-sheet-list">
<li class="list-group-item section-title"> <li class="list-group-item section-title">
{{ owners_equity.title|title }} {{ owners_equity.title|title_case }}
</li> </li>
{% for group in owners_equity.groups %} {% for group in owners_equity.groups %}
<li class="list-group-item d-flex justify-content-between align-items-center group-title"> <li class="list-group-item d-flex justify-content-between align-items-center group-title">
{{ group.title|title }} {{ group.title|title_case }}
</li> </li>
{% for item in group.details %} {% for item in group.details %}
<li class="list-group-item d-flex justify-content-between align-items-center account"> <li class="list-group-item d-flex justify-content-between align-items-center account">
<a class="list-group-item-action" href="{{ item.url }}"> <a class="list-group-item-action" href="{{ item.url }}">
{{ item.title|title }} {{ item.title|title_case }}
<div class="float-right"> <div class="float-right">
<span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill"> <span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ item.amount|accounting_amount }} {{ item.amount|accounting_amount }}

View File

@ -27,7 +27,7 @@ First written: 2020/7/15
{% load accounting %} {% load accounting %}
{% block settings %} {% block settings %}
{% blocktrans asvar title with account=account.title|title context "Accounting|" %}Cash Summary for {{ account }}{% endblocktrans %} {% blocktrans asvar title with account=account.title context "Accounting|" %}Cash Summary for {{ account }}{% endblocktrans %}
{% setvar "title" title %} {% setvar "title" title %}
{% static "accounting/css/report.css" as file %}{% add_css file %} {% static "accounting/css/report.css" as file %}{% add_css file %}
{% endblock %} {% endblock %}
@ -62,20 +62,20 @@ First written: 2020/7/15
{% endwith %} {% endwith %}
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="d-none d-md-inline">{{ account.title|title }}</span> <span class="d-none d-md-inline">{{ account.title|title_case }}</span>
<span class="d-md-none">{% trans "Account" context "Accounting|" as text %}{{ text|force_escape }}</span> <span class="d-md-none">{% trans "Account" context "Accounting|" as text %}{{ text|force_escape }}</span>
</button> </button>
<div class="dropdown-menu account-picker"> <div class="dropdown-menu account-picker">
<div class="dropdown-header">{% trans "Shortcuts" context "Accounting|Account|" as text %}{{ text|force_escape }}</div> <div class="dropdown-header">{% trans "Shortcuts" context "Accounting|Account|" as text %}{{ text|force_escape }}</div>
{% for x in shortcut_accounts %} {% for x in shortcut_accounts %}
<a class="dropdown-item {% if x.code == account.code %} active {% endif %}>" href="{% url "accounting:cash-summary" x %}"> <a class="dropdown-item {% if x.code == account.code %} active {% endif %}>" href="{% url "accounting:cash-summary" x %}">
{{ x.title|title }} {{ x.title|title_case }}
</a> </a>
{% endfor %} {% endfor %}
<div class="dropdown-header">{% trans "All" context "Accounting|Account|" as text %}{{ text|force_escape }}</div> <div class="dropdown-header">{% trans "All" context "Accounting|Account|" as text %}{{ text|force_escape }}</div>
{% for x in all_accounts %} {% for x in all_accounts %}
<a class="dropdown-item {% if x.code == account.code %} active {% endif %}>" href="{% url "accounting:cash-summary" x %}"> <a class="dropdown-item {% if x.code == account.code %} active {% endif %}>" href="{% url "accounting:cash-summary" x %}">
{{ x.code }} {{ x.title|title }} {{ x.code }} {{ x.title|title_case }}
</a> </a>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -27,7 +27,7 @@ First written: 2020/7/1
{% load accounting %} {% load accounting %}
{% block settings %} {% block settings %}
{% blocktrans asvar title with account=account.title|title prep_period=period.prep_desc context "Accounting|" %}Cash Account for {{ account }} {{ prep_period }}{% endblocktrans %} {% blocktrans asvar title with account=account.title prep_period=period.prep_desc context "Accounting|" %}Cash Account for {{ account }} {{ prep_period }}{% endblocktrans %}
{% setvar "title" title %} {% setvar "title" title %}
{% setvar "use_period_chooser" True %} {% setvar "use_period_chooser" True %}
{% static "accounting/css/report.css" as file %}{% add_css file %} {% static "accounting/css/report.css" as file %}{% add_css file %}
@ -63,20 +63,20 @@ First written: 2020/7/1
{% endwith %} {% endwith %}
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="d-none d-md-inline">{{ account.title|title }}</span> <span class="d-none d-md-inline">{{ account.title|title_case }}</span>
<span class="d-md-none">{% trans "Account" context "Accounting|" as text %}{{ text|force_escape }}</span> <span class="d-md-none">{% trans "Account" context "Accounting|" as text %}{{ text|force_escape }}</span>
</button> </button>
<div class="dropdown-menu account-picker"> <div class="dropdown-menu account-picker">
<div class="dropdown-header">{% trans "Shortcuts" context "Accounting|Account|" as text %}{{ text|force_escape }}</div> <div class="dropdown-header">{% trans "Shortcuts" context "Accounting|Account|" as text %}{{ text|force_escape }}</div>
{% for x in shortcut_accounts %} {% for x in shortcut_accounts %}
<a class="dropdown-item {% if x.code == account.code %} active {% endif %}>" href="{% url "accounting:cash" x period %}"> <a class="dropdown-item {% if x.code == account.code %} active {% endif %}>" href="{% url "accounting:cash" x period %}">
{{ x.title|title }} {{ x.title|title_case }}
</a> </a>
{% endfor %} {% endfor %}
<div class="dropdown-header">{% trans "All" context "Accounting|Account|" as text %}{{ text|force_escape }}</div> <div class="dropdown-header">{% trans "All" context "Accounting|Account|" as text %}{{ text|force_escape }}</div>
{% for x in all_accounts %} {% for x in all_accounts %}
<a class="dropdown-item {% if x.code == account.code %} active {% endif %}>" href="{% url "accounting:cash" x period %}"> <a class="dropdown-item {% if x.code == account.code %} active {% endif %}>" href="{% url "accounting:cash" x period %}">
{{ x.code }} {{ x.title|title }} {{ x.code }} {{ x.title|title_case }}
</a> </a>
{% endfor %} {% endfor %}
</div> </div>
@ -110,7 +110,7 @@ First written: 2020/7/1
{% for item in item_list %} {% for item in item_list %}
<tr class="{% if not item.is_balanced or item.has_order_hole %} table-danger {% endif %}"> <tr class="{% if not item.is_balanced or item.has_order_hole %} table-danger {% endif %}">
<td>{{ item.transaction.date|smart_date }}</td> <td>{{ item.transaction.date|smart_date }}</td>
<td>{{ item.account.title|title }}</td> <td>{{ item.account.title|title_case }}</td>
<td>{{ item.summary|default:"" }}{% if not item.is_balanced %} <td>{{ item.summary|default:"" }}{% if not item.is_balanced %}
<span class="badge badge-danger badge-pill"> <span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %} {% trans "Unbalanced" context "Accounting|" as text %}
@ -145,7 +145,7 @@ First written: 2020/7/1
{% if item.pk is not None %} {% if item.pk is not None %}
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}"> <a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}">
<div class="date-account-line d-flex justify-content-between align-items-center"> <div class="date-account-line d-flex justify-content-between align-items-center">
{{ item.transaction.date|smart_date }} {{ item.account.title|title }} {{ item.transaction.date|smart_date }} {{ item.account.title|title_case }}
</div> </div>
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<div> <div>

View File

@ -73,7 +73,7 @@ First written: 2020/7/19
{# The table for large screens #} {# The table for large screens #}
<div class="d-none d-sm-block report-block report-block-lg"> <div class="d-none d-sm-block report-block report-block-lg">
<div class="row justify-content-center"> <div class="row justify-content-center">
<h2>{{ title }}</h2> <h2>{{ title|title_case }}</h2>
</div> </div>
<div class="row"> <div class="row">
@ -89,7 +89,7 @@ First written: 2020/7/19
<tbody> <tbody>
{% for section in item_list %} {% for section in item_list %}
<tr class="section-title"> <tr class="section-title">
<td><div>{{ section.title|title }}</div></td> <td><div>{{ section.title|title_case }}</div></td>
<td class="amount"></td> <td class="amount"></td>
<td class="amount"></td> <td class="amount"></td>
<td class="actions"></td> <td class="actions"></td>
@ -97,14 +97,14 @@ First written: 2020/7/19
{% if section.groups %} {% if section.groups %}
{% for group in section.groups %} {% for group in section.groups %}
<tr class="group-title"> <tr class="group-title">
<td><div class="group-title">{{ group.title|title }}</div></td> <td><div class="group-title">{{ group.title|title_case }}</div></td>
<td class="amount"></td> <td class="amount"></td>
<td class="amount"></td> <td class="amount"></td>
<td class="actions"></td> <td class="actions"></td>
</tr> </tr>
{% for item in group.details %} {% for item in group.details %}
<tr> <tr>
<td><div class="account">{{ item.title|title }}</div></td> <td><div class="account">{{ item.title|title_case }}</div></td>
<td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td> <td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td>
<td class="amount"></td> <td class="amount"></td>
<td class="actions"> <td class="actions">
@ -132,7 +132,7 @@ First written: 2020/7/19
{% endif %} {% endif %}
{% if section.cumulative_total is not None %} {% if section.cumulative_total is not None %}
<tr class="cumulative-total"> <tr class="cumulative-total">
<td><div>{{ section.cumulative_total.title|title }}</div></td> <td><div>{{ section.cumulative_total.title|title_case }}</div></td>
<td class="amount"></td> <td class="amount"></td>
<td class="amount {% if section.cumulative_total.amount < 0 %} text-danger {% endif %}">{{ section.cumulative_total.amount|accounting_amount }}</td> <td class="amount {% if section.cumulative_total.amount < 0 %} text-danger {% endif %}">{{ section.cumulative_total.amount|accounting_amount }}</td>
<td class="actions"></td> <td class="actions"></td>
@ -159,17 +159,17 @@ First written: 2020/7/19
<ul class="list-group income-statement-list"> <ul class="list-group income-statement-list">
{% for section in item_list %} {% for section in item_list %}
<li class="list-group-item d-flex justify-content-between align-items-center section-title"> <li class="list-group-item d-flex justify-content-between align-items-center section-title">
{{ section.title|title }} {{ section.title|title_case }}
</li> </li>
{% if section.groups %} {% if section.groups %}
{% for group in section.groups %} {% for group in section.groups %}
<li class="list-group-item d-flex justify-content-between align-items-center group-title"> <li class="list-group-item d-flex justify-content-between align-items-center group-title">
{{ group.title|title }} {{ group.title|title_case }}
</li> </li>
{% for item in group.details %} {% for item in group.details %}
<li class="list-group-item d-flex justify-content-between align-items-center account"> <li class="list-group-item d-flex justify-content-between align-items-center account">
<a class="list-group-item-action" href="{% url "accounting:ledger" item period %}"> <a class="list-group-item-action" href="{% url "accounting:ledger" item period %}">
{{ item.title|title }} {{ item.title|title_case }}
<div class="float-right"> <div class="float-right">
<span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill"> <span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
{{ item.amount|accounting_amount }} {{ item.amount|accounting_amount }}
@ -197,7 +197,7 @@ First written: 2020/7/19
{% endif %} {% endif %}
{% if section.cumulative_total is not None %} {% if section.cumulative_total is not None %}
<li class="list-group-item d-flex justify-content-between align-items-center cumulative-total"> <li class="list-group-item d-flex justify-content-between align-items-center cumulative-total">
{{ section.cumulative_total.title|title }} {{ section.cumulative_total.title|title_case }}
<div class="float-right"> <div class="float-right">
<span class="badge {% if section.cumulative_total.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill"> <span class="badge {% if section.cumulative_total.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
{{ section.cumulative_total.amount|accounting_amount }} {{ section.cumulative_total.amount|accounting_amount }}

View File

@ -90,7 +90,7 @@ First written: 2020/7/17
{% for item in item_list %} {% for item in item_list %}
<tr class="{% if not item.is_balanced or item.has_order_hole %} table-danger {% endif %}"> <tr class="{% if not item.is_balanced or item.has_order_hole %} table-danger {% endif %}">
<td>{{ item.transaction.date|smart_date }}</td> <td>{{ item.transaction.date|smart_date }}</td>
<td>{{ item.account.title|title }}</td> <td>{{ item.account.title|title_case }}</td>
<td><div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">{{ item.summary|default:"" }}{% if not item.is_balanced %} <td><div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">{{ item.summary|default:"" }}{% if not item.is_balanced %}
<span class="badge badge-danger badge-pill"> <span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %} {% trans "Unbalanced" context "Accounting|" as text %}
@ -126,7 +126,7 @@ First written: 2020/7/17
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}"> <a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}">
<div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}"> <div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
<div class="date-account-line"> <div class="date-account-line">
{{ item.transaction.date|smart_date }} {{ item.account.title|title }} {{ item.transaction.date|smart_date }} {{ item.account.title|title_case }}
</div> </div>
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<div> <div>
@ -163,7 +163,7 @@ First written: 2020/7/17
{% else %} {% else %}
<div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}"> <div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
<div class="date-account-line"> <div class="date-account-line">
{{ item.transaction.date|smart_date }} {{ item.account.title|title }} {{ item.transaction.date|smart_date }} {{ item.account.title|title_case }}
</div> </div>
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<div> <div>

View File

@ -27,7 +27,7 @@ First written: 2020/7/16
{% load accounting %} {% load accounting %}
{% block settings %} {% block settings %}
{% blocktrans asvar title with account=account.title|title context "Accounting|" %}Ledger Summary for {{ account }}{% endblocktrans %} {% blocktrans asvar title with account=account.title context "Accounting|" %}Ledger Summary for {{ account }}{% endblocktrans %}
{% setvar "title" title %} {% setvar "title" title %}
{% static "accounting/css/report.css" as file %}{% add_css file %} {% static "accounting/css/report.css" as file %}{% add_css file %}
{% endblock %} {% endblock %}
@ -62,13 +62,13 @@ First written: 2020/7/16
{% endwith %} {% endwith %}
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="d-none d-md-inline">{{ account.title|title }}</span> <span class="d-none d-md-inline">{{ account.title|title_case }}</span>
<span class="d-md-none">{% trans "Account" context "Accounting|" as text %}{{ text|force_escape }}</span> <span class="d-md-none">{% trans "Account" context "Accounting|" as text %}{{ text|force_escape }}</span>
</button> </button>
<div class="dropdown-menu account-picker"> <div class="dropdown-menu account-picker">
{% for x in accounts %} {% for x in accounts %}
<a class="dropdown-item {% if x.code == account.code %} active {% endif %}>" href="{% url "accounting:ledger-summary" x %}"> <a class="dropdown-item {% if x.code == account.code %} active {% endif %}>" href="{% url "accounting:ledger-summary" x %}">
{{ x.title|title }} {{ x.title|title_case }}
</a> </a>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -27,7 +27,7 @@ First written: 2020/7/16
{% load accounting %} {% load accounting %}
{% block settings %} {% block settings %}
{% blocktrans asvar title with account=account.title|title prep_period=period.prep_desc context "Accounting|" %}Ledger for {{ account }} {{ prep_period }}{% endblocktrans %} {% blocktrans asvar title with account=account.title prep_period=period.prep_desc context "Accounting|" %}Ledger for {{ account }} {{ prep_period }}{% endblocktrans %}
{% setvar "title" title %} {% setvar "title" title %}
{% setvar "use_period_chooser" True %} {% setvar "use_period_chooser" True %}
{% static "accounting/css/report.css" as file %}{% add_css file %} {% static "accounting/css/report.css" as file %}{% add_css file %}
@ -63,13 +63,13 @@ First written: 2020/7/16
{% endwith %} {% endwith %}
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="d-none d-md-inline">{{ account.title|title }}</span> <span class="d-none d-md-inline">{{ account.title|title_case }}</span>
<span class="d-md-none">{% trans "Account" context "Accounting|" as text %}{{ text|force_escape }}</span> <span class="d-md-none">{% trans "Account" context "Accounting|" as text %}{{ text|force_escape }}</span>
</button> </button>
<div class="dropdown-menu account-picker"> <div class="dropdown-menu account-picker">
{% for x in accounts %} {% for x in accounts %}
<a class="dropdown-item {% if x.code == account.code %} active {% endif %}" href="{% url "accounting:ledger" x period %}"> <a class="dropdown-item {% if x.code == account.code %} active {% endif %}" href="{% url "accounting:ledger" x period %}">
{{ x.code }} {{ x.title|title }} {{ x.code }} {{ x.title|title_case }}
</a> </a>
{% endfor %} {% endfor %}
</div> </div>
@ -103,7 +103,7 @@ First written: 2020/7/16
{% for item in item_list %} {% for item in item_list %}
<tr class="{% if not item.is_balanced or item.has_order_hole or not item.is_credit_card_paid %} table-danger {% endif %}{% if item.is_existing_equipment %} table-info {% endif %}"> <tr class="{% if not item.is_balanced or item.has_order_hole or not item.is_credit_card_paid %} table-danger {% endif %}{% if item.is_existing_equipment %} table-info {% endif %}">
<td>{{ item.transaction.date|smart_date }}</td> <td>{{ item.transaction.date|smart_date }}</td>
<td>{{ item.account.title|title }}</td> <td>{{ item.account.title|title_case }}</td>
<td>{{ item.summary|default:"" }}{% if not item.is_balanced %} <td>{{ item.summary|default:"" }}{% if not item.is_balanced %}
<span class="badge badge-danger badge-pill"> <span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %} {% trans "Unbalanced" context "Accounting|" as text %}
@ -148,7 +148,7 @@ First written: 2020/7/16
{% if item.pk is not None %} {% if item.pk is not None %}
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}"> <a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}">
<div class="date-account-line"> <div class="date-account-line">
{{ item.transaction.date|smart_date }} {{ item.account.title|title }} {{ item.transaction.date|smart_date }} {{ item.account.title|title_case }}
</div> </div>
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<div> <div>
@ -197,7 +197,7 @@ First written: 2020/7/16
</a> </a>
{% else %} {% else %}
<div class="date-account-line"> <div class="date-account-line">
{{ item.transaction.date|smart_date }} {{ item.account.title|title }} {{ item.transaction.date|smart_date }} {{ item.account.title|title_case }}
</div> </div>
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<div> <div>

View File

@ -93,7 +93,7 @@ First written: 2020/7/21
{% for item in item_list %} {% for item in item_list %}
<tr class="{% if not item.is_balanced or item.has_order_hole %} table-danger {% endif %}"> <tr class="{% if not item.is_balanced or item.has_order_hole %} table-danger {% endif %}">
<td>{{ item.transaction.date|smart_date }}</td> <td>{{ item.transaction.date|smart_date }}</td>
<td>{{ item.account.title|title }}</td> <td>{{ item.account.title|title_case }}</td>
<td><div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">{{ item.summary|default:"" }}{% if not item.is_balanced %} <td><div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">{{ item.summary|default:"" }}{% if not item.is_balanced %}
<span class="badge badge-danger badge-pill"> <span class="badge badge-danger badge-pill">
{% trans "Unbalanced" context "Accounting|" as text %} {% trans "Unbalanced" context "Accounting|" as text %}
@ -126,7 +126,7 @@ First written: 2020/7/21
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}"> <a class="list-group-item-action" href="{% url_with_return "accounting:transactions.show" item.transaction.type item.transaction %}">
<div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}"> <div class="{% if item.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
<div class="date-account-line"> <div class="date-account-line">
{{ item.transaction.date|smart_date }} {{ item.account.title|title }} {{ item.transaction.date|smart_date }} {{ item.account.title|title_case }}
</div> </div>
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<div> <div>

View File

@ -134,7 +134,7 @@ First written: 2020/7/23
<tbody> <tbody>
{% for x in item.debit_records %} {% for x in item.debit_records %}
<tr> <tr>
<td>{{ x.account.title|title }}</td> <td>{{ x.account.title|title_case }}</td>
<td>{{ x.summary|default:"" }}</td> <td>{{ x.summary|default:"" }}</td>
<td class="amount">{{ x.amount|accounting_amount }}</td> <td class="amount">{{ x.amount|accounting_amount }}</td>
</tr> </tr>
@ -152,7 +152,7 @@ First written: 2020/7/23
{% for x in item.debit_records %} {% for x in item.debit_records %}
<li class="list-group-item"> <li class="list-group-item">
<div class="d-flex justify-content-between align-items-center subject-line"> <div class="d-flex justify-content-between align-items-center subject-line">
{{ x.account.title|title }} {{ x.account.title|title_case }}
<span class="badge badge-info">{{ x.amount|accounting_amount }}</span> <span class="badge badge-info">{{ x.amount|accounting_amount }}</span>
</div> </div>
<div>{{ x.summary|default:"" }}</div> <div>{{ x.summary|default:"" }}</div>

View File

@ -134,7 +134,7 @@ First written: 2020/7/23
<tbody> <tbody>
{% for x in item.credit_records %} {% for x in item.credit_records %}
<tr> <tr>
<td>{{ x.account.title|title }}</td> <td>{{ x.account.title|title_case }}</td>
<td>{{ x.summary|default:"" }}</td> <td>{{ x.summary|default:"" }}</td>
<td class="amount">{{ x.amount|accounting_amount }}</td> <td class="amount">{{ x.amount|accounting_amount }}</td>
</tr> </tr>
@ -152,7 +152,7 @@ First written: 2020/7/23
{% for x in item.credit_records %} {% for x in item.credit_records %}
<li class="list-group-item"> <li class="list-group-item">
<div class="d-flex justify-content-between align-items-center subject-line"> <div class="d-flex justify-content-between align-items-center subject-line">
{{ x.account.title|title }} {{ x.account.title|title_case }}
<span class="badge badge-info">{{ x.amount|accounting_amount }}</span> <span class="badge badge-info">{{ x.amount|accounting_amount }}</span>
</div> </div>
<div>{{ x.summary|default:"" }}</div> <div>{{ x.summary|default:"" }}</div>

View File

@ -130,7 +130,7 @@ First written: 2020/7/23
<tbody> <tbody>
{% for x in item.debit_records %} {% for x in item.debit_records %}
<tr> <tr>
<td>{{ x.account.title|title }}</td> <td>{{ x.account.title|title_case }}</td>
<td>{{ x.summary|default:"" }}</td> <td>{{ x.summary|default:"" }}</td>
<td class="amount">{{ x.amount|accounting_amount }}</td> <td class="amount">{{ x.amount|accounting_amount }}</td>
</tr> </tr>
@ -148,7 +148,7 @@ First written: 2020/7/23
{% for x in item.debit_records %} {% for x in item.debit_records %}
<li class="list-group-item"> <li class="list-group-item">
<div class="d-flex justify-content-between align-items-center subject-line"> <div class="d-flex justify-content-between align-items-center subject-line">
{{ x.account.title|title }} {{ x.account.title|title_case }}
<span class="badge badge-info">{{ x.amount|accounting_amount }}</span> <span class="badge badge-info">{{ x.amount|accounting_amount }}</span>
</div> </div>
<div>{{ x.summary|default:"" }}</div>x <div>{{ x.summary|default:"" }}</div>x
@ -177,7 +177,7 @@ First written: 2020/7/23
<tbody> <tbody>
{% for x in item.credit_records %} {% for x in item.credit_records %}
<tr> <tr>
<td>{{ x.account.title|title }}</td> <td>{{ x.account.title|title_case }}</td>
<td>{{ x.summary|default:"" }}</td> <td>{{ x.summary|default:"" }}</td>
<td class="amount">{{ x.amount|accounting_amount }}</td> <td class="amount">{{ x.amount|accounting_amount }}</td>
</tr> </tr>
@ -195,7 +195,7 @@ First written: 2020/7/23
{% for x in item.credit_records %} {% for x in item.credit_records %}
<li class="list-group-item"> <li class="list-group-item">
<div class="d-flex justify-content-between align-items-center subject-line"> <div class="d-flex justify-content-between align-items-center subject-line">
{{ x.account.title|title }} {{ x.account.title|title_case }}
<span class="badge badge-info">{{ x.amount|accounting_amount }}</span> <span class="badge badge-info">{{ x.amount|accounting_amount }}</span>
</div> </div>
<div>{{ x.summary|default:"" }}</div>x <div>{{ x.summary|default:"" }}</div>x

View File

@ -76,7 +76,7 @@ First written: 2020/7/19
{# The table for large screens #} {# The table for large screens #}
<div class="d-none d-sm-block report-block report-block-lg"> <div class="d-none d-sm-block report-block report-block-lg">
<div class="row justify-content-center"> <div class="row justify-content-center">
<h2>{{ title|force_escape }}</h2> <h2>{{ title|title_case }}</h2>
</div> </div>
<div class="row"> <div class="row">
@ -93,7 +93,7 @@ First written: 2020/7/19
<tbody> <tbody>
{% for item in item_list %} {% for item in item_list %}
<tr> <tr>
<td>{{ item.title|title }}</td> <td>{{ item.title|title_case }}</td>
<td class="amount">{{ item.debit_amount|accounting_amount }}</td> <td class="amount">{{ item.debit_amount|accounting_amount }}</td>
<td class="amount">{{ item.credit_amount|accounting_amount }}</td> <td class="amount">{{ item.credit_amount|accounting_amount }}</td>
<td class="actions"> <td class="actions">
@ -130,7 +130,7 @@ First written: 2020/7/19
{% for item in item_list %} {% for item in item_list %}
<li class="list-group-item"> <li class="list-group-item">
<a class="list-group-item-action d-flex justify-content-between align-items-center" href="{% url "accounting:ledger" item period %}"> <a class="list-group-item-action d-flex justify-content-between align-items-center" href="{% url "accounting:ledger" item period %}">
{{ item.title|title }} {{ item.title|title_case }}
<div> <div>
{% if item.debit_amount is not None %} {% if item.debit_amount is not None %}
<span class="badge badge-success badge-pill"> <span class="badge badge-success badge-pill">

View File

@ -20,6 +20,7 @@
""" """
from datetime import date from datetime import date
import titlecase
from django import template from django import template
from django.template import defaultfilters from django.template import defaultfilters
from django.urls import reverse from django.urls import reverse
@ -217,3 +218,16 @@ def smart_month(value):
if value.year == year and value.month == month: if value.year == year and value.month == month:
return gettext("Last Month") return gettext("Last Month")
return defaultfilters.date(value, "Y/n") return defaultfilters.date(value, "Y/n")
@register.filter
def title_case(value):
"""Formats the title in a proper American-English case.
Args:
value (str): The title.
Returns:
str: The title in a proper American-English case.
"""
return titlecase.titlecase(value)