From dd99734d312d373e69206b0664148fe55b9c4657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 3 Jan 2014 14:53:10 +0100 Subject: [PATCH] backoffice: make the summary and history sections foldable (#3094) --- wcs/backoffice/root.py | 1 + wcs/forms/common.py | 8 ++++++-- wcs/qommon/static/css/dc2/admin.css | 15 +++++++++++++++ wcs/qommon/static/js/qommon.admin.js | 4 ++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/wcs/backoffice/root.py b/wcs/backoffice/root.py index c13f5bb..1f31ab9 100644 --- a/wcs/backoffice/root.py +++ b/wcs/backoffice/root.py @@ -716,4 +716,5 @@ class FormBackOfficeStatusPage(FormStatusPage): return html_top('forms', title) def _q_index(self): + get_response().add_javascript(['jquery.js', 'qommon.admin.js']) return self.status() diff --git a/wcs/forms/common.py b/wcs/forms/common.py index 4fd13f4..9563b6b 100644 --- a/wcs/forms/common.py +++ b/wcs/forms/common.py @@ -205,7 +205,7 @@ class FormStatusPage(Directory): return r = TemplateIO(html=True) r += htmltext('
') - r += htmltext('

%s

') % _('Log') + r += htmltext('

%s

') % _('Log') r += htmltext('
') hidden = False for evo in self.filled.evolution: @@ -295,7 +295,10 @@ class FormStatusPage(Directory): break r = TemplateIO(html=True) + r += htmltext('
') + r += htmltext('

%s

') % _('Summary') r += htmltext('
') + if self.formdef.signing and not self.filled.signature: r += htmltext('
%s
') % \ _("Warning form not signed") @@ -378,7 +381,8 @@ class FormStatusPage(Directory): r += htmltext('

%s ') % _('Status') r += htmltext('%s

') % wf_status.name - r += htmltext('
') + r += htmltext('
') # .dataview + r += htmltext('
') # .bo-block return r.getvalue() diff --git a/wcs/qommon/static/css/dc2/admin.css b/wcs/qommon/static/css/dc2/admin.css index d86f124..a7c9833 100644 --- a/wcs/qommon/static/css/dc2/admin.css +++ b/wcs/qommon/static/css/dc2/admin.css @@ -757,3 +757,18 @@ svg .page-subject polygon { svg .page-subject path { stroke: #91a9b2; } + +.foldable { + cursor: pointer; +} + +.foldable:after { + content: "▼"; + font-size: 80%; + text-align: right; + float: right; +} + +.foldable.folded:after { + content: "▶"; +} diff --git a/wcs/qommon/static/js/qommon.admin.js b/wcs/qommon/static/js/qommon.admin.js index d2fb015..8fd8430 100644 --- a/wcs/qommon/static/js/qommon.admin.js +++ b/wcs/qommon/static/js/qommon.admin.js @@ -10,4 +10,8 @@ $(function() { $(dialog).css('height', ($(window).height() - 80) + 'px'); return false; }); + $('.foldable').click(function() { + $(this).toggleClass('folded').next().toggle(); + }); + $('.foldable.folded').next().hide(); }); -- 1.8.5.2