Better user interaction on close send download bills action

This commit is contained in:
Marc Aymerich 2016-02-16 13:22:11 +00:00
parent 84dd6f26e0
commit b70d307a2f
3 changed files with 65 additions and 4 deletions

View file

@ -448,8 +448,6 @@ mkhomedir_helper or create ssh homes with bash.rc and such
# show base and total desglosed
# CLOSE&DOWNLOAD doesn't redirect to anything, confusing for users
# Reverse lOgHistory order by date (lastest first)
@ -459,7 +457,6 @@ mkhomedir_helper or create ssh homes with bash.rc and such
# POSTFIX web traffic monitor '": uid=" from=<%(user)s>'
# Mv .deleted make sure it works with nested destinations
# Automatically re-run backends until success? only timedout executions?
# TODO save serialized versions ob backendoperation.instance in order to allow backend reexecution of deleted objects

View file

@ -89,7 +89,10 @@ def close_bills(modeladmin, request, queryset, action='close_bills'):
'formset': formset,
'obj': get_object_from_url(modeladmin, request),
}
return render(request, 'admin/orchestra/generic_confirmation.html', context)
templete = 'admin/orchestra/generic_confirmation.html'
if action == 'close_send_download_bills':
template = 'admin/bills/bill/close_send_download_bills.html'
return render(request, template, context)
close_bills.tool_description = _("Close")
close_bills.url_name = 'close'

View file

@ -0,0 +1,61 @@
{% extends "admin/orchestra/generic_confirmation.html" %}
{% load i18n l10n %}
{% load url from future %}
{% load admin_urls static utils %}
{% block extrastyle %}
{{ block.super }}
<script type="text/javascript">
function DoSubmit() {
// document.form.button.type = 'hidden';
document.getElementsByName("message")[0].innerHTML = "Bills are being generated and download will start shortly...";
document.getElementsByTagName("fieldset")[0].style.display = 'none';
document.form.button.value = 'Go back';
return true;
}
</script>
{% endblock %}
{% block content %}
<div name="content">
<div style="margin:20px;">
<div name="message">
<p>{{ content_message | safe }}</p>
<ul>{{ display_objects | unordered_list }}</ul>
</div>
<form name="form" action="" method="post" onsubmit="DoSubmit();">{% csrf_token %}
{% block form %}
{% if form %}
<fieldset class="module aligned">
{{ form.non_field_errors }}
{% for field in form %}
<div class="form-row ">
<div >
{{ field.errors }}
{% if field|is_checkbox %}
{{ field }} <label for="{{ field.id_for_label }}" class="vCheckboxLabel">{{ field.label }}</label>
{% else %}
{{ field.label_tag }} {{ field }}
{% endif %}
<p class="help">{{ field.help_text|safe }}</p>
</div>
</div>
{% endfor %}
</fieldset>
{% endif %}
{% endblock %}
{% block formset %}
{% if formset %}
{{ formset.as_admin }}
{% endif %}
{% endblock %}
<div>
{% for obj in queryset %}
<input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk|unlocalize }}" />
{% endfor %}
<input type="hidden" name="action" value="{{ action_value }}" />
<input type="hidden" name="post" value="{{ post_value|default:'generic_confirmation' }}" />
<input name="button" type="submit" value="{{ submit_value|default:_("Yes, I'm sure") }}" />
</div>
</form>
{% endblock %}