diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-12-12 13:22:19 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-12-15 00:11:05 +0000 |
commit | 07b07d90cf666a06cb071ceebcecbd21d91e6b60 (patch) | |
tree | 09a71baac637dfe9e87ebc1738b2e2b2f7e9c617 | |
parent | f82abb282f60191ee530c552bf025e509e2a57e8 (diff) |
Rename from_council to from_body, and small related changes.
29 files changed, 73 insertions, 85 deletions
diff --git a/db/schema.sql b/db/schema.sql index 87b5102c7..a829e68db 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -4,8 +4,6 @@ -- Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. -- Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ -- --- $Id: schema.sql,v 1.49 2009-11-10 13:53:33 louise Exp $ --- -- secret -- A random secret. @@ -19,22 +17,6 @@ create table debugdate ( override_today date ); --- Returns the date of "today", which can be overriden for testing. -create function ms_current_date() - returns date as ' - declare - today date; - begin - today = (select override_today from debugdate); - if today is not null then - return today; - else - return current_date; - end if; - - end; -' language 'plpgsql' stable; - -- Returns the timestamp of current time, but with possibly overriden "today". create function ms_current_timestamp() returns timestamp as ' @@ -143,7 +125,7 @@ create table users ( name text, phone text, password text not null default '', - from_council integer, -- id of council user is from or null/0 if not + from_body integer, -- id of body user is from or null/0 if not flagged boolean not null default 'f', title text ); diff --git a/db/schema_0028-rename_from_council.sql b/db/schema_0028-rename_from_council.sql new file mode 100644 index 000000000..027a257a4 --- /dev/null +++ b/db/schema_0028-rename_from_council.sql @@ -0,0 +1,5 @@ +begin; + +ALTER TABLE users RENAME COLUMN from_council TO from_body; + +commit; diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index a96562cd6..fcbde1bd9 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -733,9 +733,9 @@ sub search_users: Path('search_users') : Args(0) { my $users = $c->model('DB::User')->search( { -or => [ - email => { ilike => $isearch }, - name => { ilike => $isearch }, - from_council => $search_n, + email => { ilike => $isearch }, + name => { ilike => $isearch }, + from_body => $search_n, ] } ); @@ -881,13 +881,13 @@ sub user_edit : Path('user_edit') : Args(1) { if ( $user->email ne $c->req->param('email') || $user->name ne $c->req->param('name' ) || - $user->from_council != $c->req->param('council') ) { + $user->from_body != $c->req->param('council') ) { $edited = 1; } $user->name( $c->req->param('name') ); $user->email( $c->req->param('email') ); - $user->from_council( $c->req->param('council') || undef ); + $user->from_body( $c->req->param('council') || undef ); $user->flagged( $c->req->param('flagged') || 0 ); $user->update; diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm index a5ba8ff07..94450f4f3 100644 --- a/perllib/FixMyStreet/App/Controller/Dashboard.pm +++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm @@ -74,9 +74,9 @@ sub check_page_allowed : Private { $c->detach( '/auth/redirect' ) unless $c->user_exists; $c->detach( '/page_error_404_not_found' ) - unless $c->user_exists && $c->user->from_council; + unless $c->user_exists && $c->user->from_body; - return $c->user->from_council; + return $c->user->from_body; } =head2 index diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index a7e1e8a3a..2c56cd182 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -66,7 +66,7 @@ sub support : Path('support') : Args(0) { ? $c->uri_for( '/report', $id ) : $c->uri_for('/'); - if ( $id && $c->cobrand->can_support_problems && $c->user && $c->user->from_council ) { + if ( $id && $c->cobrand->can_support_problems && $c->user && $c->user->from_body ) { $c->forward( 'load_problem_or_display_error', [ $id ] ); $c->stash->{problem}->update( { interest_count => \'interest_count +1' } ); } @@ -187,7 +187,7 @@ sub delete :Local :Args(1) { return $c->res->redirect($uri) unless $c->user_exists; - my $council = $c->user->obj->from_council; + my $council = $c->user->obj->from_body; return $c->res->redirect($uri) unless $council; my %councils = map { $_ => 1 } @{$p->councils}; diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 7759bb938..823b38e02 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1094,7 +1094,7 @@ sub redirect_or_confirm_creation : Private { $c->forward( 'create_reporter_alert' ); my $report_uri; - if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_council && $c->stash->{external_source_id}) { + if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_body && $c->stash->{external_source_id}) { $report_uri = $c->uri_for( '/report', $report->id, undef, { external_source_id => $c->stash->{external_source_id} } ); } else { $report_uri = $c->cobrand->base_url_for_report( $report ) . $report->url; diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index da4cc33ca..c3843c9af 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -76,7 +76,7 @@ sub update_problem : Private { $problem->state('confirmed'); } - if ( $c->cobrand->can_support_problems && $c->user && $c->user->from_council && $c->req->param('external_source_id') ) { + if ( $c->cobrand->can_support_problems && $c->user && $c->user->from_body && $c->req->param('external_source_id') ) { $problem->interest_count( \'interest_count + 1' ); } @@ -201,7 +201,7 @@ sub process_update : Private { if ( $params{state} ) { $params{state} = 'fixed - council' - if $params{state} eq 'fixed' && $c->user && $c->user->belongs_to_council( $update->problem->council ); + if $params{state} eq 'fixed' && $c->user && $c->user->belongs_to_body( $update->problem->council ); $update->problem_state( $params{state} ); } @@ -246,7 +246,7 @@ sub check_for_errors : Private { # they have to be an authority user to update the state if ( $c->req->param('state') ) { my $error = 0; - $error = 1 unless $c->user && $c->user->belongs_to_council( $c->stash->{update}->problem->council ); + $error = 1 unless $c->user && $c->user->belongs_to_body( $c->stash->{update}->problem->council ); my $state = $c->req->param('state'); $error = 1 unless ( grep { $state eq $_ } ( qw/confirmed closed fixed investigating planned/, 'in progress', 'fixed', 'fixed - user', 'fixed - council' ) ); diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 46ec47d9e..808959784 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -684,7 +684,7 @@ sub example_places { =head2 only_authed_can_create -If true, only users with the from_council flag set are able to create reports. +If true, only users with the from_body flag set are able to create reports. =cut diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm index 1baf15ad1..62bea1dd4 100644 --- a/perllib/FixMyStreet/DB/Result/User.pm +++ b/perllib/FixMyStreet/DB/Result/User.pm @@ -26,7 +26,7 @@ __PACKAGE__->add_columns( { data_type => "text", is_nullable => 1 }, "password", { data_type => "text", default_value => "", is_nullable => 0 }, - "from_council", + "from_body", { data_type => "integer", is_nullable => 1 }, "flagged", { data_type => "boolean", default_value => \"false", is_nullable => 0 }, @@ -61,8 +61,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-12-10 15:34:40 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6KOp2hcVLqx28Po7uENTnA +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-12-12 13:06:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:L6gtjOQeVkebGUIHJcHuUA __PACKAGE__->add_columns( "password" => { @@ -144,16 +144,17 @@ sub alert_for_problem { } ); } -sub council { +sub body { my $self = shift; - return '' unless $self->from_council; + return '' unless $self->from_body; - my $key = 'council_name:' . $self->from_council; + my $key = 'body_name:' . $self->from_body; my $result = Memcached::get($key); + ### TODO: Add a 'name' column to body which is used instead of calling mapit unless ($result) { - my $area_info = mySociety::MaPit::call('area', $self->from_council); + my $area_info = mySociety::MaPit::call('area', $self->from_body); $result = $area_info->{name}; Memcached::set($key, $result, 86400); } @@ -161,21 +162,21 @@ sub council { return $result; } -=head2 belongs_to_council +=head2 belongs_to_body - $belongs_to_council = $user->belongs_to_council( $council_list ); + $belongs_to_body = $user->belongs_to_body( $council_list ); Returns true if the user belongs to the comma seperated list of council ids passed in =cut -sub belongs_to_council { +sub belongs_to_body { my $self = shift; my $council = shift; my %councils = map { $_ => 1 } split ',', $council; - return 1 if $self->from_council && $councils{ $self->from_council }; + return 1 if $self->from_body && $councils{ $self->from_body }; return 0; } diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index 43684a206..644e488b2 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -907,7 +907,7 @@ for my $test ( $update->mark_open( $test->{update_reopen} ); $update->update; - $test->{update_user}->from_council( $test->{user_council} ); + $test->{update_user}->from_body( $test->{user_council} ); $test->{update_user}->update; $mech->get_ok('/admin/update_edit/' . $update->id ); @@ -1094,7 +1094,7 @@ subtest 'user search' => sub { $mech->content_like( qr{user_edit/$u_id">Edit</a>} ); - $user->from_council(2509); + $user->from_body(2509); $user->update; $mech->get_ok('/admin/search_users?search=2509' ); $mech->content_contains(2509); diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index 47d10ff5c..945f7a9d7 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -33,7 +33,7 @@ $mech->submit_form( is $mech->status, '404', 'If not council user get 404'; -$user->from_council( $test_council ); +$user->from_body( $test_council ); $user->update; $mech->log_out_ok; diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t index 3bb0913f1..39f1b59a7 100644 --- a/t/app/controller/report_display.t +++ b/t/app/controller/report_display.t @@ -348,32 +348,32 @@ for my $test ( for my $test ( { desc => 'no state dropdown if user not from authority', - from_council => 0, + from_body => 0, no_state => 1, report_council => '2504', }, { desc => 'state dropdown if user from authority', - from_council => 2504, + from_body => 2504, no_state => 0, report_council => '2504', }, { desc => 'no state dropdown if user not from same council as problem', - from_council => 2505, + from_body => 2505, no_state => 1, report_council => '2504', }, { desc => 'state dropdown if user from authority and problem sent to multiple councils', - from_council => 2504, + from_body => 2504, no_state => 0, report_council => '2504,2506', }, ) { subtest $test->{desc} => sub { $mech->log_in_ok( $user->email ); - $user->from_council( $test->{from_council} ); + $user->from_body( $test->{from_body} ); $user->update; $report->discard_changes; diff --git a/t/app/controller/report_interest_count.t b/t/app/controller/report_interest_count.t index dd44a83d4..0a8a5ac0b 100644 --- a/t/app/controller/report_interest_count.t +++ b/t/app/controller/report_interest_count.t @@ -62,18 +62,18 @@ SKIP: { for my $test ( { desc => 'if not from council then no supporter button', - from_council => 0, + from_body => 0, support_string => 'No supporters', }, { desc => 'from council user can increment supported count', - from_council => 2504, + from_body => 2504, support_string => 'No supporters', updated_support => '1 supporter' }, { desc => 'correct grammar for more than one supporter', - from_council => 2504, + from_body => 2504, support_string => '1 supporter', updated_support => '2 supporters' }, @@ -81,7 +81,7 @@ SKIP: { subtest $test->{desc} => sub { ok $mech->host('fixmybarangay.com'), 'changed to fixmybarangay'; $mech->log_in_ok( $user->email ); - $user->from_council( $test->{from_council} ); + $user->from_body( $test->{from_body} ); $user->update; $report->discard_changes; @@ -91,7 +91,7 @@ SKIP: { $mech->get_ok("/report/$report_id"); $mech->content_contains( $test->{support_string} ); - if ( $test->{from_council} ) { + if ( $test->{from_body} ) { $mech->content_contains('Add support'); $mech->submit_form_ok( { form_number => 1 } ); diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 82670d6cc..2c7294222 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -409,7 +409,7 @@ $report->update; subtest 'check non authority user cannot change set state' => sub { $mech->log_in_ok( $user->email ); - $user->from_council( 0 ); + $user->from_body( 0 ); $user->update; $mech->get_ok("/report/$report_id"); @@ -437,7 +437,7 @@ subtest 'check non authority user cannot change set state' => sub { for my $state ( qw/unconfirmed hidden partial/ ) { subtest "check that update cannot set state to $state" => sub { $mech->log_in_ok( $user->email ); - $user->from_council( 2504 ); + $user->from_body( 2504 ); $user->update; $mech->get_ok("/report/$report_id"); @@ -558,7 +558,7 @@ for my $test ( } $mech->log_in_ok( $user->email ); - $user->from_council( 2504 ); + $user->from_body( 2504 ); $user->update; $mech->get_ok("/report/$report_id"); @@ -629,7 +629,7 @@ subtest 'check meta correct for comments marked confirmed but not marked open' = unlike $update_meta->[0], qr/reopened$/, 'update meta does not say reopened'; }; -$user->from_council(0); +$user->from_body(0); $user->update; $report->state('confirmed'); diff --git a/templates/web/bromley/report/display.html b/templates/web/bromley/report/display.html index 13bc5f960..986871a08 100644 --- a/templates/web/bromley/report/display.html +++ b/templates/web/bromley/report/display.html @@ -20,7 +20,7 @@ <div class="shadow-wrap"> <ul id="key-tools"> - [% IF c.user_exists AND c.user.council == 'Bromley Council' %] + [% IF c.user_exists AND c.user.body == 'Bromley Council' %] <li><form method="post" action="/report/delete/[% problem.id %]"> <input type="submit" class="abuse" value="Remove from site"> </form></li> @@ -74,7 +74,7 @@ <br><a href="http://www.bromley.gov.uk/report">Report a different issue</a> </div> - [% IF c.user && c.user.belongs_to_council( problem.council ) %] + [% IF c.user && c.user.belongs_to_body( problem.council ) %] <label for="form_state">[% loc( 'State' ) %]</label> <select name="state" id="form_state"> [% FOREACH state IN [ ['confirmed', loc('Open')], ['investigating', diff --git a/templates/web/default/admin/list_updates.html b/templates/web/default/admin/list_updates.html index 0a05ba4ac..33b53770f 100644 --- a/templates/web/default/admin/list_updates.html +++ b/templates/web/default/admin/list_updates.html @@ -29,7 +29,7 @@ <td>[% PROCESS format_time time=update.created %]</td> <td>[% IF update.anonymous %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> <td>[% IF update.user.id == update.problem.user_id %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> - <td>[% IF update.user.belongs_to_council( update.problem.council ) %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> + <td>[% IF update.user.belongs_to_body( update.problem.council ) %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> <td>[% update.cobrand %]<br>[% update.cobrand_data | html %]</td> <td>[% update.text | html %]</td> <td><a href="[% c.uri_for( 'update_edit', update.id ) %]">[% loc('Edit') %]</a></td> diff --git a/templates/web/default/admin/search_users.html b/templates/web/default/admin/search_users.html index 0b4ba88e7..258fd9adf 100644 --- a/templates/web/default/admin/search_users.html +++ b/templates/web/default/admin/search_users.html @@ -19,7 +19,7 @@ <tr> <td>[% PROCESS value_or_nbsp value=user.name %]</td> <td><a href="[% c.uri_for( 'search_reports', search => user.email ) %]">[% PROCESS value_or_nbsp value=user.email %]</a></td> - <td>[% PROCESS value_or_nbsp value=user.from_council %]</td> + <td>[% PROCESS value_or_nbsp value=user.from_body %]</td> <td>[% user.flagged == 2 ? loc('(Email in abuse table)') : user.flagged ? loc('Yes') : ' ' %]</td> <td>[% IF user.id %]<a href="[% c.uri_for( 'user_edit', user.id ) %]">[% loc('Edit') %]</a>[% END %]</td> </tr> diff --git a/templates/web/default/admin/update_edit.html b/templates/web/default/admin/update_edit.html index 1d5ee80b4..b56ceeae3 100644 --- a/templates/web/default/admin/update_edit.html +++ b/templates/web/default/admin/update_edit.html @@ -22,8 +22,8 @@ </select></li> <li>[% loc('Name:') %] <input type='text' name='name' id='name' value='[% update.name | html %]'></li> <li>[% loc('Email:') %] <input type='text' id='email' name='email' value='[% update.user.email | html %]'> -[%- IF update.user.from_council && update.user.from_council == update.problem.council %] -[% ' (' _ tprintf(loc('user is from same council as problem - %d'), update.user.from_council ) _')' %] +[%- IF update.user.from_body && update.user.from_body == update.problem.council %] +[% ' (' _ tprintf(loc('user is from same council as problem - %d'), update.user.from_body ) _')' %] [% END -%] [%- IF update.user.id == update.problem.user.id %] [% ' (' _ loc('user is problem owner') _')' %] diff --git a/templates/web/default/admin/user_edit.html b/templates/web/default/admin/user_edit.html index a03a4b734..f6d3be3e3 100644 --- a/templates/web/default/admin/user_edit.html +++ b/templates/web/default/admin/user_edit.html @@ -12,7 +12,7 @@ <li>[% loc('Council:') %] <select id='council' name='council'> <option value=''>[% loc('No council') %]</option> [% FOR council IN council_ids %] - <option value="[% council %]"[% ' selected' IF council == user.from_council %]>[% council_details.$council.name %]</option> + <option value="[% council %]"[% ' selected' IF council == user.from_body %]>[% council_details.$council.name %]</option> [% END %] </select> <li>[% loc('Flagged:') %] <input type="checkbox" id="flagged" name="flagged"[% user.flagged ? ' checked' : '' %]></li> diff --git a/templates/web/default/around/display_location.html b/templates/web/default/around/display_location.html index d50009299..85f89e130 100755 --- a/templates/web/default/around/display_location.html +++ b/templates/web/default/around/display_location.html @@ -35,7 +35,7 @@ bodyclass => 'mappage', robots => 'noindex,nofollow'; - allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); + allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_body); %] [% IF allow_creation %] diff --git a/templates/web/default/report/_support.html b/templates/web/default/report/_support.html index e8b958940..f4bdb8c20 100644 --- a/templates/web/default/report/_support.html +++ b/templates/web/default/report/_support.html @@ -1,7 +1,7 @@ [% IF c.cobrand.can_support_problems %] <p id="supporter"><small> [% IF !problem.interest_count %][% text=loc('No supporters') %][% ELSIF problem.interest_count == 1 %][% text = loc('1 supporter') %][% ELSE %][% text = tprintf( loc('%d supporters' ), problem.interest_count ) %][% END %] - [% IF c.user && c.user.from_council %]<form action="[% c.uri_for( '/report/support' ) %]"> + [% IF c.user && c.user.from_body %]<form action="[% c.uri_for( '/report/support' ) %]"> [% text %] <input type="hidden" name="id" value="[% problem.id %]"><input type="submit" class="green-btn" value="Add support"> </form> [% ELSE %] diff --git a/templates/web/default/report/update-form.html b/templates/web/default/report/update-form.html index 721e6d4b5..48eb60fcb 100644 --- a/templates/web/default/report/update-form.html +++ b/templates/web/default/report/update-form.html @@ -23,7 +23,7 @@ <textarea name="update" id="form_update" rows="7" cols="30" required>[% update.text | html %]</textarea> </div> - [% IF c.user && c.user.belongs_to_council( problem.council ) %] + [% IF c.user && c.user.belongs_to_body( problem.council ) %] <div class="form-field"> <label for="form_state">[% loc( 'State:' ) %]</label> <select name="state" id="form_state"> diff --git a/templates/web/default/report/updates.html b/templates/web/default/report/updates.html index eaf5209ff..cfe2b3ab8 100644 --- a/templates/web/default/report/updates.html +++ b/templates/web/default/report/updates.html @@ -12,13 +12,13 @@ [% IF update.anonymous || update.name == '' %] [% tprintf( loc( 'Posted anonymously at %s' ), prettify_epoch( update.confirmed_local.epoch ) ) -%] - [%- ELSIF update.user.from_council; + [%- ELSIF update.user.from_body; user_name = update.user.name | html; - council = update.user.council; - IF council == 'Bromley Council'; - council = "$council <img src='/cobrands/bromley/favicon.png' alt=''>"; + body = update.user.body; + IF body == 'Bromley Council'; + body = "$body <img src='/cobrands/bromley/favicon.png' alt=''>"; END %] - [% tprintf( loc( 'Posted by %s (<strong>%s</strong>) at %s' ), user_name, council, prettify_epoch( update.confirmed_local.epoch ) ) -%] + [% tprintf( loc( 'Posted by %s (<strong>%s</strong>) at %s' ), user_name, body, prettify_epoch( update.confirmed_local.epoch ) ) -%] [%- ELSE %] [% tprintf( loc( 'Posted by %s at %s' ), update.name, prettify_epoch( update.confirmed_local.epoch ) ) | html -%] [%- END -%] diff --git a/templates/web/fixmybarangay/around/tabbed_lists.html b/templates/web/fixmybarangay/around/tabbed_lists.html index c9f1c2a38..342b03f0e 100644 --- a/templates/web/fixmybarangay/around/tabbed_lists.html +++ b/templates/web/fixmybarangay/around/tabbed_lists.html @@ -1,4 +1,4 @@ -[% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); +[% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_body); IF allow_creation %] <menu id="problems-nav" class="tab-nav"> diff --git a/templates/web/fixmybarangay/header.html b/templates/web/fixmybarangay/header.html index 911a72022..fcde496ff 100644 --- a/templates/web/fixmybarangay/header.html +++ b/templates/web/fixmybarangay/header.html @@ -23,7 +23,7 @@ [% INCLUDE 'common_header_tags.html', site_title = 'FixMyBarangay', js_override = '/cobrands/fixmystreet/fixmystreet.js' %] [% extra_js %] - [% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); %] + [% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_body); %] [% IF allow_creation %] <link rel="stylesheet" href="[% version('/js/fancybox/jquery.fancybox-1.3.4.css') %]"> <script src="[% version('/js/fancybox/jquery.fancybox-1.3.4.pack.js') %]" charset="utf-8"></script> diff --git a/templates/web/fixmybarangay/report/_message_manager.html b/templates/web/fixmybarangay/report/_message_manager.html index 5f6b515e5..08f333cad 100644 --- a/templates/web/fixmybarangay/report/_message_manager.html +++ b/templates/web/fixmybarangay/report/_message_manager.html @@ -1,4 +1,4 @@ -[% IF c.user && c.user.from_council %] +[% IF c.user && c.user.from_body %] [% IF problem.external_source_id && problem.external_source == c.config.MESSAGE_MANAGER_URL %] <p class="mm-submitted-by-sms"> diff --git a/templates/web/fixmystreet/report/display.html b/templates/web/fixmystreet/report/display.html index 26e6fe992..8ae528876 100644 --- a/templates/web/fixmystreet/report/display.html +++ b/templates/web/fixmystreet/report/display.html @@ -21,7 +21,7 @@ <div class="shadow-wrap"> <ul id="key-tools"> - [% IF c.user_exists AND c.cobrand.users_can_hide AND c.user.belongs_to_council( c.cobrand.council_id ) %] + [% IF c.user_exists AND c.cobrand.users_can_hide AND c.user.belongs_to_body( c.cobrand.council_id ) %] <li><form method="post" action="/report/delete/[% problem.id %]"> <input type="submit" id="key-tool-report-abuse" class="abuse" value="Remove from site"> </form></li> diff --git a/templates/web/fixmystreet/report/new/fill_in_details_form.html b/templates/web/fixmystreet/report/new/fill_in_details_form.html index 82f9b0da5..8f5251f78 100644 --- a/templates/web/fixmystreet/report/new/fill_in_details_form.html +++ b/templates/web/fixmystreet/report/new/fill_in_details_form.html @@ -15,7 +15,7 @@ [% PROCESS 'report/new/councils_text.html' %] [% END %] - [% IF c.cobrand.moniker != 'fixmybarangay' || ( c.user && c.user.from_council ) %] + [% IF c.cobrand.moniker != 'fixmybarangay' || ( c.user && c.user.from_body ) %] <div id="report-a-problem-sidebar"> <!-- The text for this section needs checking, but I can't work out which bit comes from where @@ -126,7 +126,7 @@ [%# if there is nothing in the name field then set check box as default on form %] <div class="checkbox-group"> <input type="checkbox" name="may_show_name" id="form_may_show_name" value="1" - [% IF c.cobrand.moniker == 'fixmybarangay' && c.user.from_council %] + [% IF c.cobrand.moniker == 'fixmybarangay' && c.user.from_body %] [%# FMB staff reports are anonymous by default; so may_show_name is checked only if explicitly set to 0. If the user has not set it (that is, it is null) TemplateToolkit sees an empty string. @@ -139,7 +139,7 @@ <label class="inline" for="form_may_show_name">[% loc('Show my name publicly') %] </label> </div> - [% IF c.cobrand.moniker != 'fixmybarangay' || c.user.from_council %] + [% IF c.cobrand.moniker != 'fixmybarangay' || c.user.from_body %] <div class="general-sidebar-notes"> <p>[% loc('We never show your email address or phone number.') %]</p> </div> diff --git a/templates/web/fixmystreet/report/update-form.html b/templates/web/fixmystreet/report/update-form.html index c08ac4d52..0c076f5c4 100644 --- a/templates/web/fixmystreet/report/update-form.html +++ b/templates/web/fixmystreet/report/update-form.html @@ -1,4 +1,4 @@ -[% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council) %] +[% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_body) %] [% IF allow_creation %] <div id="update_form"> <h2>[% loc( 'Provide an update') %]</h2> @@ -22,7 +22,7 @@ [% END %] <textarea rows="7" cols="30" name="update" id="form_update" placeholder="[% loc('Please write your update here') %]" required>[% update.text | html %]</textarea> - [% IF c.user && c.user.belongs_to_council( problem.council ) %] + [% IF c.user && c.user.belongs_to_body( problem.council ) %] <label for="form_state">[% loc( 'State' ) %]</label> <select name="state" id="form_state"> [% FOREACH state IN [ ['confirmed', loc('Open')], ['investigating', |