Renamed the can_view_accounting and can_edit_accounting template functions to accounting_can_view and accounting_can_edit, respectively.

This commit is contained in:
依瑪貓 2023-02-07 17:15:05 +08:00
parent 708a434b5d
commit b1c7bc61c4
7 changed files with 16 additions and 16 deletions

View File

@ -30,7 +30,7 @@ First written: 2023/1/31
<i class="fa-solid fa-circle-chevron-left"></i> <i class="fa-solid fa-circle-chevron-left"></i>
{{ A_("Back") }} {{ A_("Back") }}
</a> </a>
{% if can_edit_accounting() %} {% if accounting_can_edit() %}
<a class="btn btn-primary d-none d-md-inline" href="{{ url_for("accounting.account.edit", account=obj)|accounting_inherit_next }}"> <a class="btn btn-primary d-none d-md-inline" href="{{ url_for("accounting.account.edit", account=obj)|accounting_inherit_next }}">
<i class="fa-solid fa-gear"></i> <i class="fa-solid fa-gear"></i>
{{ A_("Settings") }} {{ A_("Settings") }}
@ -40,7 +40,7 @@ First written: 2023/1/31
<i class="fa-solid fa-bars-staggered"></i> <i class="fa-solid fa-bars-staggered"></i>
{{ A_("Order") }} {{ A_("Order") }}
</a> </a>
{% if can_edit_accounting() %} {% if accounting_can_edit() %}
<button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#delete-modal"> <button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#delete-modal">
<i class="fa-solid fa-trash"></i> <i class="fa-solid fa-trash"></i>
{{ A_("Delete") }} {{ A_("Delete") }}
@ -48,7 +48,7 @@ First written: 2023/1/31
{% endif %} {% endif %}
</div> </div>
{% if can_edit_accounting() %} {% if accounting_can_edit() %}
<div class="d-md-none material-fab"> <div class="d-md-none material-fab">
<a class="btn btn-primary" href="{{ url_for("accounting.account.edit", account=obj)|accounting_inherit_next }}"> <a class="btn btn-primary" href="{{ url_for("accounting.account.edit", account=obj)|accounting_inherit_next }}">
<i class="fa-solid fa-pen-to-square"></i> <i class="fa-solid fa-pen-to-square"></i>
@ -56,7 +56,7 @@ First written: 2023/1/31
</div> </div>
{% endif %} {% endif %}
{% if can_edit_accounting() %} {% if accounting_can_edit() %}
<form id="delete-form" action="{{ url_for("accounting.account.delete", account=obj) }}" method="post"> <form id="delete-form" action="{{ url_for("accounting.account.delete", account=obj) }}" method="post">
<input id="csrf_token" type="hidden" name="csrf_token" value="{{ csrf_token() }}"> <input id="csrf_token" type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% if "next" in request.args %} {% if "next" in request.args %}

View File

@ -26,7 +26,7 @@ First written: 2023/1/30
{% block content %} {% block content %}
<div class="btn-group mb-2"> <div class="btn-group mb-2">
{% if can_edit_accounting() %} {% if accounting_can_edit() %}
<a class="btn btn-primary text-nowrap d-none d-md-block" href="{{ url_for("accounting.account.create")|accounting_append_next }}"> <a class="btn btn-primary text-nowrap d-none d-md-block" href="{{ url_for("accounting.account.create")|accounting_append_next }}">
<i class="fa-solid fa-plus"></i> <i class="fa-solid fa-plus"></i>
{{ A_("New") }} {{ A_("New") }}
@ -43,7 +43,7 @@ First written: 2023/1/30
</form> </form>
</div> </div>
{% if can_edit_accounting() %} {% if accounting_can_edit() %}
<div class="d-md-none material-fab"> <div class="d-md-none material-fab">
<a class="btn btn-primary" href="{{ url_for("accounting.account.create")|accounting_append_next }}"> <a class="btn btn-primary" href="{{ url_for("accounting.account.create")|accounting_append_next }}">
<i class="fa-solid fa-plus"></i> <i class="fa-solid fa-plus"></i>

View File

@ -37,7 +37,7 @@ First written: 2023/2/2
</a> </a>
</div> </div>
{% if base.accounts|length > 1 and can_edit_accounting() %} {% if base.accounts|length > 1 and accounting_can_edit() %}
<form action="{{ url_for("accounting.account.sort", base=base) }}" method="post"> <form action="{{ url_for("accounting.account.sort", base=base) }}" method="post">
<input id="csrf_token" type="hidden" name="csrf_token" value="{{ csrf_token() }}"> <input id="csrf_token" type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% if "next" in request.args %} {% if "next" in request.args %}

View File

@ -30,13 +30,13 @@ First written: 2023/2/6
<i class="fa-solid fa-circle-chevron-left"></i> <i class="fa-solid fa-circle-chevron-left"></i>
{{ A_("Back") }} {{ A_("Back") }}
</a> </a>
{% if can_edit_accounting() %} {% if accounting_can_edit() %}
<a class="btn btn-primary d-none d-md-inline" href="{{ url_for("accounting.currency.edit", currency=obj)|accounting_inherit_next }}"> <a class="btn btn-primary d-none d-md-inline" href="{{ url_for("accounting.currency.edit", currency=obj)|accounting_inherit_next }}">
<i class="fa-solid fa-gear"></i> <i class="fa-solid fa-gear"></i>
{{ A_("Settings") }} {{ A_("Settings") }}
</a> </a>
{% endif %} {% endif %}
{% if can_edit_accounting() %} {% if accounting_can_edit() %}
<button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#delete-modal"> <button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#delete-modal">
<i class="fa-solid fa-trash"></i> <i class="fa-solid fa-trash"></i>
{{ A_("Delete") }} {{ A_("Delete") }}
@ -44,7 +44,7 @@ First written: 2023/2/6
{% endif %} {% endif %}
</div> </div>
{% if can_edit_accounting() %} {% if accounting_can_edit() %}
<div class="d-md-none material-fab"> <div class="d-md-none material-fab">
<a class="btn btn-primary" href="{{ url_for("accounting.currency.edit", currency=obj)|accounting_inherit_next }}"> <a class="btn btn-primary" href="{{ url_for("accounting.currency.edit", currency=obj)|accounting_inherit_next }}">
<i class="fa-solid fa-pen-to-square"></i> <i class="fa-solid fa-pen-to-square"></i>
@ -52,7 +52,7 @@ First written: 2023/2/6
</div> </div>
{% endif %} {% endif %}
{% if can_edit_accounting() %} {% if accounting_can_edit() %}
<form id="delete-form" action="{{ url_for("accounting.currency.delete", currency=obj) }}" method="post"> <form id="delete-form" action="{{ url_for("accounting.currency.delete", currency=obj) }}" method="post">
<input id="csrf_token" type="hidden" name="csrf_token" value="{{ csrf_token() }}"> <input id="csrf_token" type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% if "next" in request.args %} {% if "next" in request.args %}

View File

@ -26,7 +26,7 @@ First written: 2023/2/6
{% block content %} {% block content %}
<div class="btn-group mb-2"> <div class="btn-group mb-2">
{% if can_edit_accounting() %} {% if accounting_can_edit() %}
<a class="btn btn-primary text-nowrap d-none d-md-block" href="{{ url_for("accounting.currency.create")|accounting_append_next }}"> <a class="btn btn-primary text-nowrap d-none d-md-block" href="{{ url_for("accounting.currency.create")|accounting_append_next }}">
<i class="fa-solid fa-plus"></i> <i class="fa-solid fa-plus"></i>
{{ A_("New") }} {{ A_("New") }}
@ -43,7 +43,7 @@ First written: 2023/2/6
</form> </form>
</div> </div>
{% if can_edit_accounting() %} {% if accounting_can_edit() %}
<div class="d-md-none material-fab"> <div class="d-md-none material-fab">
<a class="btn btn-primary" href="{{ url_for("accounting.currency.create")|accounting_append_next }}"> <a class="btn btn-primary" href="{{ url_for("accounting.currency.create")|accounting_append_next }}">
<i class="fa-solid fa-plus"></i> <i class="fa-solid fa-plus"></i>

View File

@ -19,7 +19,7 @@ nav.html: The navigation menu for the accounting application.
Author: imacat@mail.imacat.idv.tw (imacat) Author: imacat@mail.imacat.idv.tw (imacat)
First written: 2023/1/26 First written: 2023/1/26
#} #}
{% if can_view_accounting() %} {% if accounting_can_view() %}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<span class="nav-link dropdown-toggle" data-bs-toggle="dropdown"> <span class="nav-link dropdown-toggle" data-bs-toggle="dropdown">
<i class="fa-solid fa-gear"></i> <i class="fa-solid fa-gear"></i>

View File

@ -104,5 +104,5 @@ def init_app(bp: Blueprint,
__can_view_func = can_view_func __can_view_func = can_view_func
if can_edit_func is not None: if can_edit_func is not None:
__can_edit_func = can_edit_func __can_edit_func = can_edit_func
bp.add_app_template_global(can_view, "can_view_accounting") bp.add_app_template_global(can_view, "accounting_can_view")
bp.add_app_template_global(can_edit, "can_edit_accounting") bp.add_app_template_global(can_edit, "accounting_can_edit")