diff options
-rwxr-xr-x | bin/install-as-user | 10 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/View/Web.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 11 | ||||
-rw-r--r-- | t/cobrand/bromley.t | 45 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 2 | ||||
-rw-r--r-- | templates/web/bromley/report/_item.html | 25 | ||||
-rw-r--r-- | templates/web/default/admin/config_page.html | 144 | ||||
-rw-r--r-- | templates/web/default/report/updates.html | 4 | ||||
-rw-r--r-- | templates/web/zurich/admin/list_updates.html | 27 | ||||
-rw-r--r-- | templates/web/zurich/admin/report_edit-sdm.html | 2 | ||||
-rw-r--r-- | templates/web/zurich/admin/report_edit.html | 4 | ||||
-rw-r--r-- | web/cobrands/bromley/bromley.scss | 3 | ||||
-rw-r--r-- | web/cobrands/fixmindelo/layout.scss | 4 | ||||
-rw-r--r-- | web/cobrands/zurich/layout.scss | 5 |
15 files changed, 282 insertions, 16 deletions
diff --git a/bin/install-as-user b/bin/install-as-user index 0813a6b70..f8f1d1ee5 100755 --- a/bin/install-as-user +++ b/bin/install-as-user @@ -113,6 +113,11 @@ if [ ! -f conf/general.yml ]; then echo $DONE_MSG fi +echo "Installing required Perl modules - this may take some time" +cd "$REPOSITORY" +bin/install_perl_modules +echo $DONE_MSG + # Create the database if it doesn't exist: echo -n "Setting up database... " if ! psql -l | egrep "^ *$DB_NAME *\|" > /dev/null @@ -127,11 +132,6 @@ else fi echo $DONE_MSG -echo "Installing required Perl modules - this may take some time" -cd "$REPOSITORY" -bin/install_perl_modules -echo $DONE_MSG - # Generate po and mo files (these invocations taken from Kagee's script): echo "Creating locale .mo files" bin/cron-wrapper bin/make_po FixMyStreet-EmptyHomes diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 4973b7c4e..424f68ba3 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -135,6 +135,9 @@ sub index : Path : Args(0) { return 1; } +sub config_page : Path( 'config' ) : Args(0) { +} + sub timeline : Path( 'timeline' ) : Args(0) { my ($self, $c) = @_; @@ -1164,6 +1167,7 @@ sub set_allowed_pages : Private { 'users' => [_('Users'), 5], 'flagged' => [_('Flagged'), 6], 'stats' => [_('Stats'), 6], + 'config' => [ undef, undef ], 'user_edit' => [undef, undef], 'body' => [undef, undef], 'body_edit' => [undef, undef], diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm index 8d3775ddc..e4aafe951 100644 --- a/perllib/FixMyStreet/App/View/Web.pm +++ b/perllib/FixMyStreet/App/View/Web.pm @@ -19,7 +19,7 @@ __PACKAGE__->config( render_die => 1, expose_methods => [ 'loc', 'nget', 'tprintf', 'display_crosssell_advert', 'prettify_dt', - 'add_links', 'version', + 'add_links', 'version', 'decode', ], FILTERS => { escape_js => \&escape_js, @@ -181,5 +181,11 @@ sub version { return "$file?$version_hash{$file}"; } +sub decode { + my ( $self, $c, $text ) = @_; + utf8::decode($text) unless utf8::is_utf8($text); + return $text; +} + 1; diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index f14a29f56..4fa442608 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -388,9 +388,14 @@ sub check_for_errors { $self->category(undef); } - if ( $self->bodies_str && $self->detail && - $self->bodies_str eq '2482' && length($self->detail) > 2000 ) { - $errors{detail} = _('Reports are limited to 2000 characters in length. Please shorten your report'); + if ( $self->bodies_str && $self->detail ) { + if ( $self->bodies_str eq '2482' && length($self->detail) > 2000 ) { + $errors{detail} = _('Reports are limited to 2000 characters in length. Please shorten your report'); + } + + if ( $self->bodies_str eq '2237' && length($self->detail) > 1700 ) { + $errors{detail} = _('Reports are limited to 1700 characters in length. Please shorten your report'); + } } return \%errors; diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t new file mode 100644 index 000000000..cb2086a84 --- /dev/null +++ b/t/cobrand/bromley.t @@ -0,0 +1,45 @@ +use strict; +use warnings; +use Test::More; + +plan skip_all => 'Skipping Bromley test without Bromley cobrand' + unless FixMyStreet::Cobrand->exists('bromley'); + +use FixMyStreet::TestMech; +my $mech = FixMyStreet::TestMech->new; + +# Create test data +my $user = $mech->create_user_ok( 'bromley@example.com' ); +my $body = $mech->create_body_ok( 2482, 'Bromley' ); + +my @reports = $mech->create_problems_for_body( 1, 2482, 'Test', { + cobrand => 'bromley', + user => $user, +}); +my $report = $reports[0]; + +for my $update ('in progress', 'unable to fix') { + FixMyStreet::App->model('DB::Comment')->find_or_create( { + problem_state => $update, + problem_id => $report->id, + user_id => $user->id, + name => 'User', + mark_fixed => 'f', + text => "This update marks it as $update", + state => 'confirmed', + confirmed => 'now()', + anonymous => 'f', + } ); +} + +# Test Bromley special casing of 'unable to fix' +$mech->get_ok( '/report/' . $report->id ); +$mech->content_contains( 'marks it as in progress' ); +$mech->content_contains( 'marked as in progress' ); +$mech->content_contains( 'marks it as unable to fix' ); +$mech->content_contains( 'marked as no further action' ); + +# Clean up +$mech->delete_user($user); +$mech->delete_problems_for_body( 2482 ); +done_testing(); diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index 0876be582..88d1f6365 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -162,7 +162,7 @@ $mech->content_contains( 'Edited details text.' ); $mech->content_contains( 'Originaltext: “Test Test 1 for 2 Detail”' ); $mech->get_ok( '/admin/report_edit/' . $report->id ); -$mech->submit_form_ok( { with_fields => { body_subdivision => 3 } } ); +$mech->submit_form_ok( { with_fields => { body_subdivision => 3, send_rejected_email => 1 } } ); $mech->get_ok( '/report/' . $report->id ); $mech->content_contains('In Bearbeitung'); diff --git a/templates/web/bromley/report/_item.html b/templates/web/bromley/report/_item.html new file mode 100644 index 000000000..cd3fbc18c --- /dev/null +++ b/templates/web/bromley/report/_item.html @@ -0,0 +1,25 @@ +<li> +<a class="text" href="[% c.uri_for('/report', problem.id ) %]"> + [% IF problem.photo; + photo = problem.get_photo_params + %] + <img class="img" height="60" width="90" src="[% photo.url_fp %]" alt=""> + [% END %] + <span>[% problem.title | html %]</span><br /> + <small>[% prettify_dt( problem.confirmed, 1 ) %] + [%- IF dist %], [% dist %]km[% END %] + [%- IF include_lastupdate AND problem.confirmed != problem.lastupdate AND problem.whensent != problem.lastupdate %], + [% tprintf(loc('last updated %s'), prettify_dt( problem.lastupdate, 1 ) ) %] + [%- END %] + [% IF include_lastupdate %] + [% IF problem.bodies_str_ids.size > 1 %] [% loc('(sent to both)') %] + [% ELSIF problem.bodies_str_ids.size == 0 %] [% loc('(not sent to council)') %] + [% END %] + [% END %] + [% IF NOT no_fixed AND problem.is_fixed %] + [% loc('(fixed)') %] + [% ELSIF NOT no_fixed AND problem.is_closed %] + [% loc('(closed)') %] + [% END %]</small> +</a> +</li> diff --git a/templates/web/default/admin/config_page.html b/templates/web/default/admin/config_page.html new file mode 100644 index 000000000..a7db39cc8 --- /dev/null +++ b/templates/web/default/admin/config_page.html @@ -0,0 +1,144 @@ +[% INCLUDE 'admin/header.html' title=loc('Configuration') -%] + +[% BLOCK subsection %] +<tr><td colspan=3><strong>[% heading %]</strong></td></tr> +[% END %] + +[% BLOCK just_value %] +[% SET conf = c.config.$value IF NOT conf; + conf = conf.join(', ') IF conf.size %] +<tr> + <td>[% value %]</td> + <td colspan=2>[% conf or conf_default %]</td> +</tr> +[% END %] + +[% BLOCK with_cobrand %] +[% SET conf = c.config.$value IF NOT conf; + conf = conf.join(', ') IF conf.size; + cob = cob.join(', ') IF conf.size %] +<tr> + <td>[% value %]</td> + <td>[% conf %]</td> + <td>[% cob IF cob != conf %]</td> +</tr> +[% END %] + +<p>A summary of this site's configuration.</p> + +<table> +<tr><th>Variable</th> + <th>general.yml value</th> + <th>Cobrand module override</th> +</tr> + +[% INCLUDE subsection heading="URLs" %] +[% INCLUDE with_cobrand value="BASE_URL" cob=c.cobrand.base_url %] +[% INCLUDE with_cobrand value="ADMIN_BASE_URL" cob=c.cobrand.admin_base_url %] + +[% INCLUDE subsection heading="Display" %] +[% allowed_conf = FOR k IN c.config.ALLOWED_COBRANDS %] + [% IF k.keys %][% k.items.join(':') %][% ELSE %][% k %][% END %] + [%- ',' IF NOT loop.last %] +[% END %] +[% INCLUDE just_value value="ALLOWED_COBRANDS" conf = allowed_conf %] +<tr> +<td>Web templates</td> +<td colspan=2>[% c.cobrand.path_to_web_templates.join('<br>') %]</td> +</tr> +[% INCLUDE with_cobrand value="MAP_TYPE" cob=c.cobrand.map_type %] +[% INCLUDE with_cobrand value="EXAMPLE_PLACES" + conf = decode(c.config.EXAMPLE_PLACES.join(', ')) + cob = c.cobrand.example_places %] +[% INCLUDE with_cobrand value="LANGUAGES" + cob = c.cobrand.languages %] +<tr><td>Language override</td> + <td>-</td> + <td> + [% 'domain=' _ c.cobrand.language_domain IF c.cobrand.language_domain %] + [% 'language=' _ c.cobrand.language_override IF c.cobrand.language_override %] + </td> +</tr> +[% INCLUDE with_cobrand value="ALL_REPORTS_PER_PAGE" cob=c.cobrand.reports_per_page %] +[% INCLUDE just_value value="RSS_LIMIT" %] +[% INCLUDE just_value value="AREA_LINKS_FROM_PROBLEMS" %] + +[% INCLUDE subsection heading="Geocoder" %] +[% INCLUDE just_value value="GEOCODER" + conf_default = '<em>(None; default Nominatim OSM)</em>' +%] +[% disconf = FOR k IN c.config.GEOCODING_DISAMBIGUATION %] + [% k.key %]=[% k.value %][% ',' IF NOT loop.last %] +[% END %] +[% discob = FOR k IN c.cobrand.disambiguate_location %] + [% k.key %]=[% k.value %][% ',' IF NOT loop.last %] +[% END %] +[% INCLUDE with_cobrand value="GEOCODING_DISAMBIGUATION" + conf = disconf + cob = discob %] + +[% INCLUDE subsection heading="MapIt" %] +[% INCLUDE just_value value="MAPIT_URL" %] +[% INCLUDE with_cobrand value="MAPIT_TYPES" + cob = c.cobrand.area_types %] +[% INCLUDE just_value value="MAPIT_ID_WHITELIST" %] +[% INCLUDE with_cobrand value="MAPIT_TYPES_CHILDREN" + cob = c.cobrand.area_types_children %] + +[% INCLUDE subsection heading="Database" %] +[% INCLUDE just_value value="FMS_DB_HOST" %] +[% INCLUDE just_value value="FMS_DB_PORT" %] +[% INCLUDE just_value value="FMS_DB_NAME" %] +[% INCLUDE just_value value="FMS_DB_USER" %] + +[% INCLUDE subsection heading="Email" %] +[% INCLUDE just_value value="EMAIL_DOMAIN" %] +[% INCLUDE with_cobrand value="CONTACT_NAME" cob=c.cobrand.contact_name %] +[% INCLUDE with_cobrand value="CONTACT_EMAIL" cob=c.cobrand.contact_email %] +[% INCLUDE just_value value="DO_NOT_REPLY_EMAIL" %] + +[% INCLUDE subsection heading="Development" %] +[% INCLUDE just_value value="STAGING_SITE" %] +[% INCLUDE just_value value="SEND_REPORTS_ON_STAGING" %] +[% INCLUDE just_value value="UPLOAD_DIR" %] +[% INCLUDE just_value value="GEO_CACHE" %] +[% INCLUDE just_value value="TESTING_COUNCILS" %] +[% INCLUDE just_value value="SMTP_SMARTHOST" %] +[% INCLUDE just_value value="TIME_ZONE" %] +[% INCLUDE just_value value="GAZE_URL" %] + +</table> + +<h2>Cobrand module</h2> + +Other things can be changed on a cobrand basis by using functions in an +(optional) Cobrand .pm module, as explained in the +<a href="http://code.fixmystreet.com/customising/">customising section of our +documentation</a>. If you wish to add new functionality just for your cobrand +that can't be done simply by changes to your cobrand's templates, you might +need to add a new Cobrand function. + +<p>Examples of cobrand functions are below; this is not exhaustive. +Many were added for one specific cobrand, so didn't need a general +configuration option. Please feel free to discuss on <a +href="http://code.fixmystreet.com/community/">our mailing list</a> if you think +something should be moved to the general.yml file, done differently, +or have any questions.</p> + +<ul style="font-size: 80%"> +<li>allow_photo_upload: [% c.cobrand.allow_photo_upload %], + allow_photo_display: [% c.cobrand.allow_photo_display %]</li> +<li>send_questionnaires: [% c.cobrand.send_questionnaires %], + ask_ever_reported: [% c.cobrand.ask_ever_reported %]</li> +<li>default_map_zoom: [% c.cobrand.default_map_zoom or '-' %]</li> +<li>default_show_name: [% c.cobrand.default_show_name %]</li> +<li>users_can_hide: [% c.cobrand.users_can_hide %]</li> +<li>report_sent_confirmation_email: [% c.cobrand.report_sent_confirmation_email %]</li> +<li>never_confirm_reports: [% c.cobrand.never_confirm_reports %], + allow_anonymous_reports: [% c.cobrand.allow_anonymous_reports %], + show_unconfirmed_reports: [% c.cobrand.show_unconfirmed_reports %]</li> +<li>email_indent: [% c.cobrand.email_indent %]</li> +</ul> + +[% INCLUDE 'admin/footer.html' %] + diff --git a/templates/web/default/report/updates.html b/templates/web/default/report/updates.html index 9134c34f8..b0a015f03 100644 --- a/templates/web/default/report/updates.html +++ b/templates/web/default/report/updates.html @@ -30,8 +30,8 @@ [%- IF !update_state && update.problem_state %] [%- state = update.meta_problem_state %] [%- IF c.cobrand.moniker == 'bromley' OR problem.bodies_str == '2482' %] - [%- update_state = 'marked as no further action' IF state == 'unable to fix' %] - [%- update_state = 'marked as third party responsibility' IF state == 'not responsible' %] + [%- SET update_state = 'marked as no further action' IF state == 'unable to fix' %] + [%- SET update_state = 'marked as third party responsibility' IF state == 'not responsible' %] [%- END %] [%- END %] [%- IF !update_state && update.problem_state %] diff --git a/templates/web/zurich/admin/list_updates.html b/templates/web/zurich/admin/list_updates.html index 80029462b..2b575f27e 100644 --- a/templates/web/zurich/admin/list_updates.html +++ b/templates/web/zurich/admin/list_updates.html @@ -1,4 +1,26 @@ [% IF updates.size %] + +<h2>[% loc('Internal notes') %]</h3> + +<table cellspacing="0" cellpadding="2" border="1"> + <tr> + <th>[% loc('ID') %]</th> + <th>[% loc('Created') %]</th> + <th>[% loc('User') %]</th> + <th>[% loc('Text') %]</th> + </tr> +[% FOREACH update IN updates -%] + [% IF update.extra.is_internal_note %] + <tr class="[% 'admininternal' IF update.extra.is_internal_note %]"> + <td>[% update.id %]</td> + <td>[% PROCESS format_date this_date=update.created %] [% update.created.hms %]</td> + <td><a href="mailto:[% update.user.email %]">[% update.user.name || update.user.email %]</a></td> + <td>[% update.text | html %]</td> + </tr> + [% END %] +[% END -%] +</table> + <h2>[% loc('Updates') %]</h2> <table cellspacing="0" cellpadding="2" border="1"> @@ -9,12 +31,15 @@ <th>[% loc('Text') %]</th> </tr> [% FOREACH update IN updates -%] - <tr class="[% 'adminhidden' IF update.state == 'hidden' || update.problem.state == 'hidden' %] [% 'admininternal' IF update.extra.is_internal_note %]"> + [% IF ! update.extra.is_internal_note %] + <tr class="[% 'adminhidden' IF update.state == 'hidden' || update.problem.state == 'hidden' %]"> <td>[% update.id %]</td> <td>[% PROCESS format_date this_date=update.created %] [% update.created.hms %]</td> <td><a href="mailto:[% update.user.email %]">[% update.user.name || update.user.email %]</a></td> <td>[% update.text | html %]</td> </tr> + [% END %] [% END -%] </table> + [% END %] diff --git a/templates/web/zurich/admin/report_edit-sdm.html b/templates/web/zurich/admin/report_edit-sdm.html index 599c60b77..5ff031ce2 100644 --- a/templates/web/zurich/admin/report_edit-sdm.html +++ b/templates/web/zurich/admin/report_edit-sdm.html @@ -23,7 +23,7 @@ <ul class="no-bullets"> <li><a href="[% c.uri_for_email( '/report', problem.id ) %]">[% loc('View report on site' )%]</a></li> -<li><a href="http://webgis.intra.stzh.ch/AV_Online/Direct.asp?Map=UP&Search=Koord&West=[% problem.local_coords.1 %]&Nord=[% problem.local_coords.0 %]&B=300" target="_blank">Standort in AV-Online anzeigen</a></li> +<li><a href="http://webgis.intra.stzh.ch/AV_Online/Direct.asp?Map=AV&Search=Koord&West=[% problem.local_coords.0 %]&Nord=[% problem.local_coords.1 %]&B=300" target="_blank">Standort in AV-Online anzeigen</a></li> <li><span class="mock-label">[% loc('Details:') %]</span> [% problem.detail | html %] [% IF problem.extra.original_detail %] diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html index cd399f23b..5958434dd 100644 --- a/templates/web/zurich/admin/report_edit.html +++ b/templates/web/zurich/admin/report_edit.html @@ -22,7 +22,7 @@ <ul class="no-bullets"> <li><a href="[% c.uri_for_email( '/report', problem.id ) %]">[% loc('View report on site' )%]</a></li> -<li><a href="http://webgis.intra.stzh.ch/AV_Online/Direct.asp?Map=UP&Search=Koord&West=[% problem.local_coords.1 %]&Nord=[% problem.local_coords.0 %]&B=300" target="_blank">Standort in AV-Online anzeigen</a></li> +<li><a href="http://webgis.intra.stzh.ch/AV_Online/Direct.asp?Map=AV&Search=Koord&West=[% problem.local_coords.0 %]&Nord=[% problem.local_coords.1 %]&B=300" target="_blank">Standort in AV-Online anzeigen</a></li> [% IF problem.state == 'fixed - council' OR problem.state == 'closed' %] <li><span class="mock-label">[% loc('Details:') %]</span> [% problem.detail | html %] @@ -105,7 +105,7 @@ <p id="automatic-reply"> <span class="mock-label">automatische Antwort</span> - <input type="checkbox" name="send_rejected_email" id="send_rejected_email" value="1" checked="checked" /> + <input type="checkbox" name="send_rejected_email" id="send_rejected_email" value="1" /> </p> <script type="text/javascript"> diff --git a/web/cobrands/bromley/bromley.scss b/web/cobrands/bromley/bromley.scss index 91ec75fea..eee4359de 100644 --- a/web/cobrands/bromley/bromley.scss +++ b/web/cobrands/bromley/bromley.scss @@ -108,3 +108,6 @@ body { color: #333; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; clear: both; } +.issue-list-a li .text small { + display: inline; +} diff --git a/web/cobrands/fixmindelo/layout.scss b/web/cobrands/fixmindelo/layout.scss index 6a52b3b1e..ec8086af3 100644 --- a/web/cobrands/fixmindelo/layout.scss +++ b/web/cobrands/fixmindelo/layout.scss @@ -75,3 +75,7 @@ body.frontpage { } } +body.admin table { + background: white; // force bg colour since it may overhang the colourful background +} + diff --git a/web/cobrands/zurich/layout.scss b/web/cobrands/zurich/layout.scss index 0c42924d4..7984de0b9 100644 --- a/web/cobrands/zurich/layout.scss +++ b/web/cobrands/zurich/layout.scss @@ -37,6 +37,11 @@ body.mappage.admin .nav-wrapper-2 { @include box-shadow(none); } +/* Fix positioning of images in the admin */ +body.admin .admin-nav-wrapper { + z-index: 1; +} + // Different header and logo #site-header .container { height: 99px; |