1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ihatemoney_ynh.git synced 2024-09-03 19:26:15 +02:00

Factor navbar between list_bills and settle_bill

This commit is contained in:
Jocelyn Delalande 2017-01-30 23:23:03 +01:00
parent a79685798d
commit 87d2dea9c8
3 changed files with 9 additions and 9 deletions

View file

@ -42,8 +42,8 @@
{% if g.project %} {% if g.project %}
<ul class="nav primary-nav"> <ul class="nav primary-nav">
{% block navbar %} {% block navbar %}
<li class="active"><a href="{{ url_for(".list_bills") }}">{{ _("Bills") }}</a></li> <li class="nav-item{% if current_view == 'list_bills' %} active{% endif %}"><a class="nav-link" href="{{ url_for(".list_bills") }}">{{ _("Bills") }}</a></li>
<li><a href="{{ url_for(".settle_bill") }}">{{ _("Settle") }}</a></li> <li class="nav-item{% if current_view == 'settle_bill' %} active{% endif %}"><a class="nav-link" href="{{ url_for(".settle_bill") }}">{{ _("Settle") }}</a></li>
{% endblock %} {% endblock %}
</ul> </ul>
{% endif %} {% endif %}

View file

@ -1,10 +1,5 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% block navbar %}
<li><a href="{{ url_for(".list_bills") }}">{{ _("Bills") }}</a></li>
<li class="active"><a href="{{ url_for(".settle_bill") }}">{{ _("Settle") }}</a></li>
{% endblock %}
{% block sidebar %} {% block sidebar %}
<div id="sidebar" class="sidebar"> <div id="sidebar" class="sidebar">

View file

@ -284,7 +284,8 @@ def list_bills():
return render_template("list_bills.html", return render_template("list_bills.html",
bills=bills, member_form=MemberForm(g.project), bills=bills, member_form=MemberForm(g.project),
bill_form=bill_form, bill_form=bill_form,
add_bill=request.values.get('add_bill', False) add_bill=request.values.get('add_bill', False),
current_view="list_bills",
) )
@ -414,7 +415,11 @@ def change_lang(lang):
def settle_bill(): def settle_bill():
"""Compute the sum each one have to pay to each other and display it""" """Compute the sum each one have to pay to each other and display it"""
bills = g.project.get_transactions_to_settle_bill() bills = g.project.get_transactions_to_settle_bill()
return render_template("settle_bills.html", bills=bills) return render_template(
"settle_bills.html",
bills=bills,
current_view='settle_bill',
)
@main.route("/<project_id>/archives/create", methods=["GET", "POST"]) @main.route("/<project_id>/archives/create", methods=["GET", "POST"])