Improve confirm agenda item delete message dependent on childrens available or not.

This commit is contained in:
Emanuel Schuetze 2011-11-14 21:52:33 +01:00
parent d54afd7ad6
commit 763b8c15e1

View File

@ -58,10 +58,16 @@ def children_list(items):
l += children_list(item.children)
return l
def gen_confirm_form_for_items(request, message, url):
def gen_confirm_form_for_items(request, message, url, singleitem=None):
if singleitem:
messages.warning(request, '%s<form action="%s" method="post"><input type="hidden" value="%s" name="csrfmiddlewaretoken"><input type="submit" value="%s" /> <input type="button" value="%s"></form>' % (message, url, csrf(request)['csrf_token'], _("Yes"), _("No")))
else:
messages.warning(request, '%s<form action="%s" method="post"><input type="hidden" value="%s" name="csrfmiddlewaretoken"><input type="submit" value="%s" /> <input type="submit" name="all" value="%s" /> <input type="button" value="%s"></form>' % (message, url, csrf(request)['csrf_token'], _("Yes"), _("Yes, with all child items."), _("No")))
def del_confirm_form_for_items(request, object, name=None):
if name is None:
name = object
gen_confirm_form_for_items(request, _('Do you really want to delete <b>%s</b>?') % name, object.get_absolute_url('delete'))
if object.children:
gen_confirm_form_for_items(request, _('Do you really want to delete <b>%s</b>?') % name, object.get_absolute_url('delete'), False)
else:
gen_confirm_form_for_items(request, _('Do you really want to delete <b>%s</b>?') % name, object.get_absolute_url('delete'), True)