diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-03-03 18:06:28 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-03-03 18:06:28 +0000 |
commit | 965817c4be689d03573e8cc45b7b48aad574c986 (patch) | |
tree | a398d72a1f0810180d9ff882eb8a1776ccd55909 | |
parent | 135697bfc2ee9f5f9629a1a7b0cd70494b2d5f4f (diff) |
Get questionnaire page presentable.
-rw-r--r-- | templates/web/fixmystreet/questionnaire/index.html | 108 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 11 |
2 files changed, 117 insertions, 2 deletions
diff --git a/templates/web/fixmystreet/questionnaire/index.html b/templates/web/fixmystreet/questionnaire/index.html new file mode 100644 index 000000000..a1a159aa8 --- /dev/null +++ b/templates/web/fixmystreet/questionnaire/index.html @@ -0,0 +1,108 @@ +[% + PROCESS "maps/${map.type}.html"; + INCLUDE 'header.html', title = loc('Questionnaire'), bodyclass = 'mappage' +%] + +[% map_html %] + +[% INCLUDE 'report/updates.html' %] + +</div> +<div id="side"> + + <menu id="problems-nav" class="tab-nav"> + <ul> + <li><a id="questionnaire_tab" href="#questionnaire">[% loc('Questionnaire') %]</a></li> + <li><a id="report_tab" href="#report">[% loc( 'Your report' ) %]</a></li> + </ul> + </menu> + + <div id="questionnaire" class="issue-list-a tab"> + [% INCLUDE questionnaire_form %] + </div> + + <div id="report" class="issue-list-a tab"> + [% INCLUDE 'report/_main.html' %] + </div> +</div> + +[% INCLUDE 'footer.html' %] + +[% BLOCK questionnaire_form %] +<h1>[% loc('Questionnaire') %]</h1> + +<form method="post" action="/questionnaire/submit" id="questionnaire" +[%- IF c.cobrand.allow_photo_upload -%] + enctype="multipart/form-data" +[%- END -%] +> + +<input type="hidden" name="token" value="[% token | html %]"> + +<p> +[% loc('The details of your problem are available from the other tab above.') %] +[% loc('Please <a class="tab_link" href="#report">take a look</a> at the updates that have been left.') IF updates %] +</p> + +[% IF errors %] +<ul class="error"> +<li>[% errors.join("</li>\n<li>") %]</li> +</ul> +[% END %] + +<p> +[% loc('An update marked this problem as fixed.') IF problem.is_fixed %] +[% loc('Has this problem been fixed?') %] +</p> + +<p> +<input type="radio" name="been_fixed" id="been_fixed_yes" value="Yes"[% ' checked' IF been_fixed == 'Yes' %]> +<label class="inline" for="been_fixed_yes">[% loc('Yes') %]</label> +<input type="radio" name="been_fixed" id="been_fixed_no" value="No"[% ' checked' IF been_fixed == 'No' %]> +<label class="inline" for="been_fixed_no">[% loc('No') %]</label> +<input type="radio" name="been_fixed" id="been_fixed_unknown" value="Unknown"[% ' checked' IF been_fixed == 'Unknown' %]> +<label class="inline" for="been_fixed_unknown">[% loc('Don’t know') %]</label> +</p> + +[% UNLESS answered_ever_reported %] +<p>[% loc('Have you ever reported a problem to a council before, or is this your first time?') %]</p> +<p> +<input type="radio" name="reported" id="reported_yes" value="Yes"[% ' checked' IF reported == 'Yes' %]> +<label class="inline" for="reported_yes">[% loc('Reported before') %]</label> +<input type="radio" name="reported" id="reported_no" value="No"[% ' checked' IF reported == 'No' %]> +<label class="inline" for="reported_no">[% loc('First time') %]</label> +</p> +[% END %] + +<p>[% loc('If you wish to leave a public update on the problem, please enter it here +(please note it will not be sent to the council). For example, what was +your experience of getting the problem fixed?') %]</p> + +<p><textarea name="update" style="max-width:90%" rows="7" cols="30">[% update | html %]</textarea></p> + +[% IF c.cobrand.allow_photo_upload %] +<div id="fileupload_normalUI"> + [% IF upload_fileid %] + <p>[% loc('You have already attached a photo to this report, attaching another one will replace it.') %]</p> + <input type="hidden" name="upload_fileid" value="[% upload_fileid %]"> + [% END %] + <label for="form_photo">[% loc('Photo:') %]</label> + <input type="file" name="photo" id="form_photo"> +</div> +[% END %] + +<div id="another_qn"> + <p>[% loc('Would you like to receive another questionnaire in 4 weeks, reminding you to check the status?') %]</p> + <p> + <input type="radio" name="another" id="another_yes" value="Yes"[% ' checked' IF another == 'Yes' %]> + <label for="another_yes">[% loc('Yes') %]</label> + <input type="radio" name="another" id="another_no" value="No"[% ' checked' IF another == 'No' %]> + <label for="another_no">[% loc('No') %]</label> + </p> +</div> + +<p><input type="submit" name="submit" value="[% loc('Submit questionnaire') %]"></p> + +</form> +[% END %] + diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index 2e5ef2594..c192db8fa 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -54,13 +54,16 @@ function heightFix(elem1, elem2, offset){ * * elem: trigger element, must have an href attribute (so probably needs to be an <a>) */ -function tabs(elem) -{ +function tabs(elem, indirect) { var href = elem.attr('href'); //stupid IE sometimes adds the full uri into the href attr, so trim var start = href.indexOf('#'), target = href.slice(start, href.length); + if (indirect) { + elem = $(target + '_tab'); + } + if(!$(target).hasClass('open')) { //toggle class on nav @@ -310,6 +313,10 @@ $(function(){ e.preventDefault(); tabs($(this)); }); + $('.tab_link').click(function(e) { + e.preventDefault(); + tabs($(this), 1); + }); /* * Skip to nav on mobile |