diff options
10 files changed, 269 insertions, 7 deletions
diff --git a/templates/web/eastsussex/header.html.template b/templates/web/eastsussex/header.html.template index 20e3b9417..04aedc188 100644 --- a/templates/web/eastsussex/header.html.template +++ b/templates/web/eastsussex/header.html.template @@ -13,6 +13,7 @@ <script src="[% start %][% version('/cobrands/' _ c.cobrand.moniker _ '/position_map.js') %]" charset="utf-8"></script> [% INCLUDE 'common_header_tags.html', js_override = '/cobrands/fixmystreet/fixmystreet.js', site_title = c.cobrand.site_title %] [% extra_js %] + <script src="[% start %][% version('/cobrands/' _ c.cobrand.moniker _ '/report-form.js') %]"></script> [% IF c.req.uri.host == 'osm.fixmystreet.com' %] <link rel="canonical" href="http://www.fixmystreet.com[% c.req.uri.path_query %]"> diff --git a/templates/web/eastsussex/report/new/after_name.html b/templates/web/eastsussex/report/new/after_name.html new file mode 100644 index 000000000..26c213c1d --- /dev/null +++ b/templates/web/eastsussex/report/new/after_name.html @@ -0,0 +1,5 @@ + <span id="name-public-warning" class="label-warning public-warning name-warning" + [% 'style="display:none"' UNLESS name_public %] + > + [% loc('public') %] + </span> diff --git a/templates/web/eastsussex/report/public_label.html b/templates/web/eastsussex/report/public_label.html new file mode 100644 index 000000000..5c06a86d5 --- /dev/null +++ b/templates/web/eastsussex/report/public_label.html @@ -0,0 +1 @@ +<span class="label-warning public-warning">[% loc('public') %]</span> diff --git a/templates/web/eastsussex/report/update-form.html b/templates/web/eastsussex/report/update-form.html new file mode 100644 index 000000000..e4314b81d --- /dev/null +++ b/templates/web/eastsussex/report/update-form.html @@ -0,0 +1,212 @@ +[% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_body) %] +[% IF allow_creation %] + +<script> + $(function () { + $('#update_form_content').hide(); + $('#display_update').show(); + + $('#display_update').click( function () { + $('#update_form_content').show(); + $('#display_update').hide(); + $('#create_new').hide(); + $('#form_update').focus(); + }); + }); +</script> + +<div id="create_new"> + <h2> Create a <strong>new</strong> report near this location </h2> + + <p> + If you've discovered a new, or recurring problem (even if it's similar to the one in this + report) then : + </p> + + <form method="post" action="/report/new"> + <input type="hidden" name="latitude" value="[% problem.latitude %]"> + <input type="hidden" name="longitude" value="[% problem.longitude %]"> + <input type="submit" class="green-btn" value="CREATE A NEW PROBLEM NEARBY"> + </form> + + <p><strong>OR...</strong></p> +</div> + + +<div id="update_form"> + <h2> Discuss <strong>this</strong> report </h2> + + <p> + This allows you to comment on this report, and discuss with local residents. + </p> + + <input type="button" id="display_update" class="green-btn" value="Comment on this report" + style="display:none"> + + <div id="update_form_content"> + + <h2>[% loc( 'Provide an update') %]</h2> + + [% IF c.cobrand.moniker != 'emptyhomes' AND c.cobrand.moniker != 'stevenage' %] + <div class="general-notes"> + [% INCLUDE 'report/updates-sidebar-notes.html' %] + </div> + [% END %] + + [% INCLUDE 'errors.html' %] + + <form method="post" action="[% c.uri_for( '/report/update' ) %]" id="form_update_form" name="updateForm" class="validate"[% IF c.cobrand.allow_photo_upload %] enctype="multipart/form-data"[% END %]> + <fieldset> + <input type="hidden" name="submit_update" value="1"> + <input type="hidden" name="id" value="[% problem.id | html %]"> + + <label for="form_update">[% loc( 'Update:' ) %] + <span class="label-warning public-warning"> + [% loc('public') %] + </span> + </label> + [% IF field_errors.update %] + <div class='form-error'>[% field_errors.update %]</div> + [% END %] + <textarea rows="7" cols="30" name="update" id="form_update" placeholder="[% loc('Please write your update here') %]" required>[% update.text | html %]</textarea> + + [% IF c.user && c.user.belongs_to_body( problem.bodies_str ) %] + <label for="form_state">[% loc( 'State' ) %]</label> + <select name="state" id="form_state"> + [% FOREACH state IN [ ['confirmed', loc('Open')], ['investigating', + loc('Investigating')], ['action scheduled', loc('Action Scheduled')], + ['in progress', loc('In Progress')], ['duplicate', loc('Duplicate')], + ['unable to fix', loc('Unable to fix')], ['not responsible', loc('Not Responsible')], + ['fixed', loc('Fixed')] ] %] + <option [% 'selected ' IF state.0 == problem.state %] value="[% state.0 %]">[% state.1 %]</option> + [% END %] + </select> + [% ELSE %] + [% IF problem.is_fixed AND c.user_exists AND c.user.id == problem.user_id %] + + <input type="checkbox" name="reopen" id="form_reopen" value="1"[% ' checked' IF update.mark_open %]> + <label class="inline" for="form_reopen">[% loc('This problem has not been fixed') %]</label> + + [% ELSIF !problem.is_fixed %] + + <div class="checkbox-group"> + <input type="checkbox" name="fixed" id="form_fixed" value="1"[% ' checked' IF update.mark_fixed %]> + <label class="inline" for="form_fixed">[% loc('This problem has been fixed') %]</label> + </div> + + [% END %] + [% END %] + + [% IF c.cobrand.allow_photo_upload %] + <div id="fileupload_normalUI"> + [% IF upload_fileid %] + <img align="right" src="/photo/[% upload_fileid %].temp.jpeg" alt=""> + <p>[% loc('You have already attached a photo to this update, attaching another one will replace it.') %]</p> + <input type="hidden" name="upload_fileid" value="[% upload_fileid %]"> + [% END %] + <label for="form_photo">[% loc('Photo') %]</label> + [% IF field_errors.photo %] + <p class='form-error'>[% field_errors.photo %]</p> + [% END %] + <input type="file" name="photo" id="form_photo"> + </div> + [% END %] + + [% IF c.user_exists %] + + [% INCLUDE name %] + + <input class="final-submit green-btn" type="submit" id="update_post" value="[% loc('Post') %]"> + + + [% ELSE %] + + <label for="form_rznvy">[% loc('Your email' ) %] + <span class="muted">([% loc('We never show your email') %])</span> + </label> + [% IF field_errors.email %] + <p class='form-error'>[% field_errors.email %]</p> + [% END %] + <input type="email" name="rznvy" id="form_rznvy" value="[% update.user.email | html %]" placeholder="[% loc('Your email address' ) %]" required> + + <div id="form_sign_in"> + <h3>[% loc("Now to submit your update…") %]</h3> + <h2>[% loc("Do you have a FixMyStreet password?") %]</h2> + + <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('Yes I have a password') %]</label> + [% IF field_errors.password %] + <p class='form-error'>[% field_errors.password %]</p> + [% END %] + <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="submit_sign_in" id="submit_sign_in" value="[% loc('Post') %]"> + </div> + + <div class="checkbox-group"> + <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 class="general-notes"> + <p><strong>[% loc('Forgotten your password?') %]</strong> + [% loc('Confirm by email below, providing a new password at that point. When you confirm, your password will be updated.') %]</p> + </div> + + </div> + <div id="form_sign_in_no" class="form-box"> + <h5>[% loc('<strong>No</strong> Let me confirm my update by email') %]</h5> + + [% INCLUDE name %] + + <label for="password_register">[% loc('Password (optional)') %]</label> + + <div class="general-notes"> + <p>[% loc('Providing a password is optional, but doing so will allow you to more easily report problems, leave updates and manage your reports.') %]</p> + </div> + + <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="submit_register" id="submit_register" value="[% loc('Post') %]"> + </div> + + </div> + </div> + + [% END %] + </fieldset> + </form> + </div> <!-- update_form_content --> +</div> +[% END %] + +[% BLOCK name %] + [% INCLUDE 'report/new/extra_name.html' %] + + [% name_public = update.anonymous==0 OR (c.cobrand.default_show_name AND update.anonymous=='') %] + <label for="form_name">[% loc('Name') %] + <span id="name-public-warning" class="label-warning public-warning name-warning" + [% 'style="display:none"' UNLESS name_public %] + > + [% loc('public') %] + </span> + </label> + + [% IF field_errors.name %] + <p class='form-error'>[% field_errors.name %]</p> + [% END %] + + + <input type="text" [% IF problem.bodies_str == '2482' %]class="validName" [% END %]name="name" id="form_name" value="[% update.name || c.user.name | html %]" placeholder="[% loc('Your name') %]"> + + <div class="checkbox-group"> + <input type="checkbox" name="may_show_name" id="form_may_show_name" value="1"[% ' checked' IF name_public %]> + <label class="inline" for="form_may_show_name">[% loc('Show my name publicly') %]</label> + </div> + <div class="checkbox-group"> + <input type="checkbox" name="add_alert" id="form_add_alert" value="1"[% ' checked' IF add_alert %]> + <label class="inline" for="form_add_alert">[% loc( 'Alert me to future updates' ) %]</label> + </div> +[% END %] diff --git a/templates/web/fixmystreet/report/new/fill_in_details_form.html b/templates/web/fixmystreet/report/new/fill_in_details_form.html index 78c3f420b..75e11c74f 100644 --- a/templates/web/fixmystreet/report/new/fill_in_details_form.html +++ b/templates/web/fixmystreet/report/new/fill_in_details_form.html @@ -34,13 +34,13 @@ <p class='form-error'>[% field_errors.bodies %]</p> [% END %] - <label for="form_title">[% loc('One-line summary') %] <span class="muted">[% loc('(public)') %]</span></label> + <label for="form_title">[% loc('One-line summary') %] [% INCLUDE 'report/public_label.html' %]</label> [% IF field_errors.title %] <p class='form-error'>[% field_errors.title %]</p> [% END %] <input type="text" value="[% report.title | html %]" name="title" id="form_title" placeholder="[% loc('What’s the issue, and where is it?') %]" required> - <label for="form_detail">[% loc('Description') %] <span class="muted">[% loc('(public)') %]</span></label> + <label for="form_detail">[% loc('Description') %] [% INCLUDE 'report/public_label.html' %]</label> [% IF field_errors.detail %] <p class='form-error'>[% field_errors.detail %]</p> [% END %] diff --git a/templates/web/fixmystreet/report/new/form_user_loggedin.html b/templates/web/fixmystreet/report/new/form_user_loggedin.html index 977382ae3..848d331d4 100644 --- a/templates/web/fixmystreet/report/new/form_user_loggedin.html +++ b/templates/web/fixmystreet/report/new/form_user_loggedin.html @@ -1,11 +1,17 @@ -<div class="form-box"> +<div class="form-box" id="form-box--logged-in-name"> <label for="form_email">[% loc('Your email') %]</label> <input disabled type="text" value="[% c.user.email | html %]"> [% INCLUDE 'report/new/extra_name.html' %] - <label for="form_name">[% loc('Name') %]</label> + [% name_public = report.anonymous==0 OR (c.cobrand.default_show_name AND report.anonymous=='') %] + <label for="form_name">[% loc('Name') %] + [% TRY %] + [% INCLUDE 'report/new/after_name.html' %] + [% CATCH file %] + [% END %] + </label> [% IF field_errors.name %] <p class='form-error'>[% field_errors.name %]</p> [% END %] @@ -13,7 +19,7 @@ [%# if there is nothing in the name field then set check box as default on form %] <div class="checkbox-group"> - <input type="checkbox" name="may_show_name" id="form_may_show_name" value="1"[% ' checked' IF report.anonymous==0 OR (c.cobrand.default_show_name AND report.anonymous=='') %]> + <input type="checkbox" name="may_show_name" id="form_may_show_name" value="1"[% ' checked' IF name_public %]> <label class="inline" for="form_may_show_name">[% loc('Show my name publicly') %] </label> </div> diff --git a/templates/web/fixmystreet/report/new/form_user_loggedout.html b/templates/web/fixmystreet/report/new/form_user_loggedout.html index 8ae8d15f6..31cccd44e 100644 --- a/templates/web/fixmystreet/report/new/form_user_loggedout.html +++ b/templates/web/fixmystreet/report/new/form_user_loggedout.html @@ -40,7 +40,13 @@ [% INCLUDE 'report/new/extra_name.html' %] - <label for="form_name">[% loc('Name') %]</label> + [% name_public = report.anonymous==0 OR (c.cobrand.default_show_name AND report.anonymous=='') %] + <label for="form_name">[% loc('Name') %] + [% TRY %] + [% INCLUDE 'report/new/after_name.html' %] + [% CATCH file %] + [% END %] + </label> [% IF field_errors.name %] <p class='form-error'>[% field_errors.name %]</p> [% END %] @@ -49,7 +55,7 @@ [%# if there is nothing in the name field then set check box as default on form %] <div class="checkbox-group"> - <input type="checkbox" name="may_show_name" id="form_may_show_name" value="1"[% ' checked' IF report.anonymous==0 OR (c.cobrand.default_show_name AND report.anonymous=='') %]> + <input type="checkbox" name="may_show_name" id="form_may_show_name" value="1"[% ' checked' IF name_public %]> <label class="inline" for="form_may_show_name">[% loc('Show my name publicly') %]</label> </div> diff --git a/templates/web/fixmystreet/report/public_label.html b/templates/web/fixmystreet/report/public_label.html new file mode 100644 index 000000000..2e00a79d2 --- /dev/null +++ b/templates/web/fixmystreet/report/public_label.html @@ -0,0 +1 @@ +<span class="muted label-warning public-warning">[% loc('(public)') %]</span> diff --git a/web/cobrands/eastsussex/base.scss b/web/cobrands/eastsussex/base.scss index 6285b8662..7e9c57b06 100644 --- a/web/cobrands/eastsussex/base.scss +++ b/web/cobrands/eastsussex/base.scss @@ -234,3 +234,11 @@ styling, but this doesn't dtrt with span, so adding ourselves */ z-index: 1; } } + +.label-warning { + background: lighten(#ff3300, 20%); + color: white; + font-size: 90%; + padding: 2px; + cursor: default; +} diff --git a/web/cobrands/eastsussex/report-form.js b/web/cobrands/eastsussex/report-form.js new file mode 100644 index 000000000..4e01572f7 --- /dev/null +++ b/web/cobrands/eastsussex/report-form.js @@ -0,0 +1,22 @@ +$(function () { + setup_anonymous_checkbox( $('#form_sign_in_no') ); + setup_anonymous_checkbox( $('#form-box--logged-in-name') ); + setup_anonymous_checkbox( $('#update_form') ); + + $('.public-warning').attr({ 'title': 'This information will be be visible to the public on the report' }); +}); + +function setup_anonymous_checkbox (div) { + var label = div.find( '.name-warning' ); + checkbox = div.find('input[type=checkbox]'); + + checkbox.change( function () { + var v = $(this).attr('checked'); + if (v) { + label.show(); + } + else { + label.hide(); + } + }); +} |