diff options
-rw-r--r-- | notes/INSTALL | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 2 | ||||
-rw-r--r-- | perllib/Utils.pm | 2 | ||||
-rw-r--r-- | t/app/controller/report_import.t | 2 | ||||
-rw-r--r-- | t/app/controller/report_new.t | 6 | ||||
-rw-r--r-- | t/app/controller/report_updates.t | 4 | ||||
-rwxr-xr-x | templates/web/default/faq/faq-en-gb.html | 12 | ||||
-rw-r--r-- | templates/web/default/footer.html | 27 | ||||
-rw-r--r-- | web/css/_main.scss | 20 | ||||
-rw-r--r-- | web/css/main.css | 19 | ||||
-rw-r--r-- | web/js/map-OpenLayers.js | 119 |
11 files changed, 140 insertions, 81 deletions
diff --git a/notes/INSTALL b/notes/INSTALL index 77e753185..261865700 100644 --- a/notes/INSTALL +++ b/notes/INSTALL @@ -61,10 +61,16 @@ helps maintain the fake cpan subset). If you need to add a module do it using: - module-manage.pl add Module::To::Add + module-manage.pl add Module::To::Add and it will update all the relevant bits. +Currently, you probably need to add EncodedColumn manually: + + module-manage.pl add DBIx::Class::EncodedColumn + +...because it's explicitly overridden in the code, which is fooling the installer. + If a module won't build (Test::WWW::Mechanize and HTTP::Server::Simple fail tests for me but the failures are not pertinent) then the module-manage script will bail out. Look in ~/.cpanm/build_log to see what went wrong. You can force diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index b48c76651..aa919d882 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -199,7 +199,7 @@ sub report_import : Path('/import') { # find or create the user my $report_user = $c->model('DB::User')->find_or_create( { - email => $input{email}, + email => lc $input{email}, name => $input{name}, phone => $input{phone} } diff --git a/perllib/Utils.pm b/perllib/Utils.pm index 39c251876..c9afff186 100644 --- a/perllib/Utils.pm +++ b/perllib/Utils.pm @@ -197,7 +197,7 @@ sub cleanup_text { } # Remove unneeded whitespace - my @lines = grep { m/\S/ } split m/\n\n/, $input; + my @lines = grep { m/\S/ } split m/(?:\r?\n){2,}/, $input; for (@lines) { $_ = trim_text($_); $_ = ucfirst $_; # start with capital diff --git a/t/app/controller/report_import.t b/t/app/controller/report_import.t index 61ee28b88..385445565 100644 --- a/t/app/controller/report_import.t +++ b/t/app/controller/report_import.t @@ -77,7 +77,7 @@ subtest "Submit a correct entry" => sub { with_fields => { service => 'test-script', name => 'Test User', - email => 'test@example.com', + email => 'Test@example.com', subject => 'Test report', detail => 'This is a test report', photo => $sample_file, diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index f06c23501..fa188210a 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -151,8 +151,8 @@ foreach my $test ( msg => 'title and details tidied up', pc => 'SW1A 1AA', fields => { - title => 'DOG SHIT ON WALLS', - detail => 'on this portakabin - more of a portaloo HEH!!', + title => "DOG SHIT\r\nON WALLS", + detail => "on this portakabin -\r\n\r\nmore of a portaloo HEH!!", photo => '', name => 'Bob Jones', may_show_name => '1', @@ -166,7 +166,7 @@ foreach my $test ( changes => { title => 'Dog poo on walls', detail => - 'On this [portable cabin] - more of a [portable loo] HEH!!', + "On this [portable cabin] -\n\nMore of a [portable loo] HEH!!", }, errors => [ 'Please enter your email', ], }, diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 3076a4564..856e7d763 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -324,13 +324,13 @@ for my $test ( form_values => { submit_update => 1, rznvy => 'unregistered@example.com', - update => 'update from an unregistered user', + update => "update from an\r\n\r\nunregistered user", add_alert => 1, name => 'Unreg User', may_show_name => undef, }, changes => { - update => 'Update from an unregistered user', + update => "Update from an\n\nUnregistered user", }, } ) { diff --git a/templates/web/default/faq/faq-en-gb.html b/templates/web/default/faq/faq-en-gb.html index 355369009..bd9ee889f 100755 --- a/templates/web/default/faq/faq-en-gb.html +++ b/templates/web/default/faq/faq-en-gb.html @@ -114,12 +114,12 @@ submit buttons, which the map uses when reporting a problem. It’s fixed in latest nightly build of Safari, so will presumably be fixed in the next release. Until then, I’ve sadly had to disable dragging to avoid people dragging an empty square.</dd> - <dt>Why isn’t there a zoom button on the map?</dt> - <dd>There isn’t a zoom on the map as we want to keep things very local; - this might mean that you’ll need to pan around to figure out where the - problem is if you’re not familiar with the area. If you’re from the - council then the emailed version of the problem report will contain the - closest road to the pin on the map.</dd> + <dt>Why can’t I zoom out more on the reporting map?</dt> + <dd>We want to keep FixMyStreet locally focused, so restrict the ability to + move radically between areas. The map on Your Reports will let you see all + the reports you’ve made, wherever they are. If you’re from the + council then the emailed version of the problem report also contains the + closest road and postcode to the pin on the map.</dd> <dt>This site is great – why aren’t you better publicised?</dt> <dd>As a tiny charity we simply don’t have a publicity budget, and we diff --git a/templates/web/default/footer.html b/templates/web/default/footer.html index 657d9d826..a71909539 100644 --- a/templates/web/default/footer.html +++ b/templates/web/default/footer.html @@ -12,15 +12,28 @@ [% loc('<a href="http://www.mysociety.org/"><img id="logo" width="133" height="26" src="/i/mysociety-dark.png" alt="View mySociety.org"><span id="logoie"></span></a>') %] -<p id="footer"> - [% loc('Built by <a href="http://www.mysociety.org/">mySociety</a>') %] - | <a href="http://github.com/mysociety/fixmystreet">[% loc('Source code') %]</a> - | <a href="/contact">[% loc("Contact FixMyStreet") %]</a> -</p> +<div id="footer"> + <p>[% loc('Built by <a href="http://www.mysociety.org/">mySociety</a>') %] + | <a href="/contact">[% loc("Contact FixMyStreet") %]</a></p> -[% INCLUDE 'tracking_code.html' %] + <p>Mobile apps: + <a href="http://itunes.apple.com/gb/app/fixmystreet/id297456545">iPhone</a>, + <a href="http://itunes.apple.com/gb/app/streetreport/id371891859">StreetReport (iPhone)</a> + | <a href="https://market.android.com/details?id=com.android.fixmystreet">Android</a> + | <a href="http://store.ovi.com/content/107557">Nokia</a> + </p> -[% INCLUDE 'debug_footer.html' %] + <p class="l">[% loc('Are you from a council? Would you like better integration with FixMyStreet?') %] + <a href="http://www.mysociety.org/fixmystreet-for-local-council-websites/">[% loc('Find out about FixMyStreet for councils') %]</a>. + + <p class="r">[% loc('Are you a developer? Would you like to contribute to FixMyStreet?') %] + [% loc('Our code is open source and <a href="http://github.com/mysociety/fixmystreet">available on GitHub</a>.') %] + </p> +</div> + +[%# INCLUDE 'tracking_code.html' %] + +[%# INCLUDE 'debug_footer.html' %] </body> </html> diff --git a/web/css/_main.scss b/web/css/_main.scss index 9063f1484..19d9b5a40 100644 --- a/web/css/_main.scss +++ b/web/css/_main.scss @@ -83,11 +83,12 @@ select, input, textarea { position: relative; margin: 0 auto; max-width: 60em; + overflow: auto; } /* Can't put the margin in #mysociety because of above IE craziness */ #wrapper { - margin: 1em 2em 2em; + margin: 1em 2em; } #meta { @@ -162,7 +163,20 @@ select, input, textarea { text-align: center; border-top: solid 2px $header_back; width: 50%; - margin: 2em auto 0; - padding: 1em; + margin: 1em auto 0; + padding: 0; + color: $header_darker; + + .l, .r { + margin-top: 0; + text-align: left; + width: 45%; + } + .l { + float: left; + } + .r { + float: right; + } } diff --git a/web/css/main.css b/web/css/main.css index 5b4be5ebc..65fd5eae3 100644 --- a/web/css/main.css +++ b/web/css/main.css @@ -80,11 +80,12 @@ select, input, textarea { position: relative; margin: 0 auto; max-width: 60em; + overflow: auto; } /* Can't put the margin in #mysociety because of above IE craziness */ #wrapper { - margin: 1em 2em 2em; + margin: 1em 2em; } #meta { @@ -157,6 +158,18 @@ select, input, textarea { text-align: center; border-top: solid 2px #e3d595; width: 50%; - margin: 2em auto 0; - padding: 1em; + margin: 1em auto 0; + padding: 0; + color: #4e451b; +} +#footer .l, #footer .r { + margin-top: 0; + text-align: left; + width: 45%; +} +#footer .l { + float: left; +} +#footer .r { + float: right; } diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index d00079517..f8bd9c31e 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -98,6 +98,14 @@ function fixmystreet_onload() { var select = new OpenLayers.Control.SelectFeature( fixmystreet.markers ); fixmystreet.map.addControl( select ); select.activate(); + } else if (fixmystreet.page == 'new') { + var drag = new OpenLayers.Control.DragFeature( fixmystreet.markers, { + onComplete: function(feature, e) { + fixmystreet_update_pin( feature.geometry.clone() ); + } + } ); + fixmystreet.map.addControl( drag ); + drag.activate(); } fixmystreet.map.addLayer(fixmystreet.markers); @@ -105,6 +113,53 @@ function fixmystreet_onload() { var bounds = fixmystreet.markers.getDataExtent(); if (bounds) { fixmystreet.map.zoomToExtent( bounds ); } } + + $('#hide_pins_link').click(function(e) { + e.preventDefault(); + var showhide = [ + 'Show pins', 'Hide pins', + 'Dangos pinnau', 'Cuddio pinnau', + "Vis nåler", "Gjem nåler" + ]; + for (var i=0; i<showhide.length; i+=2) { + if (this.innerHTML == showhide[i]) { + fixmystreet.markers.setVisibility(true); + this.innerHTML = showhide[i+1]; + } else if (this.innerHTML == showhide[i+1]) { + fixmystreet.markers.setVisibility(false); + this.innerHTML = showhide[i]; + } + } + }); + + $('#all_pins_link').click(function(e) { + e.preventDefault(); + fixmystreet.markers.setVisibility(true); + var welsh = 0; + var texts = [ + 'en', 'Include stale reports', 'Hide stale reports', + 'cy', 'Cynnwys hen adroddiadau', 'Cuddio hen adroddiadau' + ]; + for (var i=0; i<texts.length; i+=3) { + if (this.innerHTML == texts[i+1]) { + this.innerHTML = texts[i+2]; + fixmystreet.markers.protocol.options.params = { all_pins: 1 }; + fixmystreet.markers.refresh( { force: true } ); + lang = texts[i]; + } else if (this.innerHTML == texts[i+2]) { + this.innerHTML = texts[i+1]; + fixmystreet.markers.protocol.options.params = { }; + fixmystreet.markers.refresh( { force: true } ); + lang = texts[i]; + } + } + if (lang == 'cy') { + document.getElementById('hide_pins_link').innerHTML = 'Cuddio pinnau'; + } else { + document.getElementById('hide_pins_link').innerHTML = 'Hide pins'; + } + }); + } function fms_markers_list(pins, transform) { @@ -130,53 +185,6 @@ function fms_markers_list(pins, transform) { return markers; } -$('#hide_pins_link').click(function(e) { - e.preventDefault(); - var showhide = [ - 'Show pins', 'Hide pins', - 'Dangos pinnau', 'Cuddio pinnau', - "Vis nåler", "Gjem nåler" - ]; - for (var i=0; i<showhide.length; i+=2) { - if (this.innerHTML == showhide[i]) { - fixmystreet.markers.setVisibility(true); - this.innerHTML = showhide[i+1]; - } else if (this.innerHTML == showhide[i+1]) { - fixmystreet.markers.setVisibility(false); - this.innerHTML = showhide[i]; - } - } -}); - -$('#all_pins_link').click(function(e) { - e.preventDefault(); - fixmystreet.markers.setVisibility(true); - var welsh = 0; - var texts = [ - 'en', 'Include stale reports', 'Hide stale reports', - 'cy', 'Cynnwys hen adroddiadau', 'Cuddio hen adroddiadau' - ]; - for (var i=0; i<texts.length; i+=3) { - if (this.innerHTML == texts[i+1]) { - this.innerHTML = texts[i+2]; - fixmystreet.markers.protocol.options.params = { all_pins: 1 }; - fixmystreet.markers.refresh( { force: true } ); - lang = texts[i]; - } else if (this.innerHTML == texts[i+2]) { - this.innerHTML = texts[i+1]; - fixmystreet.markers.protocol.options.params = { }; - fixmystreet.markers.refresh( { force: true } ); - lang = texts[i]; - } - } - if (lang == 'cy') { - document.getElementById('hide_pins_link').innerHTML = 'Cuddio pinnau'; - } else { - document.getElementById('hide_pins_link').innerHTML = 'Hide pins'; - } -}); - - /* Overridding the buttonDown function of PanZoom so that it does zoomTo(0) rather than zoomToMaxExtent() */ @@ -281,12 +289,7 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { if (fixmystreet.page == 'new') { fixmystreet.markers.features[0].move(lonlat); } - lonlat.transform( - fixmystreet.map.getProjectionObject(), - new OpenLayers.Projection("EPSG:4326") - ); - document.getElementById('fixmystreet.latitude').value = lonlat.lat; - document.getElementById('fixmystreet.longitude').value = lonlat.lon; + fixmystreet_update_pin(lonlat); if (fixmystreet.page == 'new') { return; } @@ -294,3 +297,13 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { } }); +// This function might be passed either an OpenLayers.LonLat (so has +// lon and lat) or an OpenLayers.Geometry.Point (so has x and y) +function fixmystreet_update_pin(lonlat) { + lonlat.transform( + fixmystreet.map.getProjectionObject(), + new OpenLayers.Projection("EPSG:4326") + ); + document.getElementById('fixmystreet.latitude').value = lonlat.lat || lonlat.y; + document.getElementById('fixmystreet.longitude').value = lonlat.lon || lonlat.x; +} |