diff options
42 files changed, 765 insertions, 82 deletions
diff --git a/.gitignore b/.gitignore index 055e181dd..142cd3927 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ tags /web/css/main.css /web/cobrands/fixmystreet/*.css /web/cobrands/bromley/*.css +/web/cobrands/fixmybarangay/*.css /local /web/cobrands/fixmystreet/compass_app_log.txt diff --git a/bin/make_css b/bin/make_css index 27cbec1b5..c362fda97 100755 --- a/bin/make_css +++ b/bin/make_css @@ -14,11 +14,14 @@ DIRECTORY=$(cd `dirname $0`/../web && pwd) # FixMyStreet uses compass -compass compile --output-style compressed $DIRECTORY/cobrands/fixmystreet -compass compile --output-style compressed $DIRECTORY/cobrands/bromley +NEWSTYLE="fixmystreet bromley fixmybarangay" +NEWSTYLE_REGEX=${NEWSTYLE// /\\|} +for site in $NEWSTYLE; do + compass compile --output-style compressed $DIRECTORY/cobrands/$site +done # The rest are plain sass -for scss in `find $DIRECTORY -name "*.scss" -exec dirname {} \; | uniq | grep -v "cobrands/\(fixmystreet\|bromley\)"` +for scss in `find $DIRECTORY -name "*.scss" -exec dirname {} \; | uniq | grep -v "cobrands/\($NEWSTYLE_REGEX\)"` do sass --scss --update --style compressed $scss done diff --git a/bin/send-reports b/bin/send-reports index eb881d169..17fe225a4 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -38,6 +38,10 @@ use constant SEND_FAIL_RETRIES_CUTOFF => 3; use constant COUNCIL_ID_BARNET => 2489; use constant COUNCIL_ID_EAST_HANTS => 2330; +# FMB aka FixMyBarangay numbers +use constant FMB_ID_LUZ => 1; # barangay Luz +use constant FMB_ID_BSN => 2; # barangay Basak San Nicolas + use constant MAX_LINE_LENGTH => 132; # send_method config values found in by-area config data, for selecting to appropriate method @@ -250,7 +254,7 @@ while (my $row = $unsent->next) { if (mySociety::Config::get('STAGING_SITE')) { # on a staging server send emails to ourselves rather than the councils # ...webservice calls will only go through if explictly allowed here: - my @testing_councils = (COUNCIL_ID_BARNET); + my @testing_councils = (COUNCIL_ID_BARNET, FMB_ID_LUZ, FMB_ID_BSN); unless (grep {$row->council eq $_} @testing_councils) { @recips = ( mySociety::Config::get('CONTACT_EMAIL') ); $send_method = 0; @@ -338,6 +342,11 @@ while (my $row = $unsent->next) { $row->user->name( $row->user->id . ' ' . $row->user->name ); } + if ($cobrand eq 'fixmybarangay') { + # FixMyBarangay endpoints expect external_id as an attribute + $row->extra( [ { 'name' => 'external_id', 'value' => $row->id } ] ); + } + my $resp = $open311->send_service_request( $row, \%h, $contact->email ); # make sure we don't save user changes from above @@ -345,6 +354,10 @@ while (my $row = $unsent->next) { $row->discard_changes(); } + if ($cobrand eq 'fixmybarangay') { + $row->discard_changes(); + } + if ( $resp ) { $row->external_id( $resp ); $result *= 0; diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index e110cf8d7..fc6df20c3 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -45,7 +45,7 @@ sub around_index : Path : Args(0) { || $c->forward('/location/determine_location_from_pc'); # Check to see if the spot is covered by a council - if not show an error. - return unless $c->forward('check_location_is_acceptable'); + return unless $c->cobrand->moniker eq 'fixmybarangay' || $c->forward('check_location_is_acceptable'); # If we have a partial - redirect to /report/new so that it can be # completed. @@ -203,6 +203,7 @@ sub display_location : Private { longitude => $short_longitude, clickable => 1, pins => \@pins, + area => $c->cobrand->areas_on_around, ); return 1; diff --git a/perllib/FixMyStreet/App/Controller/Council.pm b/perllib/FixMyStreet/App/Controller/Council.pm index 48248e4fe..7a0f9b73f 100644 --- a/perllib/FixMyStreet/App/Controller/Council.pm +++ b/perllib/FixMyStreet/App/Controller/Council.pm @@ -37,6 +37,7 @@ there are no councils then return false. sub load_and_check_councils : Private { my ( $self, $c ) = @_; + my $latitude = $c->stash->{latitude}; my $longitude = $c->stash->{longitude}; @@ -82,8 +83,9 @@ sub load_and_check_councils : Private { $c->cobrand->remove_redundant_councils($all_councils) if $c->stash->{remove_redundant_councils}; # If we don't have any councils we can't accept the report - if ( !scalar keys %$all_councils ) { + if ( !scalar keys %$all_councils || $all_councils->{error}) { $c->stash->{location_offshore} = 1; + $c->stash->{location_error} = 'That point is outside the boundaries.'; return; } diff --git a/perllib/FixMyStreet/App/Controller/FakeMapit.pm b/perllib/FixMyStreet/App/Controller/FakeMapit.pm new file mode 100755 index 000000000..bc46df712 --- /dev/null +++ b/perllib/FixMyStreet/App/Controller/FakeMapit.pm @@ -0,0 +1,53 @@ +package FixMyStreet::App::Controller::FakeMapit; +use Moose; +use namespace::autoclean; + +BEGIN { extends 'Catalyst::Controller'; } + +=head1 NAME + +FixMyStreet::App::Controller::FakeMapit - Catalyst Controller + +=head1 DESCRIPTION + +A controller to fake mapit when we don't have it. If you set MAPIT_URL to +.../fakemapit/ it should all just work, with a mapit that assumes the whole +world is one area, with ID 161 and name "Default Area". + +=head1 METHODS + +=cut + +my $area = { "name" => "Default Area", "type" => "ZZZ", "id" => 161 }; + +sub output : Private { + my ( $self, $c, $data ) = @_; + my $body = JSON->new->utf8(1)->encode( $data ); + $c->res->content_type('application/json; charset=utf-8'); + $c->res->body( $body ); +} + +sub point : Local { + my ( $self, $c ) = @_; + $c->detach( 'output', [ { 161 => $area } ] ); +} + +sub area : Local { + my ( $self, $c ) = @_; + $c->detach( 'output', [ $area ] ); +} + +sub areas : Local { + my ( $self, $c ) = @_; + $c->detach( 'output', [ { 161 => $area } ] ); +} + +sub children : Path('area/161/children') : Args(0) { + my ( $self, $c ) = @_; + $c->detach( 'output', [ {} ] ); +} + +__PACKAGE__->meta->make_immutable; + +1; + diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 9fb72121e..c5f709054 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -43,6 +43,7 @@ sub index : Path : Args(0) { $c->stash->{message} = _("Unable to look up areas in MaPit. Please try again later.") . ' ' . sprintf(_('The error was: %s'), $@); $c->stash->{template} = 'errors/generic.html'; + return; } # For each area, add its link and perhaps alter its name if we need to for @@ -70,6 +71,7 @@ sub index : Path : Args(0) { $c->stash->{message} = _("There was a problem showing the All Reports page. Please try again later.") . ' ' . sprintf(_('The error was: %s'), $@); $c->stash->{template} = 'errors/generic.html'; + return; } # Down here so that error pages aren't cached. @@ -126,7 +128,7 @@ sub ward : Path : Args(2) { # List of wards unless ($c->stash->{ward}) { - my $children = mySociety::MaPit::call('area/children', $c->stash->{council}->{id}, + my $children = mySociety::MaPit::call('area/children', [ $c->stash->{council}->{id} ], type => $mySociety::VotingArea::council_child_types, ); foreach (values %$children) { diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index c45c36b0b..e7359d33e 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -134,7 +134,7 @@ Parameter is QUERY =cut -sub enter_postcode_text { '' } +sub enter_postcode_text { _('Enter a nearby street name and area') } =head2 set_lang_and_domain @@ -597,8 +597,8 @@ The MaPit types this site handles =cut -sub area_types { return qw(DIS LBO MTD UTA CTY COI); } -sub area_min_generation { 10 } +sub area_types { qw(ZZZ) } +sub area_min_generation { '' } =head2 contact_name, contact_email @@ -920,5 +920,24 @@ sub example_places { return [ 'B2 4QA', 'Tib St, Manchester' ]; } +=head2 only_authed_can_create + +If true, only users with the from_council flag set are able to create reports. + +=cut + +sub only_authed_can_create { + return 0; +} + +=head2 areas_on_around + +If set to an arrayref, will plot those area ID(s) from mapit on all the /around pages. + +=cut + +sub areas_on_around { +} + 1; diff --git a/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm b/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm new file mode 100644 index 000000000..51d49242d --- /dev/null +++ b/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm @@ -0,0 +1,44 @@ +package FixMyStreet::Cobrand::FixMyBarangay; +use base 'FixMyStreet::Cobrand::Default'; + +use strict; +use warnings; + +sub path_to_web_templates { + my $self = shift; + return [ + FixMyStreet->path_to( 'templates/web', $self->moniker )->stringify, + FixMyStreet->path_to( 'templates/web/fixmystreet' )->stringify + ]; +} + +sub country { + return 'PH'; +} + +sub area_types { + return ( 'BGY' ); +} + +sub disambiguate_location { + return { + country => 'ph', + bing_country => 'Philippines', + }; +} + +sub site_title { + my ($self) = @_; + return 'FixMyBarangay'; +} + +sub only_authed_can_create { + return 1; +} + +sub areas_on_around { + return [ 1, 2 ]; +} + +1; + diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm index 97b4c3c8b..f6571fed5 100644 --- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm +++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm @@ -1,11 +1,19 @@ package FixMyStreet::Cobrand::FixMyStreet; use base 'FixMyStreet::Cobrand::Default'; +sub area_types { return qw(DIS LBO MTD UTA CTY COI); } +sub area_min_generation { 10 } + # FixMyStreet should return all cobrands sub restriction { return {}; } +sub enter_postcode_text { + my ( $self ) = @_; + return _("Enter a nearby GB postcode, or street name and area"); +} + sub generate_problem_banner { my ( $self, $problem ) = @_; diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm index b40f13d9d..69c4b18d4 100644 --- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm +++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm @@ -56,9 +56,16 @@ sub council_check { return 1; } my $url = 'http://www.fixmystreet.com/'; - $url .= 'alert' if $context eq 'alert'; + if ($context eq 'alert') { + $url .= 'alert'; + } else { + $url .= 'around'; + } $url .= '?pc=' . URI::Escape::uri_escape( $self->{c}->req->param('pc') ) if $self->{c}->req->param('pc'); + $url .= '?latitude=' . URI::Escape::uri_escape( $self->{c}->req->param('latitude') ) + . '&longitude=' . URI::Escape::uri_escape( $self->{c}->req->param('longitude') ) + if $self->{c}->req->param('latitude'); my $error_msg = "That location is not covered by " . $self->council_name . ". Please visit <a href=\"$url\">the main FixMyStreet site</a>."; return ( 0, $error_msg ); diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm index cfec9005d..2de0679e4 100644 --- a/perllib/Open311/PopulateServiceList.pm +++ b/perllib/Open311/PopulateServiceList.pm @@ -20,6 +20,7 @@ sub process_councils { while ( my $council = $self->council_list->next ) { next unless $council->endpoint; + next unless $council->send_method eq 'open311'; $self->_current_council( $council ); $self->process_council; } diff --git a/templates/web/default/around/around_index.html b/templates/web/default/around/around_index.html index 012354f4a..55ed38341 100644 --- a/templates/web/default/around/around_index.html +++ b/templates/web/default/around/around_index.html @@ -8,9 +8,7 @@ %] [% - question - = c.cobrand.enter_postcode_text() - || loc("Enter a nearby GB postcode, or street name and area"); + question = c.cobrand.enter_postcode_text(); %] <form action="[% c.uri_for('/around') %]" method="get" name="postcodeForm" id="postcodeForm"> diff --git a/templates/web/default/index.html b/templates/web/default/index.html index e5f98b0c5..ab8796688 100644 --- a/templates/web/default/index.html +++ b/templates/web/default/index.html @@ -22,9 +22,7 @@ [% TRY %][% INCLUDE 'front/news.html' %][% CATCH file %][% END %] [% - question - = c.cobrand.enter_postcode_text() - || loc("Enter a nearby GB postcode, or street name and area"); + question = c.cobrand.enter_postcode_text(); %] <form action="[% c.uri_for('/around') %]" method="get" name="postcodeForm" id="postcodeForm"> diff --git a/templates/web/default/maps/openlayers.html b/templates/web/default/maps/openlayers.html index e815642f1..b75e2bbd8 100644 --- a/templates/web/default/maps/openlayers.html +++ b/templates/web/default/maps/openlayers.html @@ -8,7 +8,7 @@ <script type="text/javascript"> var fixmystreet = { 'page': '[% page %]', - 'area': '[% map.area %]', + 'area': [ [% map.area.join(',') %] ], 'all_pins': '[% all_pins %]', 'latitude': [% map.latitude %], 'longitude': [% map.longitude %], diff --git a/templates/web/emptyhomes/index.html b/templates/web/emptyhomes/index.html index bd7261f49..60bdee70c 100644 --- a/templates/web/emptyhomes/index.html +++ b/templates/web/emptyhomes/index.html @@ -38,9 +38,7 @@ The TV series launched a campaign for action and while this is running, our <a h </p> [% - question - = c.cobrand.enter_postcode_text() - || loc("Enter a nearby GB postcode, or street name and area"); + question = c.cobrand.enter_postcode_text(); %] <form action="[% c.uri_for('/around') %]" method="get" name="postcodeForm" id="postcodeForm"> diff --git a/templates/web/fixmybarangay/around/tabbed_lists.html b/templates/web/fixmybarangay/around/tabbed_lists.html new file mode 100644 index 000000000..3ca4d7b2b --- /dev/null +++ b/templates/web/fixmybarangay/around/tabbed_lists.html @@ -0,0 +1,20 @@ +[% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); + +IF allow_creation %] +<menu id="problems-nav" class="tab-nav"> + <ul> + <li><a href="#current">Problems on the map</a></li> + <li><a href="#message_manager">Problems via text</a></li> + </ul> +</menu> +[% END %] + +<ul id="current" class="issue-list-a tab"> + [% INCLUDE "around/on_map_list_items.html" %] +</ul> + +[% IF allow_creation %] +<ul id="message_manager" class="issue-list-a tab"> + <li><p>Message Manager texts listed here</p></li> +</ul> +[% END %] diff --git a/templates/web/fixmybarangay/auth/general.html b/templates/web/fixmybarangay/auth/general.html new file mode 100644 index 000000000..e51434c17 --- /dev/null +++ b/templates/web/fixmybarangay/auth/general.html @@ -0,0 +1,67 @@ +[% INCLUDE 'header.html', title = loc('Sign in or create an account') %] + +<h1>[% loc('Sign in') %]</h1> + +<form action="[% c.uri_for() %]" method="post" name="general_auth" class="validate"> + <fieldset> + <input type="hidden" name="r" value="[% c.req.params.r | html %]"> + + [% IF email_error; + + # other keys include fqdn, mxcheck if you'd like to write a custom error message + + errors = { + missing => loc('Please enter your email'), + other => loc('Please check your email address is correct') + }; + + loc_email_error = errors.$email_error || errors.other; + END %] + <label class="n" for="email">[% loc('Email') %]</label> + [% IF loc_email_error %] + <div class="form-error">[% loc_email_error %]</div> + [% ELSIF sign_in_error %] + <div class="form-error">[% loc('There was a problem with your email/password combination. If you cannot remember your password, or do not have one, please fill in the ‘sign in by email’ section of the form.') %]</div> + [% END %] + <input type="email" class="required email" id="email" name="email" value="[% email | html %]" placeholder="[% loc('Your email address') %]"> + + <div id="form_sign_in"> + <h3>[% loc("Do you have a FixMyBarangay password?") %]</h3> + + <div id="form_sign_in_yes" class="form-box"> + <h5>[% loc('<strong>Yes</strong> I have a password') %]</h5> + + <label class="hidden-js n" for="password_sign_in">[% loc('<strong>Yes</strong> I have a password') %]</label> + + <div class="form-txt-submit-box"> + <input type="password" name="password_sign_in" id="password_sign_in" value="" placeholder="[% loc('Your password') %]"> + <input class="green-btn" type="submit" name="sign_in" value="[% loc('Sign in') %]"> + </div> + + <input type="checkbox" id="remember_me" name="remember_me" value='1'[% ' checked' IF remember_me %]> + <label class="inline n" for="remember_me">[% loc('Keep me signed in on this computer') %]</label> + + </div> + <div id="form_sign_in_no" class="form-box"> + <h5>[% loc('<strong>No</strong> let me sign in by email') %]</h5> + + <div class="general-sidebar-notes"> + <p>Providing a name and password is optional, but doing so will allow you to more easily report problems, leave updates and manage your reports.</p> + </div> + + <label for="name">[% loc('Name') %]</label> + <input type="text" name="name" value="" placeholder="[% loc('Your name') %]"> + + <label for="password_register">[% loc('Password (optional)') %]</label> + <div class="form-txt-submit-box"> + <input type="password" name="password_register" id="password_register" value="" placeholder="[% loc('Enter a password') %]"> + <input class="green-btn" type="submit" name="email_sign_in" value="[% loc('Sign in') %]"> + </div> + </div> + + </div> + </fieldset> +</form> + + +[% INCLUDE 'footer.html' %] diff --git a/templates/web/fixmybarangay/faq/faq-en-gb.html b/templates/web/fixmybarangay/faq/faq-en-gb.html new file mode 100644 index 000000000..9eba12c40 --- /dev/null +++ b/templates/web/fixmybarangay/faq/faq-en-gb.html @@ -0,0 +1,84 @@ +[% INCLUDE 'header.html', title => loc('Frequently Asked Questions'), bodyclass => 'twothirdswidthpage' %] + +<div class="sticky-sidebar"> + <aside> + <ul class="plain-list"> + <li><a href="#faq">Frequently Asked Questions</a></li> + <li><a href="#practical">Staff Questions</a></li> + <li><a href="#organisation">Organisation Questions</a></li> + </ul> + </aside> +</div> + +<h1><a name="faq"></a>Frequently Asked Questions</h1> + <dl> + <dt>What is FixMyBarangay?</dt> + <dd>FixMyBarangay is a site to help people report, view, +or discuss local problems they’ve found to the city departments. +The pilot project lets you report the problems by SMS (or dropping +into the barangay center). +</dd> + <dt>What areas are covered?</dt> + <dd> + The pilot project is just running in two barangays in Cebu – + Luz and Basak San Nicolas. + </dd> + <dt>What sort of problems should I report with FixMyBarangay?</dt> + <dd>The FixMyBarangay pilot project is just for potholes (and similar + road surface problems) and broken streetlights. + </dd> + + <dt>What isn’t FixMyBarangay for?</dt> + <dd>FixMyStreet is not a way of getting in touch with Cebu City Hall for other problems + – please use FixMyBarangay only for potholes and streetlights while the pilot + project is running.. + </dd> + + <dt>Staff only: How do I use the site?</dt> + <dd>If you have a staff login, you can view problems already reported in that area, +or report ones of your own simply by clicking on the map at the location of +the problem.</dd> + <dt>How are the problems solved?</dt> + <dd>Problems sent by SMS are initially handled by the barangay staff – they'll + confirm the problem and report it to the relevant department automatically. + Once it's in the department's problem-tracking system, they'll get onto it as + soon as they can.</dd> + <dt>Is it free?</dt> + <dd>The site is free to use, yes. The pilot project has been funded by the World Bank.</dd> + + </dl> + + <h2><a name="practical"></a>Staff questions</h2> + <dl> + <dt>Login issues</dt> + <dd>TODO</dd> + <dt>Reporting</dt> + <dd>TODO</dd> + <dt>Message Manager</dt> + <dd>TODO</dd> + + <h2><a name="organisation"></a>Organisation Questions</h2> + <dl> + <dt>Who built FixMyBarangay?</dt> + <dd>This site was built by <a href="http://www.mysociety.org/">mySociety</a>, in conjunction with the <a href="www.worldbank.org/">World Bank</a>. +mySociety is the project of a registered charity which has grown out of the community of +volunteers who built sites like <a href="http://www.theyworkforyou.com/">TheyWorkForYou.com</a> in the UK. +mySociety’s primary mission is to build Internet projects which give people simple, tangible +benefits in the civic and community aspects of their lives. +The charity is called UK Citizens Online Democracy and is charity number 1076346. mySociety +can be contacted by email at <a href="mailto:hello@mysociety.org">hello@mysociety.org</a>, +or by post at:<br> +mySociety<br> +483 Green Lanes<br> +London<br> +N13 4BS<br> +UK</dd> + <dt>I’d like a site like this for my own location/ where’s the "source code" to this site?</dt> + <dd> +The software behind this site is open source, and available +to you mainly under the GNU Affero GPL software license. +See <a href="http://code.fixmystreet.com/">code.fixmystreet.com</a> for more information about setting up +and running sites like these. +</dd> + </dl> +[% INCLUDE 'footer.html' pagefooter = 'yes' %] diff --git a/templates/web/fixmybarangay/footer.html b/templates/web/fixmybarangay/footer.html new file mode 100644 index 000000000..658d654c4 --- /dev/null +++ b/templates/web/fixmybarangay/footer.html @@ -0,0 +1,31 @@ + </div><!-- .content role=main --> + </div><!-- .container --> + </div><!-- .table-cell --> + + <div class="nav-wrapper"> + <div class="nav-wrapper-2"> + <div id="main-nav" role="navigation"> + <ul id="mysoc-menu"> + <li><a id="mysoc-logo" href="http://www.mysociety.org/">mySociety</a></li>[% + %]<!--<li><a href="http://mysociety.org/donate/">Donate</a></li>[% + %]<li><a href="http://www.mysociety.org/projects/">Our Sites</a></li>--> + </ul> + + <ul id="main-menu"> + <li><[% IF c.req.uri.path == '/' %]span[% ELSE %]a href="/"[% END %] class="report-a-problem-btn" + >View problems</[% c.req.uri.path == '/' ? 'span' : 'a' %]></li>[% + %]<li><[% IF c.req.uri.path == '/reports' %]span[% ELSE %]a href="/reports"[% END + %]>[% loc("All reports") %]</[% c.req.uri.path == '/reports' ? 'span' : 'a' %]></li>[% + %]<li><[% IF c.req.uri.path == '/alert' %]span[% ELSE %]a href="/alert[% pc ? '/list?pc=' : '' %][% pc | uri %]"[% END + %]>[% loc("Local alerts") %]</[% c.req.uri.path == '/alert' ? 'span' : 'a' %]></li>[% + %]<li><[% IF c.req.uri.path == '/faq' %]span[% ELSE %]a href="/faq"[% END + %]>[% loc("Help") %]</[% c.req.uri.path == '/faq' ? 'span' : 'a' %]></li> + </ul> + </div> + </div> + </div> + +<!-- [% INCLUDE 'debug_footer.html' %] --> + </div> <!-- .wrapper --> +</body> +</html> diff --git a/templates/web/fixmybarangay/header.html b/templates/web/fixmybarangay/header.html new file mode 100644 index 000000000..9779a4919 --- /dev/null +++ b/templates/web/fixmybarangay/header.html @@ -0,0 +1,52 @@ +<!doctype html> +<!--[if lt IE 7]><html class="no-js ie6 oldie" lang="[% lang_code %]"><![endif]--> +<!--[if IE 7]> <html class="no-js ie7 oldie" lang="[% lang_code %]"><![endif]--> +<!--[if IE 8]> <html class="no-js ie8 oldie" lang="[% lang_code %]"><![endif]--> +<!--[if IE 9]> <html class="no-js ie9 oldie" lang="[% lang_code %]"><![endif]--> +<!--[if gt IE 9]><!--><html class="no-js" lang="[% lang_code %]"><!--<![endif]--> + <head> + <meta name="viewport" content="initial-scale=1.0"> + + <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> + <meta name="HandHeldFriendly" content="true"> + <meta name="mobileoptimized" content="0"> + + <link rel="stylesheet" href="[% version('/cobrands/fixmybarangay/base.css') %]"> + <link rel="stylesheet" href="[% version('/cobrands/fixmybarangay/layout.css') %]" media="(min-width:48em)"> + <link rel="stylesheet" href="[% version('/js/fancybox/jquery.fancybox-1.3.4.css') %]"> + <!--[if (lt IE 9) & (!IEMobile)]> + <link rel="stylesheet" href="[% version('/cobrands/fixmybarangay/layout.css') %]"> + <![endif]--> + + <script src="[% version('/js/modernizr.custom.76759.js') %]" charset="utf-8"></script> + [% INCLUDE 'common_header_tags.html', js_override = '/cobrands/fixmystreet/fixmystreet.js' %] + <script src="[% version('/js/fancybox/jquery.fancybox-1.3.4.pack.js') %]" charset="utf-8"></script> + <script src="[% version('/cobrands/fixmybarangay/messages.js') %]" charset="utf-8"></script> + + </head> + <body class="[% bodyclass | html IF bodyclass %]"> + + <div class="wrapper"> + <div class="table-cell"> + <header id="site-header" role="banner"> + <div class="container"> + <a href="/" id="site-logo">[% c.cobrand.site_title %]</a> + <a href="#main-nav" id="nav-link">Main Navigation</a> + </div> + </header> + + <div id="user-meta"> + [% IF c.user_exists %] + <p> + [% tprintf(loc('Hi %s'), c.user.name || c.user.email) %] + <a href="/auth/sign_out">[% loc('sign out') %]</a> + </p> + [% ELSE %] + <!-- <a href="/auth">[% loc('Sign in') %]</a> --> + [% END %] + </div> + + <div class="container"> + <div class="content[% " $mainclass" | html IF mainclass %]" role="main"> + + <!-- [% INCLUDE 'debug_header.html' %] --> diff --git a/templates/web/fixmybarangay/index.html b/templates/web/fixmybarangay/index.html new file mode 100644 index 000000000..76ce69c28 --- /dev/null +++ b/templates/web/fixmybarangay/index.html @@ -0,0 +1,91 @@ +[%# Assumes fixmystreet cobrand is using FMS map template - for bonus points preload all the right map elements. %] +[% map_js = BLOCK %] +<script> +yepnope.addPrefix( 'preload', function ( resource ) { + resource.noexec = true; + return resource; +}); +Modernizr.load({ + load: [ + "preload![% version('/js/OpenLayers.fixmystreet.js') %]", + "preload![% version('/js/map-OpenLayers.js') %]", + "preload![% version('/js/map-bing-ol.js') %]", + "preload![% version('/js/jquery.ba-hashchange.min.js') %]" + ] +}); +</script> +[% END %] + +[% INCLUDE 'header.html', title => '' , bodyclass => 'frontpage fullwidthpage' %] + +[% IF error %] + <p class="error">[% error %]</p> +[% END %] + + +<div id="front-main"> + <div id="front-main-container"> + <h1>View local problems</h1> + <h2>(potholes or street lighting)</h2> + + <form action="[% c.uri_for('/around') %]" method="get" name="postcodeForm" id="postcodeForm"> + <p> + <a href="/around?latitude=10.322;longitude=123.907" class="yellow-btn">Bgy. Luz</a> + <a href="/around?latitude=10.288;longitude=123.870" class="yellow-btn">Bgy. Basak San Nicolas</a> + </p> + </form> + </div> +</div> + +<div class="tablewrapper"> + <div id="front-howto"> + <h2>[% loc('How to report a problem') %]</h2> + + <ol class="big-numbers"> + <li>Text LUZ or BSN followed by your report to 12345</li> + <li>Visit the Barangay Center in person</li> + <li>Staff? <a href="/auth">Sign in</a> and click on the map! + </ol> + + <section class="full-width"> + [% INCLUDE "front/stats.html" %] + [% TRY %][% INCLUDE "front/tips.html" %][% CATCH file %][% END %] + </section> + </div> + + + [% + recent_photos = c.cobrand.recent_photos(5); + %] + + [% IF recent_photos.size %] + <div id="front-recently"> + <h2>[% loc('Recently reported problems') %]</h2> + + <section class="full-width"> + <ul class="issue-list-a"> + [% FOREACH p IN recent_photos %] + <li> + <a href="/report/[% p.id %]"> + <div class="text"> + <h4>[% p.title | html %]</h4> + <small>[% prettify_epoch( p.confirmed_local.epoch, 1 ) %]</small> + </div> + <div class="img"> + <img alt="[% p.title | html %]" title="[% p.title | html %]" height="60" width="90" src="/photo/[% p.id %].fp.jpeg"> + </div> + </a> + </li> + [% END %] + </ul> + </section> + + </div> + [% END %] +</div> + + +<!-- [% TRY %][% INCLUDE 'front/news.html' %][% CATCH file %][% END %] --> + + +[% INCLUDE 'footer.html' pagefooter = 'yes' %] diff --git a/templates/web/fixmystreet/alert/index.html b/templates/web/fixmystreet/alert/index.html index 8d4459c01..9e082650d 100644 --- a/templates/web/fixmystreet/alert/index.html +++ b/templates/web/fixmystreet/alert/index.html @@ -16,12 +16,12 @@ within a certain distance of a particular location.') %] [% INCLUDE 'errors.html' %] [% END %] -<p>[% loc('To find out what local alerts we have for you, please enter your GB - postcode or street name and area' ) %]</p> +<p>[% loc('To find out what local alerts we have for you, please fill in the form below.') %]</p> <form method="get" action="/alert/list" class="full-width"> <fieldset> <div class="form-txt-submit-box"> - <input type="text" name="pc" value="[% pc | html %]" placeholder="[% tprintf(loc('e.g. ‘%s’ or ‘%s’'), c.cobrand.example_places) %]"> + <label for="pc">[% c.cobrand.enter_postcode_text %]:</label> + <input type="text" id="pc" name="pc" value="[% pc | html %]" placeholder="[% tprintf(loc('e.g. ‘%s’ or ‘%s’'), c.cobrand.example_places) %]"> <input class="green-btn" type="submit" value="[% loc('Go') %]"> </div> </fieldset> diff --git a/templates/web/fixmystreet/around/around_index.html b/templates/web/fixmystreet/around/around_index.html index 331f34325..3b79a6e8a 100644 --- a/templates/web/fixmystreet/around/around_index.html +++ b/templates/web/fixmystreet/around/around_index.html @@ -8,9 +8,7 @@ %] [% - question - = c.cobrand.enter_postcode_text() - || loc("Enter a nearby GB postcode, or street name and area"); + question = c.cobrand.enter_postcode_text(); %] <form action="[% c.uri_for('/around') %]" method="get" name="postcodeForm" id="postcodeForm"> diff --git a/templates/web/fixmystreet/around/display_location.html b/templates/web/fixmystreet/around/display_location.html index c98982a60..6a5b0e2d2 100755 --- a/templates/web/fixmystreet/around/display_location.html +++ b/templates/web/fixmystreet/around/display_location.html @@ -34,8 +34,11 @@ rss => [ loc('Recent local problems, FixMyStreet'), rss_url ], bodyclass => 'mappage', robots => 'noindex,nofollow'; + + allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); %] +[% IF allow_creation %] <form action="[% c.uri_for('/report/new') %]" method="post" name="mapForm" id="mapForm" enctype="multipart/form-data" class="validate"> [% IF c.req.params.map_override %] <input type="hidden" name="map_override" value="[% c.req.params.map_override | html %]"> @@ -44,6 +47,7 @@ <input type="hidden" name="latitude" id="fixmystreet.latitude" value="[% short_latitude | html %]"> <input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% short_longitude | html %]"> +[% END %] [% map_html %] @@ -69,6 +73,7 @@ <div id="side"> + [% IF allow_creation %] <h1 class="big-green-banner">[% loc( 'Click map to report a problem' ) %]</h1> <p id="skip-this-step"> @@ -79,6 +84,7 @@ ) %] </p> + [% END %] <div class="shadow-wrap"> <ul id="key-tools" class="singleton"> @@ -87,23 +93,11 @@ </div> <section class="full-width"> - <menu id="problems-nav" class="tab-nav"> - <ul> - <li><a href="#current">[% loc('Problems on the map') %]</a></li> - <li><a href="#current_near">[% loc( 'Problems nearby' ) %]</a></li> - </ul> - </menu> - - <ul id="current" class="issue-list-a tab"> - [% INCLUDE "around/on_map_list_items.html" %] - </ul> - - <ul id="current_near" class="issue-list-a tab"> - [% INCLUDE "around/around_map_list_items.html" %] - </ul> + [% INCLUDE "around/tabbed_lists.html" %] </section> </div> + [% IF allow_creation %] <div style="display:none" id="side-form"> [% INCLUDE "report/new/fill_in_details_form.html" js = 1, @@ -111,6 +105,10 @@ report.name = c.user.name %] </div> + [% END %] + +[% IF allow_creation %] </form> +[% END %] [% INCLUDE 'footer.html' %] diff --git a/templates/web/fixmystreet/around/tabbed_lists.html b/templates/web/fixmystreet/around/tabbed_lists.html new file mode 100644 index 000000000..77c5a521b --- /dev/null +++ b/templates/web/fixmystreet/around/tabbed_lists.html @@ -0,0 +1,14 @@ +<menu id="problems-nav" class="tab-nav"> + <ul> + <li><a href="#current">[% loc('Problems on the map') %]</a></li> + <li><a href="#current_near">[% loc( 'Problems nearby' ) %]</a></li> + </ul> +</menu> + +<ul id="current" class="issue-list-a tab"> + [% INCLUDE "around/on_map_list_items.html" %] +</ul> + +<ul id="current_near" class="issue-list-a tab"> + [% INCLUDE "around/around_map_list_items.html" %] +</ul> diff --git a/templates/web/fixmystreet/header.html b/templates/web/fixmystreet/header.html index f5d510922..baec00b57 100644 --- a/templates/web/fixmystreet/header.html +++ b/templates/web/fixmystreet/header.html @@ -35,7 +35,7 @@ <div class="table-cell"> <header id="site-header" role="banner"> <div class="container"> - <a href="/" id="site-logo">FixMyStreet</a> + <a href="/" id="site-logo">[% c.cobrand.site_title %]</a> <a href="#main-nav" id="nav-link">Main Navigation</a> </div> </header> diff --git a/templates/web/fixmystreet/index.html b/templates/web/fixmystreet/index.html index 04b23ca7f..5603bdc39 100644 --- a/templates/web/fixmystreet/index.html +++ b/templates/web/fixmystreet/index.html @@ -30,9 +30,7 @@ Modernizr.load({ <h2>[% loc('(like graffiti, fly tipping, broken paving slabs, or street lighting)') %]</h2> [% - question - = c.cobrand.enter_postcode_text() - || loc("Enter a nearby GB postcode, or street name and area"); + question = c.cobrand.enter_postcode_text(); %] <form action="[% c.uri_for('/around') %]" method="get" name="postcodeForm" id="postcodeForm"> diff --git a/templates/web/fixmystreet/report/display.html b/templates/web/fixmystreet/report/display.html index 0bb13fa67..deca99f2c 100644 --- a/templates/web/fixmystreet/report/display.html +++ b/templates/web/fixmystreet/report/display.html @@ -8,6 +8,8 @@ rss = [ loc('Updates to this problem, FixMyStreet'), "/rss/$problem.id" ] robots = 'index, nofollow' bodyclass = 'mappage' + + allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); %] [% map_html %] @@ -52,6 +54,7 @@ [% INCLUDE 'report/updates.html' %] +[% IF allow_creation %] <div id="update_form"> <h2>[% loc( 'Provide an update') %]</h2> @@ -173,7 +176,7 @@ </fieldset> </form> </div> - +[% END %] [% INCLUDE 'footer.html' %] diff --git a/web/cobrands/fixmybarangay/_colours.scss b/web/cobrands/fixmybarangay/_colours.scss new file mode 100644 index 000000000..b8229dc59 --- /dev/null +++ b/web/cobrands/fixmybarangay/_colours.scss @@ -0,0 +1,8 @@ +/* COLOURS */ + +$primary: #ffff99; +$primary_b: #000000; +$primary_text: #222222; + +$contrast1: #00BD08; +$contrast2: #AA8D11; diff --git a/web/cobrands/fixmybarangay/base.scss b/web/cobrands/fixmybarangay/base.scss new file mode 100644 index 000000000..7a33be97e --- /dev/null +++ b/web/cobrands/fixmybarangay/base.scss @@ -0,0 +1,34 @@ +@import "../fixmystreet/_h5bp"; +@import "./_colours"; +@import "../fixmystreet/_mixins"; +@import "compass"; + +@import "../fixmystreet/_base"; + +#site-logo{ + width: 225px !important; + background: url('/cobrands/fixmybarangay/images/sprite.png') -3px -3px no-repeat; +} +.ie6 #site-logo { + background: url('/cobrands/fixmybarangay/images/ie_logo.gif') 0 -5px no-repeat; +} + +body.frontpage { + #site-logo{ + width: 370px !important; + } +} + +.ie6 body.frontpage #site-logo { + background:url(/cobrands/fixmybarangay/images/ie_front_logo.gif) 0 0 no-repeat; +} + +.yellow-btn, +a.yellow-btn, +button.yellow-btn, +input.yellow-btn{ + @include button-reset(#FFD000, #cc9000, #aa7000, #300, #FFD000, #cc9000, #aa7000, #300); + &:visited, &:hover { + color:#300; + } +}
\ No newline at end of file diff --git a/web/cobrands/fixmybarangay/config.rb b/web/cobrands/fixmybarangay/config.rb new file mode 100644 index 000000000..cab97b18f --- /dev/null +++ b/web/cobrands/fixmybarangay/config.rb @@ -0,0 +1,25 @@ +# Require any additional compass plugins here. + +# Set this to the root of your project when deployed: +http_path = "/" +css_dir = "" +sass_dir = "" +images_dir = "" +javascripts_dir = "" + +# You can select your preferred output style here (can be overridden via the command line): +# output_style = :expanded or :nested or :compact or :compressed + +# To enable relative paths to assets via compass helper functions. Uncomment: +# relative_assets = true + +# To disable debugging comments that display the original location of your selectors. Uncomment: +# line_comments = false + +# If you prefer the indented syntax, you might want to regenerate this +# project again passing --syntax sass, or you can uncomment this: +# preferred_syntax = :sass +# and then run: +# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass + +line_comments = false # by Compass.app diff --git a/web/cobrands/fixmybarangay/images/ie_front_logo.gif b/web/cobrands/fixmybarangay/images/ie_front_logo.gif Binary files differnew file mode 100644 index 000000000..2eeda87ef --- /dev/null +++ b/web/cobrands/fixmybarangay/images/ie_front_logo.gif diff --git a/web/cobrands/fixmybarangay/images/ie_logo.png b/web/cobrands/fixmybarangay/images/ie_logo.png Binary files differnew file mode 100644 index 000000000..df73a7785 --- /dev/null +++ b/web/cobrands/fixmybarangay/images/ie_logo.png diff --git a/web/cobrands/fixmybarangay/images/sprite.png b/web/cobrands/fixmybarangay/images/sprite.png Binary files differnew file mode 100644 index 000000000..fad72a23a --- /dev/null +++ b/web/cobrands/fixmybarangay/images/sprite.png diff --git a/web/cobrands/fixmybarangay/layout.scss b/web/cobrands/fixmybarangay/layout.scss new file mode 100644 index 000000000..63b329337 --- /dev/null +++ b/web/cobrands/fixmybarangay/layout.scss @@ -0,0 +1,42 @@ +@import "_colours"; +@import "../fixmystreet/_layout"; + +body { + background: #1A1A1A; +} + +#front-main { + color: $primary_text; + background: $primary; + + #postcodeForm { + margin-left: 0; + margin-right: 0; + } + +} + +.nav-wrapper { + .nav-wrapper-2 { + border-top: solid 4px $primary; + @include border-image(none); + } +} +#main-nav { + ul { + &#mysoc-menu { + background:$primary; + } + } +} + +#front-howto { + #front_stats { + border-top: 0.25em solid #000; + div { + big { + color: #000; + } + } + } +} diff --git a/web/cobrands/fixmybarangay/messages.js b/web/cobrands/fixmybarangay/messages.js new file mode 100644 index 000000000..aebf35156 --- /dev/null +++ b/web/cobrands/fixmybarangay/messages.js @@ -0,0 +1,26 @@ +$(function(){ + + var mm = $('#message_manager'); + + $.getJSON('/cobrands/fixmybarangay/test-texts.json', function(data) { + var items = []; + $.each(data, function(k, v) { + var item = $('<input type="radio"/>').attr({ + 'id': 'mm_text_' + v.id, + 'name': 'mm_text', + 'value': v.text + }).wrap('<p/>').parent().html(); + var label = $('<label/>', { + 'class': 'inline', + 'for': 'mm_text_' + v.id + }).text(v.text).wrap('<p/>').parent().html(); + item = '<li><p>' + item + ' ' + label + '</p></li>'; + items.push(item); + }); + mm.html(items.join('')); + mm.find('input').click(function(){ + $('#form_detail').val( $('input[name=mm_text]:checked').val() ); + }); + }); + +}); diff --git a/web/cobrands/fixmybarangay/test-texts.json b/web/cobrands/fixmybarangay/test-texts.json new file mode 100644 index 000000000..7acde1e32 --- /dev/null +++ b/web/cobrands/fixmybarangay/test-texts.json @@ -0,0 +1,17 @@ +[ + { + "id" : 1, + "number" : "032-9999999", + "text" : "Pothole on corner of G. De Vera and T. Padilla" + }, + { + "id" : 2, + "number" : "032-1234567", + "text" : "Broken street light on Rahmann Street" + }, + { + "id" : 3, + "number" : "+63 917 0000000", + "text" : "F. Manalo giant pothole" + } +] diff --git a/web/cobrands/fixmystreet/_layout.scss b/web/cobrands/fixmystreet/_layout.scss index 2e0ebbca7..b4c108ce9 100644 --- a/web/cobrands/fixmystreet/_layout.scss +++ b/web/cobrands/fixmystreet/_layout.scss @@ -752,7 +752,7 @@ textarea.form-error { .no-js #report-a-problem-sidebar { position: static; width: auto; - @include box-shadow(rgba(0, 0, 0, 0), 0, 0, 0); + @include box-shadow(rgba(0, 0, 0, 0) 0 0 0); .sidebar-tips, .sidebar-notes { font-size:1em; @@ -807,7 +807,7 @@ body.frontpage { p { top:-4em; right:0; - color:#FFD000; + color: $primary; background:none; @include box-shadow(rgba(0, 0, 0, 0) 0 0 0); a { @@ -1033,7 +1033,7 @@ body.frontpage { .general-sidebar-notes { position: static; width: auto; - @include box-shadow(rgba(0, 0, 0, 0), 0, 0, 0); + @include box-shadow(rgba(0, 0, 0, 0) 0 0 0); .sidebar-tips, .sidebar-notes { font-size:1em; diff --git a/web/fixmystreet_app_cgi.cgi b/web/fixmystreet_app_cgi.cgi index 7d60ce673..dd0984e15 100755 --- a/web/fixmystreet_app_cgi.cgi +++ b/web/fixmystreet_app_cgi.cgi @@ -1,8 +1,11 @@ #!/usr/bin/env perl BEGIN { # set all the paths to the perl code - use FindBin; - require "$FindBin::Bin/../setenv.pl"; + use File::Spec; + use File::Basename; + my $root = dirname(File::Spec->rel2abs(__FILE__)); + + require "$root/../setenv.pl"; } use Catalyst::ScriptRunner; diff --git a/web/fixmystreet_app_fastcgi.cgi b/web/fixmystreet_app_fastcgi.cgi index 1059cbd34..08504f8f4 100755 --- a/web/fixmystreet_app_fastcgi.cgi +++ b/web/fixmystreet_app_fastcgi.cgi @@ -1,8 +1,10 @@ #!/usr/bin/env perl BEGIN { # set all the paths to the perl code - use FindBin; - require "$FindBin::Bin/../setenv.pl"; + use File::Spec; + use File::Basename; + my $root = dirname(File::Spec->rel2abs(__FILE__)); + require "$root/../setenv.pl"; } use Catalyst::ScriptRunner; diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index 7ddaae299..eb7ded781 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -7,6 +7,32 @@ function fixmystreet_update_pin(lonlat) { ); document.getElementById('fixmystreet.latitude').value = lonlat.lat || lonlat.y; document.getElementById('fixmystreet.longitude').value = lonlat.lon || lonlat.x; + + $.getJSON('/report/new/ajax', { + latitude: $('#fixmystreet\\.latitude').val(), + longitude: $('#fixmystreet\\.longitude').val() + }, function(data) { + if (data.error) { + if (!$('#side-form-error').length) { + $('<div id="side-form-error"/>').insertAfter($('#side-form')); + } + $('#side-form-error').html('<h1>Reporting a problem</h1><p>' + data.error + '</p>').show(); + $('#side-form').hide(); + return; + } + $('#side-form, #site-logo').show(); + $('#councils_text').html(data.councils_text); + $('#form_category_row').html(data.category); + if ( data.extra_name_info ) { + // there might be a first name field on some cobrands + var lb = $('#form_first_name').prev() || $('#form_name').prev(); + lb.before(data.extra_name_info); + } + }); + + if (!$('#side-form-error').is(':visible')) { + $('#side-form, #site-logo').show(); + } } function fixmystreet_activate_drag() { @@ -43,22 +69,26 @@ function fms_markers_list(pins, transform) { } function fixmystreet_onload() { - if ( fixmystreet.area ) { - var area = new OpenLayers.Layer.Vector("KML", { - strategies: [ new OpenLayers.Strategy.Fixed() ], - protocol: new OpenLayers.Protocol.HTTP({ - url: "/mapit/area/" + fixmystreet.area + ".kml?simplify_tolerance=0.0001", - format: new OpenLayers.Format.KML() - }) - }); - fixmystreet.map.addLayer(area); - area.events.register('loadend', null, function(a,b,c) { - var bounds = area.getDataExtent(); - if (bounds) { - var center = bounds.getCenterLonLat(); - fixmystreet.map.setCenter(center, fixmystreet.map.getZoomForExtent(bounds), false, true); + if ( fixmystreet.area.length ) { + for (var i=0; i<fixmystreet.area.length; i++) { + var area = new OpenLayers.Layer.Vector("KML", { + strategies: [ new OpenLayers.Strategy.Fixed() ], + protocol: new OpenLayers.Protocol.HTTP({ + url: "/mapit/area/" + fixmystreet.area[i] + ".kml?simplify_tolerance=0.0001", + format: new OpenLayers.Format.KML() + }) + }); + fixmystreet.map.addLayer(area); + if ( fixmystreet.area.length == 1 ) { + area.events.register('loadend', null, function(a,b,c) { + var bounds = area.getDataExtent(); + if (bounds) { + var center = bounds.getCenterLonLat(); + fixmystreet.map.setCenter(center, fixmystreet.map.getZoomForExtent(bounds), false, true); + } + }); } - }); + } } var pin_layer_style_map = new OpenLayers.StyleMap({ @@ -421,7 +451,7 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { fixmystreet.markers.addFeatures( markers ); fixmystreet_activate_drag(); } - fixmystreet_update_pin(lonlat); + // check to see if markers are visible. We click the // link so that it updates the text in case they go // back @@ -429,23 +459,15 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { fixmystreet.state_pins_were_hidden = true; $('#hide_pins_link').click(); } + + // Store pin location in form fields, and check coverage of point + fixmystreet_update_pin(lonlat); + + // Already did this first time map was clicked, so no need to do it again. if (fixmystreet.page == 'new') { return; } - $.getJSON('/report/new/ajax', { - latitude: $('#fixmystreet\\.latitude').val(), - longitude: $('#fixmystreet\\.longitude').val() - }, function(data) { - if (data.error) { - // XXX If they then click back and click somewhere in the area, this error will still show. - $('#side-form').html('<h1>Reporting a problem</h1><p>' + data.error + '</p>'); - return; - } - $('#councils_text').html(data.councils_text); - $('#form_category_row').html(data.category); - }); - $('#side-form, #site-logo').show(); fixmystreet.map.updateSize(); // might have done, and otherwise Firefox gets confused. /* For some reason on IOS5 if you use the jQuery show method it * doesn't display the JS validation error messages unless you do this |