diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-03-05 14:35:06 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-03-06 17:24:13 +0000 |
commit | 94872642d8f5c583b8993a0f8e23f5d3e109c983 (patch) | |
tree | 30924615e4b35aa10cf930290c39fb0390baa76e | |
parent | cbd713f71c44059c1b2a7e8eaedfd5ea37d67dcd (diff) |
[Zurich] Add abbreviation option to contacts.
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 20 | ||||
-rw-r--r-- | templates/web/zurich/admin/body.html | 2 | ||||
-rw-r--r-- | templates/web/zurich/admin/contact-form.html | 5 | ||||
-rw-r--r-- | templates/web/zurich/admin/report_edit.html | 3 | ||||
-rw-r--r-- | templates/web/zurich/admin/stats/index.html | 3 |
5 files changed, 25 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 19118774c..e7127a3a9 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -528,6 +528,15 @@ sub admin { } } +sub category_options { + my ($self, $c) = @_; + my @categories = $c->model('DB::Contact')->not_deleted->all; + $c->stash->{category_options} = [ map { { + name => $_->category, value => $_->category, + abbreviation => $_->get_extra_metadata('abbreviation'), + } } @categories ]; +} + sub admin_report_edit { my $self = shift; my $c = $self->{c}; @@ -549,8 +558,7 @@ sub admin_report_edit { $c->stash->{bodies} = \@bodies; # Can change category to any other - my @categories = $c->model('DB::Contact')->not_deleted->all; - $c->stash->{category_options} = [ map { { name => $_->category, value => $_->category } } @categories ]; + $self->category_options($c); } elsif ($type eq 'dm') { @@ -564,8 +572,7 @@ sub admin_report_edit { $c->stash->{bodies} = \@bodies; # Can change category to any other - my @categories = $c->model('DB::Contact')->not_deleted->all; - $c->stash->{category_options} = [ map { { name => $_->category, value => $_->category } } @categories ]; + $self->category_options($c); } @@ -1139,8 +1146,7 @@ sub admin_stats { } # Can change category to any other - my @categories = $c->model('DB::Contact')->not_deleted->all; - $c->stash->{category_options} = [ map { { name => $_->category, value => $_->category } } @categories ]; + $self->category_options($c); # Total reports (non-hidden) my $total = $c->model('DB::Problem')->search( \%params )->count; @@ -1308,4 +1314,6 @@ sub reports_per_page { return 20; } sub singleton_bodies_str { 1 } +sub contact_extra_fields { [ 'abbreviation' ] }; + 1; diff --git a/templates/web/zurich/admin/body.html b/templates/web/zurich/admin/body.html index a07e0f1c1..561e3d335 100644 --- a/templates/web/zurich/admin/body.html +++ b/templates/web/zurich/admin/body.html @@ -16,6 +16,7 @@ <th>[% loc('Last editor') %]</th> <th>[% loc('Note') %]</th> <th>[% loc('When edited') %]</th> + <th>Kürzel</th> </tr> [% WHILE ( cat = contacts.next ) %] <tr[% IF cat.deleted %] class="is-deleted"[% END %]> @@ -24,6 +25,7 @@ <td>[% cat.editor %]</td> <td>[% cat.note | html %]</td> <td>[% PROCESS format_date this_date=cat.whenedited %]</td> + <td>[% cat.get_extra_metadata('abbreviation') %]</td> </tr> [% END %] </table> diff --git a/templates/web/zurich/admin/contact-form.html b/templates/web/zurich/admin/contact-form.html index 48c4d5288..064eba3f0 100644 --- a/templates/web/zurich/admin/contact-form.html +++ b/templates/web/zurich/admin/contact-form.html @@ -10,6 +10,11 @@ </p> [% END %] + <p> + <strong>Kürzel</strong> + <input type="text" class="form-control" name="extra[abbreviation]" id="abbreviation" size="30" value="[% contact.get_extra_metadata('abbreviation') | html %]"> + </p> + <p><strong>[% loc('Email:') %] </strong> <input type="text" class="form-control" name="email" value="[% contact.email | html %]" size="30"> diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html index fd03fb044..b6b7ee120 100644 --- a/templates/web/zurich/admin/report_edit.html +++ b/templates/web/zurich/admin/report_edit.html @@ -170,7 +170,8 @@ <select class="form-control" name="category" id="category"> <option value="">--</option> [% FOREACH cat IN category_options %] - <option value="[% cat.name %]">[% cat.value %]</option> + <option value="[% cat.name %]">[% cat.value ~%] + [% ' (' _ cat.abbreviation _ ')' IF cat.abbreviation %]</option> [% END %] </select> </div> diff --git a/templates/web/zurich/admin/stats/index.html b/templates/web/zurich/admin/stats/index.html index 9fa145188..9f2906d0a 100644 --- a/templates/web/zurich/admin/stats/index.html +++ b/templates/web/zurich/admin/stats/index.html @@ -27,7 +27,8 @@ <select class="form-control" name="category" id="category"> <option value="">--</option> [% FOREACH cat IN category_options %] - <option value="[% cat.name %]"[% ' selected' IF cat.name == category %]>[% cat.value %]</option> + <option value="[% cat.name %]"[% ' selected' IF cat.name == category %]>[% cat.value ~%] + [% ' (' _ cat.abbreviation _ ')' IF cat.abbreviation %]</option> [% END %] </select> </p> |