diff options
-rw-r--r-- | conf/general-example | 4 | ||||
-rw-r--r-- | notes/INSTALL | 173 | ||||
-rw-r--r-- | notes/INSTALL-catalyst.txt | 108 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 14 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Location.pm | 35 | ||||
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Questionnaire.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 11 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FiksGataMi.pm | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/Geocode.pm | 12 | ||||
-rw-r--r-- | perllib/Utils.pm | 1 | ||||
-rw-r--r-- | t/00-check-config.t | 51 | ||||
-rw-r--r-- | t/app/controller/questionnaire.t | 1 | ||||
-rw-r--r-- | templates/web/default/front/news.html | 11 | ||||
-rw-r--r-- | templates/web/default/front/stats.html (renamed from templates/web/default/front_stats.html) | 0 | ||||
-rw-r--r-- | templates/web/default/index.html | 19 | ||||
-rw-r--r-- | templates/web/default/questionnaire/completed.html | 5 | ||||
-rw-r--r-- | templates/web/fiksgatami/front/news.html | 12 | ||||
-rw-r--r-- | templates/web/fiksgatami/front/tips.html | 1 |
19 files changed, 219 insertions, 250 deletions
diff --git a/conf/general-example b/conf/general-example index d2ac743e0..bc58f56d3 100644 --- a/conf/general-example +++ b/conf/general-example @@ -31,10 +31,6 @@ define('OPTION_EMAIL_DOMAIN', 'example.org'); define('OPTION_CONTACT_EMAIL', 'team@'.OPTION_EMAIL_DOMAIN); define('OPTION_TEST_EMAIL_PREFIX', null); -# this should be the same as the OPTION_BASE_URL for historical reasons -define('OPTION_EMAIL_VHOST', 'www.example.com'); -define('OPTION_EMAIL_VHOST_EMPTYHOMES', 'www.example.com'); - define('OPTION_CONTACT_NAME', 'FixMyStreet'); define('OPTION_STAGING_SITE', 1); diff --git a/notes/INSTALL b/notes/INSTALL index 2a1dba635..77e753185 100644 --- a/notes/INSTALL +++ b/notes/INSTALL @@ -1,110 +1,135 @@ -# INSTALLING FROM SCRATCH +Installing FixMyStreet +====================== -# mySociety applications are intended to be run on a Debian system. Other Linux -# distributions may well work but may also require some tweaking. +mySociety applications have generally been run on Debian systems. Other Linux +distributions (and more) may well work but may also require some tweaking. -# This document assumes that you are starting with a bare Debian Lenny box and -# that you want to install the latest code from GitHub. For some step you will -# need root access (via sudo) +Clone the repository (you've probably already done this): + git clone git://github.com/mysociety/fixmystreet.git +and be sure to run: + git submodule update --init +inside to fetch the shared commonlib submodule. +conf/packages is a list of Debian packages that are needed, so install them if +you're on Debian/Ubuntu. You'll also probably need to install lots of CPAN +modules, see the section on that below. +FixMyStreet expects a PostgreSQL database, so set one of them up - the schema +is available in db/schema.sql. You will also need to load in db/alert_types.sql +to populate the alert types table. -# GETTING THE CODE +Copy conf/general-example to conf/general and set it up appropriately: +* provide the relevant database connection details +* the OPTION_BASE_URL to be where your test site will run - eg 'http://localhost' +* set OPTION_UPLOAD_CACHE and OPTION_GEO_CACHE to your preferred values +* MAP_TYPE - OSM is probably the best one to try to start with, it's being + successfully used. +Environment setup +----------------- -# bring your system up-to-date -# FIXME - ???should we specify any extras apt sources??? -sudo apt-get update -sudo apt-get upgrade +There is a little script that is used to set up the correct environment needed +for FMS to run (perl library paths, cpan install locations, bin paths etc). It +should be eval-ed in a bash shell to set environment variables: + eval `./setenv.pl` -# ensure that you have 'git' installed -sudo apt-get install git-core +Cron scripts can be run through the bin/cron-wrapper script in order to be run +within the right environment. -# fetch the FixMyStreet code from GitHub: -git clone https://github.com/mysociety/fixmystreet.git +CPAN module dependencies +------------------------ -# fetch the submodules too -cd fixmystreet -git submodule update --init +There are many CPAN dependencies that should be dealt with using +module-manage.pl which takes care of fetching specific versions of packages +from CPAN and building them. To install all the CPAN packages needed: + eval `./setenv.pl` + module-manage.pl setup -# SETTING UP SYSTEM +Look in the perl-external directory for details. Notably the following are important: -# change into project directory -cd ~/fixmystreet +urls.txt - url to the specific packages to fetch +modules.txt - list of all modules that need to be built +minicpan/ - local subset of cpan - used as source for all packages +local-lib - where the cpan modules get built to +lib - some initial modules needed for bootstrap +bin - scripts to make it all work -# check that you have all the packages needed. mySociety projects always have a -# file in 'conf/packages' where any debian ones needed are listed -sudo apt-get install `cat conf/packages` +Read the perl-external/bin/module-manage.pl code to see how it all works. It is +basically a wrapper around cpanm (which builds the packages) and dpan (which +helps maintain the fake cpan subset). -# also install these that are available by default on mySoc boxes: -sudo apt-get install \ - libregexp-common-perl php5-cli perl-doc libtest-exception-perl locales-all +If you need to add a module do it using: + module-manage.pl add Module::To::Add + +and it will update all the relevant bits. -# SETTING UP APACHE +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 +an install if the test failures are not important by running cpanm directly: -cd /etc/apache2 + cpanm \ + --mirror /absolute/path/to/perl-external/minicpan \ + --mirror-only \ + --force \ + Test::WWW::Mechanize -# there is an apache config file in 'conf/httpd.conf' - insert it as per sample -# config at top of file into your /etc/apache2/ config setup -sudo nano sites-available/fixmystreet -sudo ln -s ../sites-available/fixmystreet sites-enabled/ +Hopefully once it is all built we can automate the running of module-manage.pl +in order to make sure that the setup is current. -# you may need to enable some modules too -sudo ln -s ../mods-available/rewrite.load mods-enabled/ -sudo ln -s ../mods-available/proxy.load mods-enabled/ -sudo ln -s ../mods-available/proxy_http.load mods-enabled/ +Note: Others are starting to work on this and it might be a good idea to switch +to their output: +http://blogs.perl.org/users/sebastian_willert/2011/03/how-i-distribute-my-projects.html -# check the config and restart apache -sudo apache2ctl configtest -sudo apache2ctl restart +Running the code +================ -cd - +Development +----------- -# You may need to change the permissions on your files so that apache can read them +Start the catalyst dev server using: + CATALYST_DEBUG=1 ./script/fixmystreet_app_server.pl -r -# SETTING UP EMAIL SENDING +CATALYST_DEBUG turns on the very verbose debug output which is helpful to see what the code is actually doing. The '-r' flag watches for files to change and then restarts the dev server. -# FixMyStreet sends lots of email - your dev server should be able to deliver -# them. If you're running a virtual machine consider sending all email via -# Gmail by replacing exim with ssmtp. -apt-get install ssmtp # will probably uninstall existing MTA -apt-get install mailx # for testing email is working +Production +---------- -nano /etc/ssmtp/ssmtp.conf # see http://wiki.debian.org/sSMTP for details -mail youremail@example.com # send a test message +mySociety currently use Apache, our httpd.conf performs a few redirect checks +and then passes everything else to the Catalyst app using FastCGI. Other +options are available with Catalyst, including PSGI, mod_perl, and so on. -# SETTING UP CONFIG FILES +What's where in the code? +========================= -# the setup is configured using the file 'conf/general' - copy the example one and then edit it -cp conf/general-example conf/general -nano conf/general +FixMyStreet::App is a fairly standard Catalyst app; there aren't any really big +surprises. -# You may need to alter: -# * the database connection details -# * the OPTION_BASE_URL to be where your test site will run - eg 'http://localhost' -# * the OPTION_EVEL_URL to '' - this will cause some emails not to be sent but warned to STDERR instead - proper email handling is being worked on -# * the OPTION_SMTP_SMARTHOST to '' if routing mail via ssmtp as described above - otherwise your SMTP server -# * set OPTION_EMAIL_VHOST to the same as OPTION_BASE_URL minus the 'http://' - eg 'localhost' -# * set OPTION_UPLOAD_CACHE and OPTION_GEO_CACHE to your preferred values -# * set OPTION_COUNTRY to your ISO3166 alpha2 code ('GB' for the United Kingdom: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) +Note that the FixMyStreet.pm file is used though to abstract some config +related things. The FixMyStreet->test_mode(1) which will do things like send +all emails to a memory queue for the test scripts. test_mode should only be +used in test scripts, and so is different from setting STAGING to true. -# SETTING UP THE DATABASES +Testing +======= -# create your own db user (as a superuser to make things easier) -sudo su - postgres -createuser -s your_username -exit +There are several tests in the t directory - organized into subdirs. Note that +there is a module FixMyStreet::TestMech that abstracts some things like logging +in as a user and grabbing all the form error messages. This makes testing much +slicker and less fiddly. -# You'll need to create a database, enable plpgsql and load in the schema -createdb -E SQL_ASCII bci -createlang plpgsql bci -psql bci < db/schema.sql -psql bci < db/alert_types.sql +Run all the tests (within the correct environment) using: + prove -lr t -# LOOK AT THE SITE IN YOUR BROWSER +or a specific test in verbose mode using: + + prove -lv t/app/controller/report_new.t + +For all the lovely options do 'prove --help'. Note I've made no attempt to make +the tests be able to run in parallel, the database fiddling would not be worth +it. The tests currently assume MAPIT_URL is set to the UK version. -# everything should now be set up - please try to load the site in your browser diff --git a/notes/INSTALL-catalyst.txt b/notes/INSTALL-catalyst.txt deleted file mode 100644 index 1c44bea80..000000000 --- a/notes/INSTALL-catalyst.txt +++ /dev/null @@ -1,108 +0,0 @@ -These are notes on how to get the Catalyst version of FMS up and running during the change from Apache/CGI based code to pure Catalyst based code. - -########## location ############ - -Pretty much everything that follows assumes that you run the commands from the root of the fixmystreet project. - - -########## setup environment ########### - -There is a little script that is used to setup the correct environment needed for FMS to run (perl library paths, cpan install locations, bin paths etc). It can either be evaled in a bash shell to set environment variables: - - eval `./setenv.pl` - -or used as a runner to start scripts (eg in cron): - - setenv.pl some_script - - -########## build CPAN dependecies ########### - -There are many CPAN dependencies that should be dealt with using module-manage.pl which takes care of fetching specific versions of packages from CPAN and building them. To install all the CPAN packages needed: - - eval `./setenv.pl` - module-manage.pl setup - -Look in the perl-external directory for details. Notably the following are important: - -urls.txt - url to the specific packages to fetch -modules.txt - list of all modules that need to be built -minicpan/ - local subset of cpan - used as source for all packages -local-lib - where the cpan modules get built to -lib - some initial modules needed for bootstrap -bin - scripts to make it all work - -Read the perl-external/bin/module-manage.pl code to see how it all works. It is basically a wrapper around cpanm (which builds the packages) and dpan (which helps maintain the fake cpan subset). - -If you need to add a module do it using: - - module-manage.pl add Module::To::Add - -and it will update all the relevant bits. - -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 an install if the test failures are not important by running cpanm directly: - - cpanm \ - --mirror /absolute/path/to/perl-external/minicpan \ - --mirror-only \ - --force \ - Test::WWW::Mechanize - -Hopefully once it is all built we can put something like this into the exec in vhosts.pl to make sure that the setup is current: - - setenv.pl module-manage.pl setup - - -Note: Others are starting to work on this and it might be a good idea to switch -to their output: -http://blogs.perl.org/users/sebastian_willert/2011/03/how-i-distribute-my-projects.html - - -############ running the code (dev server) ############ - -Start the catalyst dev server using: - - CATALYST_DEBUG=1 ./script/fixmystreet_app_server.pl -r - -CATALYST_DEBUG turns on the very verbose debug output which is helpful to see what the code is actually doing. The '-r' flag watches for files to change and then restarts the dev server. - - -############ running the code (under Apache) ############# - -The Catalyst App (FixMyStreet::App) is the last thing that gets tried by apache if none of the redirects in httpd.conf get triggered. This means that the existing code can run unchanged and the bits we want to have Catalyst process just get removed from the redirects. - -Currently the httpd.conf runs the FixMyStreet::App as a cgi (rather than fastcgi) which means that the startup hit happens everytime. In production this should probably be fastcgi, or we could go all hip and use the psgi interface. Whatevah! - - -################ databases ###################### - -The database modifications needed are in the scripts 'db/schema_00*' which should be applied in order. - -After further changes to the schema the script 'db/rerun_dbic_loader.pl' should be run to inspect the database and update the model files in perllib/FixMyStreet/DB/Result. Also note that several tables are ignored in that script but just deleting them from the ignore list will cause code to be generated for them. - -The DBIx::Class code is pulled into the FixMyStreet::App using FixMyStreet::App::Model::DB which is just a thin wrapper. The separation is there so that the models can be easily used outside of Catalyst (eg in the utility scripts). - -The DBIx::Class code uses a separate DBI connection than the mySociety::DBHandler code. This is due to different assumptions about the transaction commit policy. - - -########## What's where in the code? ############## - -FixMyStreet::App is a fairly standard Catalyst app, there aren't any really big surprises. - -Note that the FixMyStreet.pm file is used though to abstract some config related things. Note the FixMyStreet->test_mode(1) which will do things like send all emails to a memory queue for the test scripts. test_mode should only be used in test scripts, and so is different from setting STAGING to true. - - -############## testing ################## - -There are several tests in the t directory - organized into subdirs. Note that there is a module FixMyStreet::TestMech that abstracts some things like logging in as a user and grabbing all the form error messages. This makes testing much slicker and less fiddly. - -Run all the tests using: - - prove -lr t - -or a specific test in verbose mode using: - - prove -lv t/app/controller/report_new.t - -For all the lovely options do 'prove --help'. Note I've made no attempt to make the tests be able to run in parallel, the database fiddling would not be worth it. -The tests currently assume MAPIT_URL is set to the UK version. diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index b380eedfc..ec1fde4e4 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -217,20 +217,6 @@ and that they are in UK (if we are in UK). sub check_location_is_acceptable : Private { my ( $self, $c ) = @_; - # These should be set now - my $lat = $c->stash->{latitude}; - my $lon = $c->stash->{longitude}; - - # If in UK and we have a lat,lon coocdinate check it is in UK - if ( $lat && $c->cobrand->country eq 'GB' ) { - eval { Utils::convert_latlon_to_en( $lat, $lon ); }; - if ($@) { - $c->stash->{location_error} = - _( "We had a problem with the supplied co-ordinates - outside the UK?" ); - return; - } - } - # check that there are councils that can accept this location $c->stash->{council_check_action} = 'submit_problem'; $c->stash->{remove_redundant_councils} = 1; diff --git a/perllib/FixMyStreet/App/Controller/Location.pm b/perllib/FixMyStreet/App/Controller/Location.pm index c1b119074..9f8260768 100644 --- a/perllib/FixMyStreet/App/Controller/Location.pm +++ b/perllib/FixMyStreet/App/Controller/Location.pm @@ -39,7 +39,7 @@ sub determine_location_from_coords : Private { $c->stash->{pc} = $pc; } - return 1; + return $c->forward( 'check_location' ); } return; @@ -65,19 +65,13 @@ sub determine_location_from_pc : Private { $c->stash->{pc} = $pc; # for template my ( $latitude, $longitude, $error ) = - eval { FixMyStreet::Geocode::lookup( $pc, $c ) }; - - # Check that nothing blew up - if ($@) { - warn "Error: $@"; - return; - } + FixMyStreet::Geocode::lookup( $pc, $c ); # If we got a lat/lng set to stash and return true if ( defined $latitude && defined $longitude ) { $c->stash->{latitude} = $latitude; $c->stash->{longitude} = $longitude; - return 1; + return $c->forward( 'check_location' ); } # $error doubles up to return multiple choices by being an array @@ -97,6 +91,29 @@ sub determine_location_from_pc : Private { return; } +=head2 check_location + +Just make sure that for UK installs, our co-ordinates are indeed in the UK. + +=cut + +sub check_location : Private { + my ( $self, $c ) = @_; + + if ( $c->stash->{latitude} && $c->cobrand->country eq 'GB' ) { + eval { Utils::convert_latlon_to_en( $c->stash->{latitude}, $c->stash->{longitude} ); }; + if (my $error = $@) { + mySociety::Locale::pop(); # We threw exception, so it won't have happened. + $error = _('That location does not appear to be in Britain; please try again.') + if $error =~ /of the area covered/; + $c->stash->{location_error} = $error; + return; + } + } + + return 1; +} + =head1 AUTHOR Struan Donald diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm index 5506e2dbd..19d057958 100755 --- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm +++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm @@ -79,7 +79,7 @@ sub submit : Path('submit') { } elsif ( $c->req->params->{problem} ) { $c->forward('submit_creator_fixed'); } else { - return; + $c->detach( '/page_error_404_not_found' ); } return 1; diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 3f7bd268f..58b689bf9 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -168,6 +168,7 @@ sub council_check : Private { my ( $self, $c, $q_council ) = @_; $q_council =~ s/\+/ /g; + $q_council =~ s/\.html//; # Manual misspelling redirect if ($q_council =~ /^rhondda cynon taff$/i) { @@ -224,6 +225,8 @@ sub ward_check : Private { my ( $self, $c, $ward ) = @_; $ward =~ s/\+/ /g; + $ward =~ s/\.html//; + my $council = $c->stash->{council}; my $qw = mySociety::MaPit::call('areas', $ward, diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index c23d5d1fc..9019568f8 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -615,16 +615,7 @@ Return if we are the virtual host that sends email for this cobrand =cut sub email_host { - my $self = shift; - my $cobrand_moniker_uc = uc( $self->moniker ); - - my $email_vhost = - mySociety::Config::get("EMAIL_VHOST_$cobrand_moniker_uc", '') - || mySociety::Config::get("EMAIL_VHOST") - || ''; - - return $email_vhost - && "http://$email_vhost" eq mySociety::Config::get("BASE_URL"); + return 1; } =item remove_redundant_councils diff --git a/perllib/FixMyStreet/Cobrand/FiksGataMi.pm b/perllib/FixMyStreet/Cobrand/FiksGataMi.pm index 7fe27fd2e..29d2ec867 100644 --- a/perllib/FixMyStreet/Cobrand/FiksGataMi.pm +++ b/perllib/FixMyStreet/Cobrand/FiksGataMi.pm @@ -13,10 +13,12 @@ sub country { sub set_lang_and_domain { my ( $self, $lang, $unicode, $dir ) = @_; - mySociety::Locale::negotiate_language( - 'en-gb,English,en_GB|nb,Norwegian,nb_NO', 'nb' ); + my $set_lang = mySociety::Locale::negotiate_language( + 'en-gb,English,en_GB|nb,Norwegian,nb_NO', 'nb' + ); mySociety::Locale::gettext_domain( 'FixMyStreet', $unicode, $dir ); mySociety::Locale::change(); + return $set_lang; } sub enter_postcode_text { diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm index 423cec9b6..d5cc7f1d3 100644 --- a/perllib/FixMyStreet/Geocode.pm +++ b/perllib/FixMyStreet/Geocode.pm @@ -10,14 +10,12 @@ package FixMyStreet::Geocode; use strict; use Encode; -use Error qw(:try); use File::Slurp; use File::Path (); use LWP::Simple; use Digest::MD5 qw(md5_hex); use URI::Escape; -use Utils; use mySociety::Config; use mySociety::Locale; use mySociety::MaPit; @@ -72,16 +70,6 @@ sub geocoded_string_coordinates { } elsif ( $js =~ /"coordinates" *: *\[ *(.*?), *(.*?),/ ) { $longitude = $1; $latitude = $2; - if ( $c->cobrand->country eq 'GB') { - try { - my ($easting, $northing) = Utils::convert_latlon_to_en( $latitude, $longitude ); - } catch Error::Simple with { - mySociety::Locale::pop(); # We threw exception, so it won't have happened. - $error = shift; - $error = _('That location does not appear to be in Britain; please try again.') - if $error =~ /out of the area covered/; - } - } } return ($latitude, $longitude, $error); } diff --git a/perllib/Utils.pm b/perllib/Utils.pm index bf8ac2805..44234607f 100644 --- a/perllib/Utils.pm +++ b/perllib/Utils.pm @@ -47,6 +47,7 @@ Takes the WGS84 latitude and longitude and returns OSGB36 easting and northing. sub convert_latlon_to_en { my ( $latitude, $longitude ) = @_; + local $SIG{__WARN__} = sub { die $_[0] }; my ( $easting, $northing ) = mySociety::Locale::in_gb_locale { mySociety::GeoUtil::wgs84_to_national_grid( $latitude, $longitude, 'G' ); diff --git a/t/00-check-config.t b/t/00-check-config.t new file mode 100644 index 000000000..7d334152c --- /dev/null +++ b/t/00-check-config.t @@ -0,0 +1,51 @@ +use strict; +use warnings; + +use Test::More; + +use FixMyStreet; + +# check that all the fields listed in general-example are also present in +# general - helps prevent later test failures due to un-noticed additions to the +# config file. + +# This code will bail_out to prevent the test suite proceeding to save time if +# issues are found. + +# load the config file and store the contents in a readonly hash + +mySociety::Config::set_file( FixMyStreet->path_to("conf/general-example") ); +my $example_config = mySociety::Config::get_list(); +mySociety::Config::set_file( FixMyStreet->path_to("conf/general") ); +my $local_config = mySociety::Config::get_list(); + +# find all keys missing from each config +my @missing_from_example = find_missing( $example_config, $local_config ); +my @missing_from_local = find_missing( $local_config, $example_config ); + +if ( @missing_from_example || @missing_from_local ) { + + fail "Missing from 'general': $_" for @missing_from_local; + fail "Missing from 'general-example': $_" for @missing_from_example; + + # bail out to prevent other tests failing due to config issues + BAIL_OUT( "Config has changed" + . " - update your 'general' and add/remove the keys listed above" ); +} +else { + pass "configs contain the same keys"; +} + +done_testing(); + +sub find_missing { + my $reference = shift; + my $config = shift; + my @missing = (); + + foreach my $key ( sort keys %$config ) { + push @missing, $key unless exists $reference->{$key}; + } + + return @missing; +} diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t index a245be343..e56734bfc 100644 --- a/t/app/controller/questionnaire.t +++ b/t/app/controller/questionnaire.t @@ -212,6 +212,7 @@ foreach my $test ( $another = 1 if $test->{fields}{another} && $test->{fields}{another} eq 'Yes'; # Check the right HTML page has been returned + $mech->content_like( qr/<title>[^<]*Questionnaire/m ); $mech->content_contains( 'glad to hear it’s been fixed' ) if $result eq 'fixed'; $mech->content_contains( 'get some more information about the status of your problem' ) diff --git a/templates/web/default/front/news.html b/templates/web/default/front/news.html new file mode 100644 index 000000000..080034a28 --- /dev/null +++ b/templates/web/default/front/news.html @@ -0,0 +1,11 @@ +[%# + news = [ + { date = '2008-12-11', text = '<a href="' _ c.config.IPHONE_URL _ '">' _ loc('Get FixMyStreet on your iPhone') _ '</a>' }, + ] +%] +[% FOREACH item IN news %] + <p align="center" style="margin-bottom:0"> + <img width="23" height="12" alt="[% loc('New!') %]" src="/i/new.png" border="0">[% item.date %] [% item.text %]</p> + </p> +[% END %] + diff --git a/templates/web/default/front_stats.html b/templates/web/default/front/stats.html index 4b98ef31e..4b98ef31e 100644 --- a/templates/web/default/front_stats.html +++ b/templates/web/default/front/stats.html diff --git a/templates/web/default/index.html b/templates/web/default/index.html index ec07e2e91..4443e060f 100644 --- a/templates/web/default/index.html +++ b/templates/web/default/index.html @@ -19,21 +19,7 @@ [% END %] </p> - -[% # --- insert iPhone details, not converted from old cgi script yet - # - # if (my $url = mySociety::Config::get('IPHONE_URL')) { - # my $getiphone = _("Get FixMyStreet on your iPhone"); - # my $new = _("New!"); - # if ($q->{site} eq 'fixmystreet') { - # $out .= <<EOF - # <p align="center" style="margin-bottom:0"> - # <img width="23" height="12" alt="$new" src="/i/new.png" border="0"> - # <a href="$url">$getiphone</a> - # </p> - # EOF - # } -%] +[% TRY %][% INCLUDE 'front/news.html' %][% CATCH file %][% END %] [% question @@ -60,7 +46,8 @@ <li>[% loc('We send it to the council on your behalf') %]</li> </ol> - [% INCLUDE "front_stats.html" %] + [% INCLUDE "front/stats.html" %] + [% TRY %][% INCLUDE "front/tips.html" %][% CATCH file %][% END %] </div> diff --git a/templates/web/default/questionnaire/completed.html b/templates/web/default/questionnaire/completed.html index 4a6419ccb..3762b25d0 100644 --- a/templates/web/default/questionnaire/completed.html +++ b/templates/web/default/questionnaire/completed.html @@ -1,3 +1,7 @@ +[% + INCLUDE 'header.html', title = loc('Questionnaire') +%] + [% advert_outcome = 1 %] [% IF been_fixed == 'Unknown' %] @@ -26,3 +30,4 @@ why not <a href="http://www.pledgebank.com/new">make and publicise a pledge</a>? [% display_crosssell_advert( problem.user.email, problem.name, 'council', problem.council ) %] [% END %] +[% INCLUDE 'footer.html' %] diff --git a/templates/web/fiksgatami/front/news.html b/templates/web/fiksgatami/front/news.html new file mode 100644 index 000000000..8ebee90f8 --- /dev/null +++ b/templates/web/fiksgatami/front/news.html @@ -0,0 +1,12 @@ +[% + news = [ + { date = '2011-04-26', text = '<a href="' _ c.config.ANDROID_URL _ '">Last ned FiksGataMi-app for din Android-telefon.</a>' }, + { date = '2011-04-23', text = 'FiksGataMi sender nå veisaker også til vegvesenet slik at kommuner ikke trenger sende saker videre.' }, + ] +%] +[% FOREACH item IN news %] + <p align="center" style="margin-bottom:0"> + <img width="23" height="12" alt="[% loc('New!') %]" src="/i/new.png" border="0">[% item.date %] [% item.text %]</p> + </p> +[% END %] + diff --git a/templates/web/fiksgatami/front/tips.html b/templates/web/fiksgatami/front/tips.html new file mode 100644 index 000000000..fcf765c4a --- /dev/null +++ b/templates/web/fiksgatami/front/tips.html @@ -0,0 +1 @@ +<p><a href="http://wiki.nuug.no/grupper/fiksgatami/tips">Tips til deg som har mottatt en sak fra FiksGataMi.</a></p> |