aboutsummaryrefslogtreecommitdiff
path: root/budget
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2011-08-25 18:25:58 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2011-08-25 18:25:58 +0200
commit0303ab4db7fde0f663fd669d3d3f8f5e5800774f (patch)
treebe6df3adf369b09cf1afb6b8df3cdd238bf377f5 /budget
parent3f8cabd5a85af7b6a965137929874d9e0caaf35a (diff)
downloadihatemoney-mirror-0303ab4db7fde0f663fd669d3d3f8f5e5800774f.zip
ihatemoney-mirror-0303ab4db7fde0f663fd669d3d3f8f5e5800774f.tar.gz
ihatemoney-mirror-0303ab4db7fde0f663fd669d3d3f8f5e5800774f.tar.bz2
Add a way to reactivate an user, make the add project non obstrusive
Diffstat (limited to 'budget')
-rw-r--r--budget/templates/list_bills.html4
-rw-r--r--budget/web.py11
2 files changed, 13 insertions, 2 deletions
diff --git a/budget/templates/list_bills.html b/budget/templates/list_bills.html
index ff7297e..e9699dd 100644
--- a/budget/templates/list_bills.html
+++ b/budget/templates/list_bills.html
@@ -48,7 +48,7 @@
<td class="{% if balance[member] > 0 %}positive{% elif balance[member] < 0 %}negative{% endif %}">
{% if balance[member] > 0 %}+{% endif %}{{ balance[member] }}
</td>
- <td> {% if member.activated %}<a class="remove" href="{{ url_for("remove_member", member_id=member.id) }}">delete</a>{% endif %}</td>
+ <td> {% if member.activated %}<a class="remove" href="{{ url_for("remove_member", member_id=member.id) }}">delete</a>{% else %}<a href="{{ url_for("reactivate", member_id=member.id) }}">reactivate</a>{% endif %}</td>
</tr>
{% endif %}
{% endfor %}
@@ -60,7 +60,7 @@
{% endblock %}
{% block content %}
- <a id="new-bill" href="" class="primary">Add a new bill</a>
+<a id="new-bill" href="{{ url_for('add_bill') }}" class="primary">Add a new bill</a>
<form id="bill-form" action="{{ url_for('add_bill') }}" method="post" style="display: none">
<a id="hide-bill-form" href="#">hide this form</a>
{{ forms.add_bill(bill_form) }}
diff --git a/budget/web.py b/budget/web.py
index 4724baa..be5b1e9 100644
--- a/budget/web.py
+++ b/budget/web.py
@@ -187,6 +187,17 @@ def add_member():
return redirect(url_for("list_bills"))
return render_template("add_member.html", form=form)
+@app.route("/<project_id>/members/<member_id>/reactivate", methods=["GET",])
+def reactivate(member_id):
+ person = Person.query.filter(Person.id == member_id)\
+ .filter(Project.id == g.project.id).all()
+ if person:
+ person[0].activated = True
+ db.session.commit()
+ flash("%s is part of this project again" % person[0].name)
+ return redirect(url_for("list_bills"))
+
+
@app.route("/<project_id>/members/<member_id>/delete", methods=["GET", "POST"])
def remove_member(member_id):
person = Person.query.get_or_404(member_id)