diff options
author | Josh Angell <josh@supercooldesign.co.uk> | 2012-02-13 16:17:51 +0000 |
---|---|---|
committer | Josh Angell <josh@supercooldesign.co.uk> | 2012-02-13 16:17:51 +0000 |
commit | 774f98a73fa94bd74156654e9f45463f8a3d7be4 (patch) | |
tree | 3298754211a690fc82ef857a520a880777249a10 | |
parent | 6a1c21c7a782ffacac1c60c6035516199b4d26cb (diff) |
Add moderniser and query it to see if we're on mobile, if we are add a class to <html>, hide #report-a-poblem-sidebar
Signed-off-by: Josh Angell <josh@supercooldesign.co.uk>
-rw-r--r-- | templates/web/fixmystreet/common_header_tags.html | 35 | ||||
-rw-r--r-- | templates/web/fixmystreet/report/new/fill_in_details_form.html | 112 | ||||
-rw-r--r-- | web/js/fixmystreet.js | 6 | ||||
-rw-r--r-- | web/js/modernizr.custom.03050.js | 4 |
4 files changed, 101 insertions, 56 deletions
diff --git a/templates/web/fixmystreet/common_header_tags.html b/templates/web/fixmystreet/common_header_tags.html new file mode 100644 index 000000000..8cbd13d2f --- /dev/null +++ b/templates/web/fixmystreet/common_header_tags.html @@ -0,0 +1,35 @@ +[% INCLUDE 'js_validation_msgs.html' %] + +<meta http-equiv="content-type" content="text/html; charset=utf-8"> +<script type="text/javascript" src="/jslib/jquery-1.7.0.min.js"></script> + +<script src="[% version('/js/jquery.validate.min.js') %]" type="text/javascript" charset="utf-8"></script> + +<script src="[% version('/js/modernizr.custom.03050.js') %]" type="text/javascript" charset="utf-8"></script> + + +<script type="text/javascript" src="[% version('/js/geo.min.js') %]"></script> +<script type="text/javascript" src="[% version('/js/fixmystreet.js') %]"></script> + +[% map_js %] + +[% IF category_extras_json && category_extras_json != '{}' %] +<script type="text/javascript"> + category_extras = [% category_extras_json %]; +</script> +[% END %] + +[% IF robots %] + <meta name="robots" content="[% robots %]"> +[% ELSIF c.config.STAGING_SITE %] + <meta name="robots" content="noindex,nofollow"> +[% END %] + +[% IF rss %] + <link rel="alternate" type="application/rss+xml" title="[% rss.0 %]" href="[% rss.1 %]"> +[% END %] + +<title> + [% "$title :: " | html IF title %] + [% c.cobrand.site_title %] +</title> 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 f7a18c48c..5f4a6a7b7 100644 --- a/templates/web/fixmystreet/report/new/fill_in_details_form.html +++ b/templates/web/fixmystreet/report/new/fill_in_details_form.html @@ -1,32 +1,38 @@ <h1>[% loc('Reporting a problem') %]</h1> -[% 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> +<div id="report-a-poblem-sidebar"> + + [% 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 purple pin on the map. If this is not the correct location, simply click on the map again. ') %]</p> + [% END %] + + [% 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 %] -<p>[% loc('You have located the problem at the point marked with a purple pin on the map. If this is not the correct location, simply click on the map again. ') %]</p> -[% END %] -[% 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> + [% 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> -[% ELSE %] - [% PROCESS 'report/new/councils_text.html' %] -[% 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> + [% INCLUDE 'report/new/notes.html' %] +</div> [% INCLUDE 'errors.html' %] <fieldset> @@ -100,8 +106,6 @@ [% INCLUDE name_phone %] - [% INCLUDE 'report/new/notes.html' %] - <p id="problem_submit"> <input type="submit" value="[% loc('Submit') %]"> </p> @@ -115,48 +119,46 @@ <label for="form_email">[% loc('Your email:') %]</label> <input type="email" value="[% report.user.email | html %]" name="email" id="form_email" size="25" required> - [% INCLUDE 'report/new/notes.html' %] + <div id="form_sign_in"> + <h3>[% loc("Now to submit your report… do you have a FixMyStreet password?") %]</h3> - <div id="form_sign_in"> - <h3>[% loc("Now to submit your report… do you have a FixMyStreet password?") %]</h3> + <div id="form_sign_in_yes"> + [% IF field_errors.password %] + <p class='form-error'>[% field_errors.password %]</p> + [% END %] - <div id="form_sign_in_yes"> - [% IF field_errors.password %] - <p class='form-error'>[% field_errors.password %]</p> - [% END %] + <label class="n" for="password_sign_in">[% loc('<strong>Yes</strong>, I have a password:') %]</label> + <input type="password" name="password_sign_in" id="password_sign_in" value=""> - <label class="n" for="password_sign_in">[% loc('<strong>Yes</strong>, I have a password:') %]</label> - <input type="password" name="password_sign_in" id="password_sign_in" value=""> + <p> + <input type="checkbox" id="remember_me" name="remember_me" value='1'[% ' checked' IF remember_me %]> + <label class="n" for="remember_me">[% loc('Keep me signed in on this computer') %]</label> + </p> - <p> - <input type="checkbox" id="remember_me" name="remember_me" value='1'[% ' checked' IF remember_me %]> - <label class="n" for="remember_me">[% loc('Keep me signed in on this computer') %]</label> - </p> + <p> + <input type="submit" id="submit_sign_in" name="submit_sign_in" value="[% loc('Submit') %]"> + </p> + </div> - <p> - <input type="submit" id="submit_sign_in" name="submit_sign_in" value="[% loc('Submit') %]"> - </p> - </div> + <div id="form_sign_in_no"> + <p>[% loc('<strong>No</strong>, let me confirm my report by email:') %]</p> - <div id="form_sign_in_no"> - <p>[% loc('<strong>No</strong>, let me confirm my report by email:') %]</p> + [% INCLUDE name_phone %] + + <label for="password_register">[% loc('Enter a new password:') %]</label> + <input type="password" name="password_register" id="password_register" value=""> + - [% INCLUDE name_phone %] - - <label for="password_register">[% loc('Enter a new password:') %]</label> - <input type="password" name="password_register" id="password_register" value=""> - + <p><small>[% loc('Providing a password is optional, but doing so will allow you to more easily report problems, leave updates and manage your reports.') %]</small></p> - <p><small>[% loc('Providing a password is optional, but doing so will allow you to more easily report problems, leave updates and manage your reports.') %]</small></p> + <p> + <input type="submit" id="submit_register" name="submit_register" value="[% loc('Submit') %]"> + </p> - <p> - <input type="submit" id="submit_register" name="submit_register" value="[% loc('Submit') %]"> - </p> + </div> </div> - </div> - [% END %] </div> </fieldset> diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js index b1a8f1889..c3de39b48 100644 --- a/web/js/fixmystreet.js +++ b/web/js/fixmystreet.js @@ -31,6 +31,9 @@ function form_category_onchange() { } $(function(){ + if(Modernizr.mq('only screen and (max-width:48em)')) { + $('html').addClass('mobile'); + } $('html').removeClass('no-js').addClass('js'); @@ -190,4 +193,5 @@ $(function(){ }); } -}); + $('.mobile #report-a-poblem-sidebar').hide(); +});
\ No newline at end of file diff --git a/web/js/modernizr.custom.03050.js b/web/js/modernizr.custom.03050.js new file mode 100644 index 000000000..651a3bc81 --- /dev/null +++ b/web/js/modernizr.custom.03050.js @@ -0,0 +1,4 @@ +/* Modernizr 2.5.2 (Custom Build) | MIT & BSD + * Build: http://www.modernizr.com/download/#-mq-teststyles-load + */ +;window.Modernizr=function(a,b,c){function v(a){i.cssText=a}function w(a,b){return v(prefixes.join(a+";")+(b||""))}function x(a,b){return typeof a===b}function y(a,b){return!!~(""+a).indexOf(b)}function z(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:x(f,"function")?f.bind(d||b):f}return!1}var d="2.5.2",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l={},m={},n={},o=[],p=o.slice,q,r=function(a,c,d,e){var h,i,j,k=b.createElement("div"),l=b.body,m=l?l:b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:g+(d+1),k.appendChild(j);return h=["­","<style>",a,"</style>"].join(""),k.id=g,m.innerHTML+=h,m.appendChild(k),l||f.appendChild(m),i=c(k,a),l?k.parentNode.removeChild(k):m.parentNode.removeChild(m),!!i},s=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return r("@media "+b+" { #"+g+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},t={}.hasOwnProperty,u;!x(t,"undefined")&&!x(t.call,"undefined")?u=function(a,b){return t.call(a,b)}:u=function(a,b){return b in a&&x(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=p.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(p.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(p.call(arguments)))};return e});for(var A in l)u(l,A)&&(q=A.toLowerCase(),e[q]=l[A](),o.push((e[q]?"":"no-")+q));return v(""),h=j=null,e._version=d,e.mq=s,e.testStyles=r,e}(this,this.document),function(a,b,c){function d(a){return o.call(a)=="[object Function]"}function e(a){return typeof a=="string"}function f(){}function g(a){return!a||a=="loaded"||a=="complete"||a=="uninitialized"}function h(){var a=p.shift();q=1,a?a.t?m(function(){(a.t=="c"?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){a!="img"&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l={},o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};y[c]===1&&(r=1,y[c]=[],l=b.createElement(a)),a=="object"?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),a!="img"&&(r||y[c]===2?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i(b=="c"?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),p.length==1&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=!!b.attachEvent,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return o.call(a)=="[object Array]"},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,i){var j=b(a),l=j.autoCallback;j.url.split(".").pop().split("?").shift(),j.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]||h),j.instead?j.instead(a,e,f,g,i):(y[j.url]?j.noexec=!0:y[j.url]=1,f.load(j.url,j.forceCSS||!j.forceJS&&"css"==j.url.split(".").pop().split("?").shift()?"c":c,j.noexec,j.attrs,j.timeout),(d(e)||d(l))&&f.load(function(){k(),e&&e(j.origUrl,i,g),l&&l(j.origUrl,i,g),y[j.url]=2})))}function i(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var j,l,m=this.yepnope.loader;if(e(a))g(a,0,m,0);else if(w(a))for(j=0;j<a.length;j++)l=a[j],e(l)?g(l,0,m,0):w(l)?B(l):Object(l)===l&&i(l,m);else Object(a)===a&&i(a,m)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
\ No newline at end of file |