diff options
author | Struan Donald <struan@exo.org.uk> | 2012-12-07 11:20:29 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-12-07 11:20:29 +0000 |
commit | a6c47f2a2056ebada0b47ebb600eec13c504f1fa (patch) | |
tree | aa8392c1f360eb5694c63816e07b3807de67863c | |
parent | 32af4e21192ad50eaf6c2e650ce3830235445b5c (diff) |
add cobrand module and templates for see something say something
-rw-r--r-- | perllib/FixMyStreet/Cobrand/SeeSomething.pm | 83 | ||||
-rw-r--r-- | templates/web/seesomething/footer.html | 28 | ||||
-rw-r--r-- | templates/web/seesomething/js/validation_rules.html | 14 | ||||
-rw-r--r-- | templates/web/seesomething/js/validation_strings.html | 15 | ||||
-rw-r--r-- | templates/web/seesomething/report/new/fill_in_details_form.html | 141 |
5 files changed, 281 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/SeeSomething.pm b/perllib/FixMyStreet/Cobrand/SeeSomething.pm new file mode 100644 index 000000000..05be040f8 --- /dev/null +++ b/perllib/FixMyStreet/Cobrand/SeeSomething.pm @@ -0,0 +1,83 @@ +package FixMyStreet::Cobrand::SeeSomething; +use parent 'FixMyStreet::Cobrand::UKCouncils'; + +use strict; +use warnings; + +sub council_id { return [ 2520, 2522, 2514, 2546, 2519, 2538, 2535 ]; } +sub council_area { return 'West Midlands'; } +sub council_name { return 'See Something Say Something'; } +sub council_url { return 'seesomething'; } +sub area_types { [ 'MTD' ] } + + +sub site_restriction { + my $self = shift; + return { council => { IN => $self->council_id } }; +} + +sub problems_clause { + my $self = shift; + return { council => { IN => $self->council_id } }; +} + +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 council_check { + my ( $self, $params, $context ) = @_; + + my $councils = $params->{all_councils}; + my $council_match = grep { $councils->{$_} } @{ $self->council_id }; + + if ($council_match) { + return 1; + } + + return ( 0, "Not in covered area" ); +} + +sub disambiguate_location { + my $self = shift; + my $string = shift; + + my $town = 'West Midlands'; + + return { + %{ $self->SUPER::disambiguate_location() }, + town => $town, + centre => '52.4803101685267,-2.2708272758854', + span => '1.4002794815887,2.06340043925997', + bounds => [ 51.8259444771676, -3.23554082684068, 53.2262239587563, -1.17214038758071 ], + }; +} + +sub example_places { + return ( 'ST5 6PJ', 'Cemetery Rd, Silverdale' ); +} + +sub send_questionnaires { + return 0; +} + +sub ask_ever_reported { + return 0; +} + +sub report_sent_confirmation_email { 1; } + +sub report_check_for_errors { return (); } + +sub never_confirm_reports { 1; } + +sub allow_anonymous_reports { 1; } + +sub anonymous_account { return { name => 'anon user', email => 'anon@example.com' }; } + +1; + diff --git a/templates/web/seesomething/footer.html b/templates/web/seesomething/footer.html new file mode 100644 index 000000000..7094a741e --- /dev/null +++ b/templates/web/seesomething/footer.html @@ -0,0 +1,28 @@ + </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="main-menu"> + <li><[% IF c.req.uri.path == '/' %]span[% ELSE %]a href="/"[% END %] class="report-a-problem-btn" + >[% loc("Report a problem") %]</[% c.req.uri.path == '/' ? 'span' : 'a' %]></li>[% + %]<li><[% IF c.req.uri.path == '/my' %]span[% ELSE %]a href="/my"[% END + %]>[% loc("Your reports") %]</[% c.req.uri.path == '/my' ? '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/seesomething/js/validation_rules.html b/templates/web/seesomething/js/validation_rules.html new file mode 100644 index 000000000..5517cd8e8 --- /dev/null +++ b/templates/web/seesomething/js/validation_rules.html @@ -0,0 +1,14 @@ + validation_rules = { + detail: { required: true }, + category: { required: true }, + subcategory: { required: true } + }; + + $(function(){ + $('#submit_noname').click( function(e) { + alert('click'); + $('#form_category').addClass('required validCategory').removeClass('valid'); + $('#form_subcategory').addClass('required validCategory').removeClass('valid'); + }); + }); + diff --git a/templates/web/seesomething/js/validation_strings.html b/templates/web/seesomething/js/validation_strings.html new file mode 100644 index 000000000..64251c163 --- /dev/null +++ b/templates/web/seesomething/js/validation_strings.html @@ -0,0 +1,15 @@ + validation_strings = { + detail: '[% loc('Please enter some details') | replace("'", "\\'") %]', + name: { + validName: '[% loc('Please enter your full name, councils need this information – if you do not wish your name to be shown on the site, untick the box below') | replace("'", "\\'") %]' + }, + category: '[% loc('Please choose a transport category') | replace("'", "\\'") %]', + subcategory: '[% loc('Please choose an incident category') | replace("'", "\\'") %]', + rznvy: { + required: '[% loc('Please enter your email') | replace("'", "\\'") %]', + email: '[% loc('Please enter a valid email') | replace("'", "\\'") %]' + }, + email: { + email: '[% loc('Please enter a valid email') | replace("'", "\\'") %]' + }, + }; diff --git a/templates/web/seesomething/report/new/fill_in_details_form.html b/templates/web/seesomething/report/new/fill_in_details_form.html new file mode 100644 index 000000000..4b8880ab1 --- /dev/null +++ b/templates/web/seesomething/report/new/fill_in_details_form.html @@ -0,0 +1,141 @@ +<div id="report-a-problem-main"> + <h1>[% loc('Reporting a problem') %]</h1> + + [% IF js %] + <p id="councils_text"> + [% + tprintf( + loc('All the information you provide here will be sent to <strong>%s</strong>.'), + loc('the local council') + ); + %] + [% loc('The subject and details of the problem will be public, plus your name if you give us permission.') %] + </p> + [% ELSE %] + [% PROCESS 'report/new/councils_text.html' %] + [% END %] + + [% IF c.cobrand.moniker != 'fixmybarangay' || ( c.user && c.user.from_council ) %] + <div id="report-a-problem-sidebar"> + <!-- + The text for this section needs checking, but I can't work out which bit comes from where + --> + <div class="sidebar-tips"> + [% IF report.used_map %] + [% IF partial_token %] + <p id="unknown">[% loc('Please note your report has <strong>not yet been sent</strong>. Choose a category and add further information below, then submit.') %]</p> + [% END %] + <p>[% loc('You have located the problem at the point marked with a green pin on the map. If this is not the correct location, simply click on the map again. ') %]</p> + [% END %] + + <p> + [% IF report.used_map %] + [% INCLUDE 'report/new/fill_in_details_text.html' %] + [% ELSE %] + [% loc('Please fill in the form below with details of the problem, and describe the location as precisely as possible in the details box.') %] + [% END %] + </p> + </div> + + </div> + [% END %] + + [% INCLUDE 'errors.html' %] + <fieldset> + <div id="problem_form"> + + [% INCLUDE 'report/new/form_heading.html' %] + + + [% IF field_errors.council %] + <p class='form-error'>[% field_errors.council %]</p> + [% END %] + + <label for="form_detail">[% loc('Details') %]</label> + [% IF field_errors.detail %] + <p class='form-error'>[% field_errors.detail %]</p> + [% END %] + <textarea rows="7" cols="26" name="detail" id="form_detail" placeholder="[% loc('Please fill in details of the problem.') %]" required>[% report.detail | html %]</textarea> + + [% IF js %] + <div id="form_category_row"> + <label for="form_category">[% loc('Transport Category') %]</label> + <select name="category" id="form_category" required><option>[% loc('Loading...') %]</option></select> + </div> + [% ELSE %] + [% IF category_options.size %] + [% IF field_errors.category %] + <p class='form-error'>[% field_errors.category %]</p> + [% END %] + + [% PROCESS "report/new/category.html" %] + [% END %] + [% END %] + + <div id="form_subcategory_row"> + <label for="form_subcategory">[% loc('Incident Category') %]</label> + <select name="subcategory" id="form_subcategory" required> + <option value="">-- Pick a category --</option> + <option value="Smoking/other drugs">Smoking/other drugs</option> + <option value="Drugs">Drugs</option> + <option value="Anti-social behaviour">Anti-social behaviour</option> + <option value="Loud music">Loud music</option> + <option value="Damage">Damage</option> + <option value="Feet on seats">Feet on seats</option> + <option value="Other">Other</option> + </select> + </div> + + [% IF c.cobrand.allow_photo_upload %] + <label for="form_photo">[% loc('Photo') %]</label> + [% IF upload_fileid || report.photo %] + [% IF upload_fileid %] + <img align="right" src="/photo/[% upload_fileid %].temp.jpeg" alt=""> + <input type="hidden" name="upload_fileid" value="[% upload_fileid %]"> + [% END %] + + <p>[% loc('You have already attached a photo to this report, attaching another one will replace it.') %]</p> + + [% IF report.photo %] + <img align="right" src="/photo/[% report.id %].jpeg"> + [% END %] + [% END %] + + [% IF field_errors.photo %] + <p class='form-error'>[% field_errors.photo %]</p> + [% END %] + <input type="file" name="photo" id="form_photo"> + [% END %] + + + <label for="form_name">[% loc('Name (optional)') %]</label> + [% IF field_errors.name %] + <p class='form-error'>[% field_errors.name %]</p> + [% END %] + + <input type="text" class="form-focus-trigger validName" value="[% report.name | html %]" name="name" id="form_name" placeholder="[% loc('Your name') %]"> + + <label for="form_email">[% loc('Your email (optional)') %]</label> + [% IF field_errors.email %] + <p class='form-error'>[% field_errors.email %]</p> + [% END %] + <input type="email" value="[% report.user.email | html %]" name="email" id="form_email" placeholder="[% loc('Please enter your email address') %]"> + + + + <label class="" for="form_phone">[% loc('Phone number (optional)') %]</label> + <input class="" type="text" value="[% report.user.phone | html %]" name="phone" id="form_phone" placeholder="[% loc('Your phone number') %]"> + + <div class="form-txt-submit-box "> + <input class="green-btn" type="submit" id="submit_noname" name="submit_noname" value="[% loc('Submit') %]"> + </div> + + </div> + </fieldset> + + [% IF partial_token %] + <input type="hidden" name="partial" value="[% partial_token.token %]"> + [% END %] + + <input type="hidden" name="submit_problem" value="1"> +</div> |