From 672f2a1ca16a7e34acf8fadbf0d7113921d2573c Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Thu, 24 Nov 2011 00:27:51 +0100 Subject: revert arnaud's commit about delete links --- budget/templates/list_bills.html | 84 ++++++++-------------------------------- 1 file changed, 17 insertions(+), 67 deletions(-) (limited to 'budget/templates') diff --git a/budget/templates/list_bills.html b/budget/templates/list_bills.html index 192e200..0cbf583 100644 --- a/budget/templates/list_bills.html +++ b/budget/templates/list_bills.html @@ -39,70 +39,24 @@ $('#hide-bill-form').click(hide_form); $('#cancel-form').click(hide_form); - - var tr_id; - var id; - - // display the remove button on mouse over (and hide them per default) - $('.balance tr').hover(function() - { - tr_id = $(this).attr('id'); - var index = tr_id.lastIndexOf("-"); - id = tr_id.substring(index+1); - var action = $(this).attr('action'); - - var x = $(this).offset().left; - var y = $(this).offset().top; - var width = $(this).width(); - var height = $(this).height(); - - $('#overlay').css({ "left":x+"px", "top":y+"px", "width":width+"px", "height":height+"px", "line-height":height+"px" }).show(); - - if(!$(this).hasClass("confirm")) - { - $('#overlay').html(""); - if (action == 'delete') - { - $('#overlay-delete').css({ "left":(x+width/2-16)+"px", "top":(y+height/2-16)+"px" }).show(); - } - else if (action == 'reactivate') - { - $('#overlay-reactivate').css({ "left":(x+width/2-16)+"px", "top":(y+height/2-16)+"px" }).show(); - } - } - else - { - var url = "{{ url_for('.remove_member', member_id=id) }}"; - url = url.substring(0, url.lastIndexOf('/'))+id+url.substring(url.lastIndexOf('/')); - $('#overlay').html("{{_("you sure?")}}"); - } - }); - - // show confirm message before actually removing the member - $('#overlay-delete').click(function () - { - $('#'+tr_id).addClass("confirm"); - var url = "{{ url_for('.remove_member', member_id=id) }}"; - url = url.substring(0, url.lastIndexOf('/'))+id+url.substring(url.lastIndexOf('/')); - $('#overlay').html("{{_("you sure?")}}"); + // ask for confirmation before removing an user + $('a.remove').each(function(){ $(this).hide(); + $(this).click(function(){ + if ($(this).hasClass("confirm")){ + return true; + } + $(this).html("{{_("you sure?")}}"); + $(this).addClass("confirm"); + return false; + }); }); - // re-create reactivation url from hover-ed item and call it - $('#overlay-reactivate').click(function () - { - var url = "{{ url_for('.reactivate', member_id=id) }}"; - url = url.substring(0, url.lastIndexOf('/'))+id+url.substring(url.lastIndexOf('/')); - $(location).attr('href', url); - }); - - $('#overlay').hover(function() - { - }, function() - { - $('#overlay').hide(); - $('#overlay-delete').hide(); - $('#overlay-reactivate').hide(); + // display the remove button on mouse over (and hide them per default) + $('.balance tr').hover(function(){ + $(this).find('.remove').show(); + }, function(){ + $(this).find('.remove').hide(); }); $.datepicker.setDefaults({'dateFormat': 'yy-mm-dd'}); @@ -139,11 +93,12 @@ {% set balance = g.project.balance %} {% for member in g.project.members %} {% if member.activated or balance[member.id] != 0 %} - + {{ member.name }} {% if balance[member.id] > 0 %}+{% endif %}{{ balance[member.id] }} + {% if member.activated %}{{ _("delete") }}{% else %}{{ _("reactivate") }}{% endif %} {% endif %} {% endfor %} @@ -151,9 +106,6 @@ -
- - {% endblock %} {% block content %} @@ -192,8 +144,6 @@ {% else %}

{{ _("Nothing to list yet. You probably want to") }} {{ _("add a bill") }} ?

{% endif %} - -