diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 13 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Oxfordshire.pm | 10 | ||||
-rw-r--r-- | templates/web/base/admin/user-form.html | 1 | ||||
-rw-r--r-- | templates/web/oxfordshire/admin/user-form-extra-fields.html | 12 |
4 files changed, 36 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 5d496e7e8..11bdca805 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -1217,6 +1217,8 @@ sub user_add : Path('user_edit') : Args(0) { key => 'users_email_key' } ); $c->stash->{user} = $user; + $c->forward('user_cobrand_extra_fields'); + $user->update; $c->forward( 'log_edit', [ $user->id, 'user', 'edit' ] ); @@ -1281,6 +1283,8 @@ sub user_edit : Path('user_edit') : Args(1) { $user->from_body( undef ); } + $c->forward('user_cobrand_extra_fields'); + # Has the user's from_body changed since we fetched areas (if we ever did)? # If so, we need to re-fetch areas so the UI is up to date. if ( $user->from_body && $user->from_body->id ne $c->stash->{fetched_areas_body_id} ) { @@ -1397,6 +1401,15 @@ sub user_edit : Path('user_edit') : Args(1) { return 1; } +sub user_cobrand_extra_fields : Private { + my ( $self, $c ) = @_; + + my @extra_fields = @{ $c->cobrand->call_hook('user_extra_fields') || [] }; + foreach ( @extra_fields ) { + $c->stash->{user}->set_extra_metadata( $_ => $c->get_param("extra[$_]") ); + } +} + sub flagged : Path('flagged') : Args(0) { my ( $self, $c ) = @_; diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm index e58c7f36b..cf9d6a9a4 100644 --- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm +++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm @@ -130,4 +130,14 @@ sub traffic_management_options { } +sub reputation_increment_states { + return { + 'action scheduled' => 1, + }; +} + +sub user_extra_fields { + return [ 'initials' ]; +} + 1; diff --git a/templates/web/base/admin/user-form.html b/templates/web/base/admin/user-form.html index 0f5452b0a..4dd207bb3 100644 --- a/templates/web/base/admin/user-form.html +++ b/templates/web/base/admin/user-form.html @@ -173,6 +173,7 @@ </ul> [% END %] [% END %] + [% TRY %][% INCLUDE 'admin/user-form-extra-fields.html' %][% CATCH file %][% END %] </ul> <input type="submit" class="btn" name="Submit changes" value="[% loc('Submit changes') %]" > </form> diff --git a/templates/web/oxfordshire/admin/user-form-extra-fields.html b/templates/web/oxfordshire/admin/user-form-extra-fields.html new file mode 100644 index 000000000..c7697fa35 --- /dev/null +++ b/templates/web/oxfordshire/admin/user-form-extra-fields.html @@ -0,0 +1,12 @@ +<li> + <div class="admin-hint"> + <p> + [% loc( + "The user's initials are used when sending inspections to Exor. + Only inspectors need to have this field filled in.") + %] + </p> + </div> + <label for="initials">[% loc('Initials:') %]</label> + <input type='text' class="form-control" name='extra[initials]' id='initials' value='[% user.get_extra_metadata("initials") | html %]'> +</li> |