diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 8 | ||||
-rw-r--r-- | templates/web/zurich/admin/report_edit-sdm.html | 13 | ||||
-rw-r--r-- | templates/web/zurich/admin/report_edit.html | 204 | ||||
-rw-r--r-- | web/cobrands/zurich/base.scss | 15 | ||||
-rw-r--r-- | web/cobrands/zurich/layout.scss | 5 |
5 files changed, 138 insertions, 107 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 0e75d71b9..075e9dd9c 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -751,8 +751,7 @@ sub admin_report_edit { $problem->lastupdate( \'current_timestamp' ); $problem->update; - $c->stash->{status_message} = - '<p><em>' . _('Updated!') . '</em></p>'; + $c->stash->{status_message} = '<p class="message-updated">' . _('Updated!') . '</p>'; # do this here otherwise lastupdate and confirmed times # do not display correctly (reloads problem from database, including @@ -777,7 +776,7 @@ sub admin_report_edit { if ( $redirect and $type eq 'dm' ) { # only redirect for DM - $c->stash->{status_message} ||= '<p><em>' . _('Updated!') . '</em></p>'; + $c->stash->{status_message} ||= '<p class="message-updated">' . _('Updated!') . '</p>'; $c->go('index'); } @@ -847,7 +846,7 @@ sub admin_report_edit { # Make sure the problem's time_spent is updated $self->update_admin_log($c, $problem); - $c->stash->{status_message} = '<p><em>' . _('Updated!') . '</em></p>'; + $c->stash->{status_message} = '<p class="message-updated">' . _('Updated!') . '</p>'; # If they clicked the no more updates button, we're done. if ($c->get_param('no_more_updates')) { @@ -957,6 +956,7 @@ sub stash_states { @states = grep { $_->{$state} } @states; } $c->stash->{states} = \@states; + $c->stash->{states_trans} = { map { $_->{state} => $_->{trans} } @states }; # [% states_trans.${problem.state} %] # stash details about the public response $c->stash->{default_public_response} = "\nFreundliche Grüsse\n\nIhre Stadt Zürich\n"; diff --git a/templates/web/zurich/admin/report_edit-sdm.html b/templates/web/zurich/admin/report_edit-sdm.html index 98092815c..d71519539 100644 --- a/templates/web/zurich/admin/report_edit-sdm.html +++ b/templates/web/zurich/admin/report_edit-sdm.html @@ -9,8 +9,6 @@ [% map_html %] </div> -[% status_message %] - <form method="post" action="[% c.uri_for( 'report_edit', problem.id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> <input type="hidden" name="token" value="[% token %]" > <input type="hidden" name="submit" value="1" > @@ -63,7 +61,7 @@ </li> <li> - <label>[% loc('Time spent (in minutes):') %]</label> [% problem.get_time_spent %] + <label class="admin-label--inline">[% loc('Time spent (in minutes):') %]</label> [% problem.get_time_spent %] </li> [% IF problem.photo %] @@ -79,6 +77,8 @@ <div class="admin-report-edit admin-report-edit--interact"> +[% status_message %] + <p align="right"><input type="submit" name="send_back" value="[% loc('Not for my subdivision') %]"></p> <p align="right"><input type="submit" name="not_contactable" value="[% loc('Customer not contactable') %]"></p> @@ -91,7 +91,7 @@ </ul> <p class="report-edit-action"> -<label for="time_spent">[% loc('Time spent (in minutes):') %]</label> +<label class="admin-label--inline" for="time_spent">[% loc('Time spent (in minutes):') %]</label> <input type="text" name="time_spent" id="form_time_spent" style="width: 4em" value="0"> <script> $(function () { @@ -100,6 +100,11 @@ if (ui.value < 0) { return false } } }); + setTimeout(function(){ + $('.message-updated').slideUp(250, function(){ + $(this).remove(); + }); + }, 5000); }); </script> </p> diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html index 802ac466d..78ac0d32d 100644 --- a/templates/web/zurich/admin/report_edit.html +++ b/templates/web/zurich/admin/report_edit.html @@ -12,8 +12,6 @@ [% pstate = problem.get_extra_metadata('closure_status') || problem.state %] -[% status_message %] - <form method="post" action="[% c.uri_for( 'report_edit', problem.id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> <input type="hidden" name="token" value="[% token %]" > <input type="hidden" name="submit" value="1" > @@ -90,7 +88,7 @@ </li> <li> - <label>[% loc('Time spent (in minutes):') %]</label> [% problem.get_time_spent %] + <label class="admin-label--inline">[% loc('Time spent (in minutes):') %]</label> [% problem.get_time_spent %] </li> [% IF problem.photo %] @@ -114,26 +112,9 @@ <div class="admin-report-edit admin-report-edit--interact"> -<p class="report-edit-action"> - <label for="new_internal_note">[% loc('New internal note:') %]</label> - <textarea name='new_internal_note' id='new_internal_note' cols=60 rows=4>[% new_internal_note | html %]</textarea> -</p> - -<p class="report-edit-action"> -<label for="time_spent">[% loc('Time spent (in minutes):') %]</label> -<input type="text" name="time_spent" id="form_time_spent" style="width: 4em" value="0"> -<script> - $(function () { - $('#form_time_spent').spinner({ - spin: function (e, ui) { - if (ui.value < 0) { return false } - } - }); - }); -</script> -</p> +[% status_message %] -<p> +<p> <span class="mock-label">[% loc('State:') %]</span> <select name="state" id="state"> <option value="">--</option> @@ -143,78 +124,23 @@ </select> </p> -<script type="text/javascript"> -$(function(){ - - $('.assignation__select').change(function(){ - if (this.value == "") { - $('.assignation').css('color', '#000'); - } else { - var a = $(this).closest('li').css('color', '#000'); - $('.assignation select').not(this).val(""); - $('.assignation').not(a).css('color', '#999'); - } - }); - - $('#state').change(function(){ - // Show or hide the automatic reply field - var state = $(this).val(); - - // show or disable assignation, templates, public_response, publish if - // same or different state to the one we started on - if ((state === '[% pstate %]')) { - $('input[name=publish_response]').show(); - $('.response_templates_select').show(); - $('#status_update_container').show(); - - if (state === 'confirmed') { - $('#assignation__category').show(); - $('#assignation__subdivision').show(); - } - if ((state === 'closed') || (state === 'investigating')) { - $('#assignation__external').show(); - } - } - else { - $('input[name=publish_response]').hide(); - $('.response_templates_select').hide(); - $('#status_update_container').hide(); - - $('#assignation__category').hide(); - $('#assignation__subdivision').hide(); - $('#assignation__category select').val(''); - $('#assignation__subdivision select').val(''); - - $('#assignation__external select').val(''); - $('#assignation__external').hide(); - } - - }).change(); -}); -</script> - -<ul class="no-bullets"> [% IF problem.state == 'confirmed' %] +<ul class="no-bullets"> -<li class="assignation"> -<label for="category"> -[% loc('Category:') %] [% problem.category %]<br> - - <div id="assignation__category"> - [% loc('Assign to different category:') %]</label> + <li class="assignation report-edit-action" id="assignation__category"> + <label for="category">[% loc('Assign to category:') %]</label> <select name="category" id="category" class="assignation__select"> <option value="">--</option> [% FOREACH cat IN categories %] <option value="[% cat %]">[% cat %]</option> [% END %] </select> - </div> -</li> + </li> -[% list = FOR body IN bodies %] + [% list = FOR body IN bodies %] [%- NEXT UNLESS body.parent.id == c.user.from_body.id %] <option value="[% body.id %]"[% IF body.id == problem.bodies_str %] selected[% END %]>[% body.name %]</option> -[% END %] + [% END %] [% IF admin_type != 'super' AND list %] <li class="assignation report-edit-action" id="assignation__subdivision"> <label for="body_subdivision">[% loc('Assign to subdivision:') %]</label> @@ -225,32 +151,36 @@ $(function(){ </li> [% END %] +</ul> [% END %] [%# 3rd party messages sent for Extern/Wunsch states %] [% SWITCH pstate %] [% CASE ['closed','investigating'] %] - <ul class="no-bullets"> - <li class="assignation report-edit-action" id="assignation__external"> - <label for="body_external"> - [% IF pstate == 'closed' %] + <ul class="no-bullets assignation report-edit-action" id="assignation__external"> + <li> + <label for="body_external"> + [% IF pstate == 'closed' %] [% loc('Assign to external body:') %] - [% ELSE %] + [% ELSE %] [% loc('Assign to competent body:') %] - [% END %] - </label> + [% END %] + </label> <select name="body_external" id="body_external"> <option value="">--</option> - [% FOR body IN bodies %] + [% FOR body IN bodies %] [% NEXT IF body.parent OR body.bodies OR body.deleted %] <option value="[% body.id %]"[% IF body.id == problem.external_body %] selected[% END %]>[% body.name %]</option> - [% END %] + [% END %] </select> - <br> - [% IF pstate == 'closed' %] + </li> + <li> + [% IF pstate == 'closed' %] <input type="checkbox" name="third_personal" id="third_personal" value="1"[% ' checked' IF problem.extra.third_personal %]> <label for="third_personal" class="inline">[% loc('Include reporter personal details') %]</label> - [% END %] + [% END %] + </li> + <li> [% INCLUDE 'admin/response_templates_select.html' for='external_body' %] <textarea name='external_message' id='external_body' cols=60 rows=5>[% problem.get_extra_metadata('external_message') | html %]</textarea> </li> @@ -277,19 +207,29 @@ $(function(){ </ul> [% END %] +<p class="report-edit-action"> + <label for="new_internal_note">[% loc('New internal note:') %]</label> + <textarea name='new_internal_note' id='new_internal_note' cols=60 rows=4>[% new_internal_note | html %]</textarea> +</p> + +<p class="report-edit-action"> + <label class="admin-label--inline" for="time_spent">[% loc('Time spent (in minutes):') %]</label> + <input type="text" name="time_spent" id="form_time_spent" style="width: 4em" value="0"> +</p> + <p align="right" class="report-edit-action"> -[% IF show_publish_response %] + [% IF show_publish_response %] [%# While we call this 'publish_response', the response will not actually # be "published" for these cases: Wish / Hidden / Not contactable (for these, # only a private email will be sent to the user. However, in all cases, # this is the end of processing, so we mark this with the same text used # for 'No further updates %] -<input type="submit" name="publish_response" value="[% loc('No further updates') %]"> -[% END %] + <input type="submit" name="publish_response" value="[% loc('No further updates') %]"> + [% END %] [%# This button simply saves changes, but does NOT close the report (though # it may trigger other workflow %] -<input type="submit" name="Submit changes" value="[% loc('Submit changes') %]" > + <input type="submit" name="Submit changes" value="[% loc('Submit changes') %]" > </p> [% IF c.cobrand.problem_has_public_response(problem) %] @@ -305,4 +245,70 @@ $(function(){ </form> +<script type="text/javascript"> +$(function(){ + + $('#form_time_spent').spinner({ + spin: function (e, ui) { + if (ui.value < 0) { return false } + } + }); + + setTimeout(function(){ + $('.message-updated').slideUp(250, function(){ + $(this).remove(); + }); + }, 5000); + + $('.assignation__select').change(function(){ + if (this.value == "") { + $('.assignation').css('color', '#000'); + } else { + var a = $(this).closest('li').css('color', '#000'); + $('.assignation select').not(this).val(""); + $('.assignation').not(a).css('color', '#999'); + } + }); + + $('#state').change(function(){ + // Show or hide the automatic reply field + var state = $(this).val(); + + // show or disable assignation, templates, public_response, publish if + // same or different state to the one we started on + if ((state === '[% pstate %]')) { + $('input[name=publish_response]').show(); + $('.response_templates_select').show(); + $('#status_update_container').show(); + + if (state === 'confirmed') { + $('#assignation__category').show(); + $('#assignation__subdivision').show(); + } + if ((state === 'closed') || (state === 'investigating')) { + $('#assignation__external').show(); + } else { + $('#assignation__external').hide(); + } + } + else { + $('input[name=publish_response]').hide(); + $('.response_templates_select').hide(); + $('#status_update_container').hide(); + + $('#assignation__category').hide(); + $('#assignation__subdivision').hide(); + $('#assignation__category select').val(''); + $('#assignation__subdivision select').val(''); + + $('#assignation__external select').val(''); + $('#assignation__external').hide(); + $('#external_body').hide(); + $('#third_personal, label[for=third_personal]').hide(); + } + + }).change(); +}); +</script> + [% INCLUDE 'admin/footer.html' %] diff --git a/web/cobrands/zurich/base.scss b/web/cobrands/zurich/base.scss index 131036229..bb515bf79 100644 --- a/web/cobrands/zurich/base.scss +++ b/web/cobrands/zurich/base.scss @@ -225,6 +225,21 @@ h4.static-with-rule { } } +.admin { + label.inline { + padding: 0; + } + + input[type="checkbox"] + label.inline { + margin-right: 0.2em; + } +} + +.admin-label--inline { + display: inline; // rather than block + margin-right: 0.333em; // bit of space between this and the following input +} + .ui-spinner input { // stop jQuery UI spinner inputs from inheriting FMS input styles padding: 1px; diff --git a/web/cobrands/zurich/layout.scss b/web/cobrands/zurich/layout.scss index 07e6c1c85..69864e94b 100644 --- a/web/cobrands/zurich/layout.scss +++ b/web/cobrands/zurich/layout.scss @@ -326,6 +326,11 @@ body.mappage.admin { #zurich-footer { margin: 2em auto 3em auto; } + + .message-updated { + color: #060; + font-weight: bold; + } } .admin-nav-wrapper { |