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

Add a way to reactivate an user, make the add project non obstrusive

This commit is contained in:
Alexis Metaireau 2011-08-25 18:25:58 +02:00
parent 3f8cabd5a8
commit 0303ab4db7
2 changed files with 13 additions and 2 deletions

View file

@ -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) }}

View file

@ -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)