mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
commit
adfa5f9263
4 changed files with 30 additions and 11 deletions
|
@ -182,17 +182,22 @@ tr.payer_line .balance-name{
|
|||
opacity: 0.6;
|
||||
text-align: center;
|
||||
}
|
||||
.action a, .action a:hover {
|
||||
height: 16px;
|
||||
padding-left: 20px;
|
||||
.action form {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.action button, .action button:hover {
|
||||
width: auto;
|
||||
margin: 0;
|
||||
padding: 0 0 0 20px;
|
||||
}
|
||||
|
||||
.delete a, .delete a:hover {
|
||||
.delete button, .delete button:hover {
|
||||
background: url('images/deleter.png') left no-repeat;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.reactivate a, .reactivate a:hover {
|
||||
.reactivate button, .reactivate button:hover {
|
||||
background: url('images/reactivate.png') left no-repeat;
|
||||
color: white;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
// ask for confirmation before removing an user
|
||||
$('.action').each(function(){
|
||||
$(this).hide();
|
||||
var link = $(this).find('a');
|
||||
var link = $(this).find('button');
|
||||
link.click(function(){
|
||||
if ($(this).hasClass("confirm")){
|
||||
return true;
|
||||
|
@ -83,9 +83,13 @@
|
|||
{% if balance[member.id] > 0 %}+{% endif %}{{ balance[member.id] }}
|
||||
</td>
|
||||
{% if member.activated %}
|
||||
<td class="action delete"> <a href="{{ url_for(".remove_member", member_id=member.id) }}">{{ _("delete") }}</a></td>
|
||||
<td class="action delete">
|
||||
<form action="{{ url_for(".remove_member", member_id=member.id) }}" method="POST">
|
||||
<button type="submit">{{ _("delete") }}</button></form></td>
|
||||
{% else %}
|
||||
<td class="action reactivate"> <a href="{{ url_for(".reactivate", member_id=member.id) }}">{{ _("reactivate") }}</a></td>
|
||||
<td class="action reactivate">
|
||||
<form action="{{ url_for(".reactivate", member_id=member.id) }}" method="POST">
|
||||
<button type="submit">{{ _("reactivate") }}</button></form></td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -214,6 +214,16 @@ class BudgetTestCase(TestCase):
|
|||
self.assertEqual(
|
||||
len(models.Project.query.get("randomid").active_members), 1)
|
||||
|
||||
def test_member_delete_method(self):
|
||||
self.post_project("raclette")
|
||||
self.login("raclette")
|
||||
|
||||
# adds a member to this project
|
||||
self.app.post("/raclette/members/add", data={'name': 'alexis' })
|
||||
|
||||
# try to remove the member using GET method
|
||||
response = self.app.get("/raclette/members/1/delete")
|
||||
self.assertEqual(response.status_code, 405)
|
||||
|
||||
def test_demo(self):
|
||||
# Test that it is possible to connect automatically by going onto /demo
|
||||
|
|
|
@ -185,7 +185,7 @@ def edit_project():
|
|||
|
||||
return render_template("edit_project.html", form=form)
|
||||
|
||||
@main.route("/<project_id>/delete", methods=["GET"])
|
||||
@main.route("/<project_id>/delete", methods=["POST"])
|
||||
def remove_project():
|
||||
g.project.remove_project()
|
||||
|
||||
|
@ -265,7 +265,7 @@ def add_member():
|
|||
|
||||
return render_template("add_member.html", form=form)
|
||||
|
||||
@main.route("/<project_id>/members/<member_id>/reactivate", methods=["GET",])
|
||||
@main.route("/<project_id>/members/<member_id>/reactivate", methods=["POST"])
|
||||
def reactivate(member_id):
|
||||
person = Person.query.filter(Person.id == member_id)\
|
||||
.filter(Project.id == g.project.id).all()
|
||||
|
@ -276,7 +276,7 @@ def reactivate(member_id):
|
|||
return redirect(url_for(".list_bills"))
|
||||
|
||||
|
||||
@main.route("/<project_id>/members/<member_id>/delete", methods=["GET", "POST"])
|
||||
@main.route("/<project_id>/members/<member_id>/delete", methods=["POST"])
|
||||
def remove_member(member_id):
|
||||
member = g.project.remove_member(member_id)
|
||||
if member.activated == False:
|
||||
|
|
Loading…
Reference in a new issue