diff options
author | Struan Donald <struan@exo.org.uk> | 2011-06-23 11:28:08 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-06-23 11:28:08 +0100 |
commit | 1002c330d3895887cfdb410e9e51dcc0e182473b (patch) | |
tree | 738eefda185f4e6359c6551c6c19856443b0aba7 | |
parent | 4763e1e599e5019c894d9bb08ddd618bce80a03e (diff) |
display state dropdown on updates to authority users
-rw-r--r-- | t/app/controller/report_display.t | 29 | ||||
-rw-r--r-- | templates/web/default/report/display.html | 23 |
2 files changed, 45 insertions, 7 deletions
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t index 5c66200c8..49b524b44 100644 --- a/t/app/controller/report_display.t +++ b/t/app/controller/report_display.t @@ -255,8 +255,8 @@ for my $test ( description => 'closed report', date => DateTime->now, state => 'closed', - banner_id => '', - banner_text => '', + banner_id => 'closed', + banner_text => 'This problem has been closed.', fixed => 0 }, ) { @@ -284,6 +284,31 @@ for my $test ( }; } +for my $test ( + { + desc => 'no state dropdown if user not from authority', + from_authority => 0, + }, + { + desc => 'state dropdown if user from authority', + from_authority => 1, + }, +) { + subtest $test->{desc} => sub { + $mech->log_in_ok( $user->email ); + $user->from_authority( $test->{from_authority} ); + $user->update; + + $mech->get_ok("/report/$report_id"); + my $fields = $mech->visible_form_values( 'updateForm' ); + if ( $test->{from_authority} ) { + ok $fields->{state}; + } else { + ok !$fields->{state}; + } + }; +} + # tidy up $mech->delete_user('test@example.com'); done_testing(); diff --git a/templates/web/default/report/display.html b/templates/web/default/report/display.html index afeddf2c5..99d68e8bc 100644 --- a/templates/web/default/report/display.html +++ b/templates/web/default/report/display.html @@ -104,12 +104,25 @@ <textarea name="update" id="form_update" rows="7" cols="30">[% update_text | html %]</textarea> </div> - - [% IF !problem.is_fixed %] - <div class="checkbox"> - <input type="checkbox" name="fixed" id="form_fixed" value="1"[% fixed %]> - <label for="form_fixed">[% loc('This problem has been fixed') %]</label> + [% IF c.user && c.user.from_authority %] + <div class="form-field"> + <label for="form_state">[% loc( 'State:' ) %]</label> + <select name="state" id="form_state"> + [% FOREACH state IN [ ['confirmed', loc('Open')], ['investigating', + loc('Investigating')], ['planned', loc('Planned')], ['in progress', + loc('In Progress')], ['closed', loc('Closed')], ['fixed', loc('Fixed')], ['fixed - user', + loc('Fixed - User')], ['fixed - council', loc('Fixed - Council')], ['hidden', loc('Hidden')], ['partial', loc('Partial')],['unconfirmed',loc('Unconfirmed')] ] %] + <option [% 'selected ' IF state.0 == problem.state %] value="[% state.0 %]">[% state.1 %]</option> + [% END %] + </select> </div> + [% ELSE %] + [% IF !problem.is_fixed %] + <div class="checkbox"> + <input type="checkbox" name="fixed" id="form_fixed" value="1"[% fixed %]> + <label for="form_fixed">[% loc('This problem has been fixed') %]</label> + </div> + [% END %] [% END %] |