diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-09-01 14:03:38 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-09-01 14:03:38 +0100 |
commit | c19ef68c269dd0b99e02c3b892b1eb28d0c3791a (patch) | |
tree | 65b5b85873e5eeeb6c4a31cd0e3c4676ac8b5557 | |
parent | a4b6ed0fd694de47af3d0e57f31a021bae333e22 (diff) | |
parent | 7930ac360ed35dff545aa4a21e0f5b804b7567f7 (diff) |
Merge branch '1179-translate-states-in-admin'
-rw-r--r-- | templates/web/base/admin/index.html | 19 | ||||
-rw-r--r-- | templates/web/base/admin/list_updates.html | 2 | ||||
-rw-r--r-- | templates/web/base/admin/problem_row.html | 2 | ||||
-rw-r--r-- | templates/web/base/admin/report_blocks.html | 30 | ||||
-rw-r--r-- | templates/web/base/admin/report_edit.html | 22 |
5 files changed, 47 insertions, 28 deletions
diff --git a/templates/web/base/admin/index.html b/templates/web/base/admin/index.html index c9d2b8deb..a68df01d9 100644 --- a/templates/web/base/admin/index.html +++ b/templates/web/base/admin/index.html @@ -1,4 +1,5 @@ [% INCLUDE 'admin/header.html' title=loc('Summary') -%] +[% PROCESS 'admin/report_blocks.html' %] <div class="fms-admin-info fms-admin-floated"> This is the administration interface for [% PROCESS 'site-name.html' -%]. If you @@ -20,11 +21,9 @@ and to receive notices of updates. [% END %] [%- BLOCK states -%] -<h2>[% title %]</h2> - -[%- FOREACH state IN object.keys.sort %] +[%- FOREACH state IN list %] [%- '<ul>' IF loop.first %] - <li>[% object.$state %] [% state %]</li> + <li>[% object.$state %] [% state_pretty.$state %]</li> [%- "\n</ul>" IF loop.last %] [%- END %] [% END -%] @@ -44,9 +43,17 @@ and to receive notices of updates. </p> [% END -%] -[% PROCESS states title=loc('Problem breakdown by state') object=problems %] +<h2>[% loc('Problem breakdown by state') %]</h2> +[% FOREACH group IN state_groups %] +[%- '<ul>' IF loop.first %] + <li><strong>[% group.0 %]</strong> + [% PROCESS states object=problems list=group.1 %] + </li> +[%- "\n</ul>" IF loop.last %] +[%- END %] -[% PROCESS states title=loc('Update breakdown by state') object=comments %] +<h2>[% loc('Update breakdown by state') %]</h2> +[% PROCESS states object=comments list=comments.keys.sort %] [% FOREACH category IN categories %] [% IF loop.first %] diff --git a/templates/web/base/admin/list_updates.html b/templates/web/base/admin/list_updates.html index d3701bc1e..35f7adf66 100644 --- a/templates/web/base/admin/list_updates.html +++ b/templates/web/base/admin/list_updates.html @@ -34,7 +34,7 @@ <td>[% IF update.user.id == update.problem.user_id %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> <td>[% IF update.user.belongs_to_body( update.problem.bodies_str ) %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> <td>[% update.cobrand %]<br>[% update.cobrand_data | html %]</td> - <td>[% update.state %]<br><small> + <td>[% state_pretty.${update.state} %]<br><small> [% loc('Created:') %] [% PROCESS format_time time=update.created %] <br>[% loc('Confirmed:') %] [% PROCESS format_time time=update.confirmed %] </small></td> diff --git a/templates/web/base/admin/problem_row.html b/templates/web/base/admin/problem_row.html index 2413a6062..577e36992 100644 --- a/templates/web/base/admin/problem_row.html +++ b/templates/web/base/admin/problem_row.html @@ -30,7 +30,7 @@ [%- END -%] <br>[% problem.cobrand %]<br>[% problem.cobrand_data | html %] </td> - <td>[% problem.state %]<br><small> + <td>[% state_pretty.${problem.state} %]<br><small> [% loc('Created') %]: [% PROCESS format_time time=problem.created %] <br>[% loc('When sent') %]: [% PROCESS format_time time=problem.whensent %] [%- IF problem.is_visible %]<br>[% loc('Confirmed:' ) %] [% PROCESS format_time time=problem.confirmed %][% END -%] diff --git a/templates/web/base/admin/report_blocks.html b/templates/web/base/admin/report_blocks.html index c2cffc352..941bff821 100644 --- a/templates/web/base/admin/report_blocks.html +++ b/templates/web/base/admin/report_blocks.html @@ -1,3 +1,33 @@ +[% + +SET state_pretty = { + 'confirmed' = loc('Open') + 'investigating' = loc('Investigating') + 'planned' = loc('Planned') + 'in progress' = loc('In progress') + 'action scheduled' = loc('Action Scheduled') + 'fixed' = loc('Fixed') + 'fixed - user' = loc('Fixed - User') + 'fixed - council' = loc('Fixed - Council') + 'unable to fix' = loc('Unable to fix') + 'not responsible' = loc('Not Responsible') + 'duplicate' = loc('Duplicate') + 'closed' = loc('Closed') + 'internal referral' = loc('Internal referral') + 'hidden' = loc('Hidden') + 'partial' = loc('Partial') + 'unconfirmed' = loc('Unconfirmed') +}; + +SET state_groups = [ + [ loc('Open'), [ 'confirmed', 'investigating', 'planned', 'in progress', 'action scheduled' ] ], + [ loc('Fixed'), [ 'fixed', 'fixed - user', 'fixed - council' ] ], + [ loc('Closed'), [ 'unable to fix', 'not responsible', 'duplicate', 'closed', 'internal referral' ] ], + [ loc('Hidden'), [ 'hidden', 'partial', 'unconfirmed' ] ] +]; + +%] + [% BLOCK value_or_nbsp -%] [%- IF value %][% value | html %][% ELSE %] [% END %] [%- END %] diff --git a/templates/web/base/admin/report_edit.html b/templates/web/base/admin/report_edit.html index d488dcadc..d04a1a82b 100644 --- a/templates/web/base/admin/report_edit.html +++ b/templates/web/base/admin/report_edit.html @@ -45,28 +45,10 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a> <li>[% loc('Property address:') %] [% problem.extra.address | html %]</li> [% END %] <li><label class="inline" for="state">[% loc('State:') %]</label> <select name="state" id="state"> -[% FOREACH group IN [ - [ loc('Open'), [ - [ 'confirmed', loc('Open') ], [ 'investigating', loc('Investigating') ], - [ 'planned', loc('Planned') ], [ 'in progress', loc('In progress') ], - [ 'action scheduled', loc('Action Scheduled') ], - ] ], - [ loc('Fixed'), [ - [ 'fixed', loc('Fixed') ], [ 'fixed - user', loc('Fixed - User') ], - [ 'fixed - council', loc('Fixed - Council') ] - ] ], - [ loc('Closed'), [ - [ 'unable to fix', loc('Unable to fix') ], [ 'not responsible', loc('Not Responsible') ], - [ 'duplicate', loc('Duplicate') ], [ 'closed', loc('Closed') ], - [ 'internal referral', loc('Internal referral') ], - ] ], - [ loc('Hidden'), [ - [ 'hidden', loc('Hidden') ], [ 'partial', loc('Partial') ], [ 'unconfirmed',loc('Unconfirmed') ] - ] ] -] %] +[% FOREACH group IN state_groups %] <optgroup label="[% group.0 %]"> [% FOREACH state IN group.1 %] - <option [% 'selected ' IF state.0 == problem.state %] value="[% state.0 %]">[% state.1 %]</option> + <option [% 'selected ' IF state == problem.state %] value="[% state %]">[% state_pretty.$state %]</option> [% END %] </optgroup> [% END %] |