diff options
Diffstat (limited to 'app')
112 files changed, 3001 insertions, 852 deletions
diff --git a/app/assets/images/search.png b/app/assets/images/search.png Binary files differnew file mode 100644 index 000000000..9e427ba94 --- /dev/null +++ b/app/assets/images/search.png diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index d8aed6346..fd49d3b53 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,6 +1,8 @@ // ... //= require jquery +//= require jquery_ujs //= require jquery.ui.datepicker +//= require jquery.ui.position //= require jquery.cookie //= require general //= require ba-throttle-debounce diff --git a/app/assets/javascripts/general.js b/app/assets/javascripts/general.js index 529bbeb04..002eef760 100644 --- a/app/assets/javascripts/general.js +++ b/app/assets/javascripts/general.js @@ -27,8 +27,8 @@ $(document).ready(function() { return false; }); - // "link to this" widget - $('a.link_to_this').click(function() { + // "link to this" widget + $('a.link_to_this').click(function() { var box = $('div#link_box'); var location = window.location.protocol + "//" + window.location.hostname + $(this).attr('href'); box.width(location.length + " em"); @@ -36,12 +36,12 @@ $(document).ready(function() { box.show(); box.find('input').select(); box.position({ - my: "left top", + my: "right center", at: "left bottom", of: this, collision: "fit" }); return false; - }); + }); $('.close-button').click(function() { $(this).parent().hide() }); $('div#variety-filter a').each(function() { diff --git a/app/assets/javascripts/jquery.fancybox-1.3.4.pack.js b/app/assets/javascripts/jquery.fancybox-1.3.4.pack.js deleted file mode 100755 index 1373ed083..000000000 --- a/app/assets/javascripts/jquery.fancybox-1.3.4.pack.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * FancyBox - jQuery Plugin - * Simple and fancy lightbox alternative - * - * Examples and documentation at: http://fancybox.net - * - * Copyright (c) 2008 - 2010 Janis Skarnelis - * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated. - * - * Version: 1.3.4 (11/11/2010) - * Requires: jQuery v1.3+ - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - */ - -;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>'); -F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)|| -c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick= -false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel", -function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+ -'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win== -"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+ -";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor, -opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length? -d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding}); -y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height== -i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents()); -f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode== -37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto"); -s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j); -f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c); -j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type== -"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"), -10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)}; -b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k= -0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+ -1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h= -true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1; -b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5- -d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f); -D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()}); -b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}}; -b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing", -easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);
\ No newline at end of file diff --git a/app/assets/stylesheets/jquery.fancybox-1.3.4.css b/app/assets/stylesheets/jquery.fancybox-1.3.4.css deleted file mode 100755 index 6f53d8f4a..000000000 --- a/app/assets/stylesheets/jquery.fancybox-1.3.4.css +++ /dev/null @@ -1,359 +0,0 @@ -/*
- * FancyBox - jQuery Plugin
- * Simple and fancy lightbox alternative
- *
- * Examples and documentation at: http://fancybox.net
- *
- * Copyright (c) 2008 - 2010 Janis Skarnelis
- * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
- *
- * Version: 1.3.4 (11/11/2010)
- * Requires: jQuery v1.3+
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-
-#fancybox-loading {
- position: fixed;
- top: 50%;
- left: 50%;
- width: 40px;
- height: 40px;
- margin-top: -20px;
- margin-left: -20px;
- cursor: pointer;
- overflow: hidden;
- z-index: 1104;
- display: none;
-}
-
-#fancybox-loading div {
- position: absolute;
- top: 0;
- left: 0;
- width: 40px;
- height: 480px;
- background-image: url('fancybox.png');
-}
-
-#fancybox-overlay {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- z-index: 1100;
- display: none;
-}
-
-#fancybox-tmp {
- padding: 0;
- margin: 0;
- border: 0;
- overflow: auto;
- display: none;
-}
-
-#fancybox-wrap {
- position: absolute;
- top: 0;
- left: 0;
- padding: 20px;
- z-index: 1101;
- outline: none;
- display: none;
-}
-
-#fancybox-outer {
- position: relative;
- width: 100%;
- height: 100%;
- background: #fff;
-}
-
-#fancybox-content {
- width: 0;
- height: 0;
- padding: 0;
- outline: none;
- position: relative;
- overflow: hidden;
- z-index: 1102;
- border: 0px solid #fff;
-}
-
-#fancybox-hide-sel-frame {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: transparent;
- z-index: 1101;
-}
-
-#fancybox-close {
- position: absolute;
- top: -15px;
- right: -15px;
- width: 30px;
- height: 30px;
- background: transparent url('fancybox.png') -40px 0px;
- cursor: pointer;
- z-index: 1103;
- display: none;
-}
-
-#fancybox-error {
- color: #444;
- font: normal 12px/20px Arial;
- padding: 14px;
- margin: 0;
-}
-
-#fancybox-img {
- width: 100%;
- height: 100%;
- padding: 0;
- margin: 0;
- border: none;
- outline: none;
- line-height: 0;
- vertical-align: top;
-}
-
-#fancybox-frame {
- width: 100%;
- height: 100%;
- border: none;
- display: block;
-}
-
-#fancybox-left, #fancybox-right {
- position: absolute;
- bottom: 0px;
- height: 100%;
- width: 35%;
- cursor: pointer;
- outline: none;
- background: transparent url('blank.gif');
- z-index: 1102;
- display: none;
-}
-
-#fancybox-left {
- left: 0px;
-}
-
-#fancybox-right {
- right: 0px;
-}
-
-#fancybox-left-ico, #fancybox-right-ico {
- position: absolute;
- top: 50%;
- left: -9999px;
- width: 30px;
- height: 30px;
- margin-top: -15px;
- cursor: pointer;
- z-index: 1102;
- display: block;
-}
-
-#fancybox-left-ico {
- background-image: url('fancybox.png');
- background-position: -40px -30px;
-}
-
-#fancybox-right-ico {
- background-image: url('fancybox.png');
- background-position: -40px -60px;
-}
-
-#fancybox-left:hover, #fancybox-right:hover {
- visibility: visible; /* IE6 */
-}
-
-#fancybox-left:hover span {
- left: 20px;
-}
-
-#fancybox-right:hover span {
- left: auto;
- right: 20px;
-}
-
-.fancybox-bg {
- position: absolute;
- padding: 0;
- margin: 0;
- border: 0;
- width: 20px;
- height: 20px;
- z-index: 1001;
-}
-
-#fancybox-bg-n {
- top: -20px;
- left: 0;
- width: 100%;
- background-image: url('fancybox-x.png');
-}
-
-#fancybox-bg-ne {
- top: -20px;
- right: -20px;
- background-image: url('fancybox.png');
- background-position: -40px -162px;
-}
-
-#fancybox-bg-e {
- top: 0;
- right: -20px;
- height: 100%;
- background-image: url('fancybox-y.png');
- background-position: -20px 0px;
-}
-
-#fancybox-bg-se {
- bottom: -20px;
- right: -20px;
- background-image: url('fancybox.png');
- background-position: -40px -182px;
-}
-
-#fancybox-bg-s {
- bottom: -20px;
- left: 0;
- width: 100%;
- background-image: url('fancybox-x.png');
- background-position: 0px -20px;
-}
-
-#fancybox-bg-sw {
- bottom: -20px;
- left: -20px;
- background-image: url('fancybox.png');
- background-position: -40px -142px;
-}
-
-#fancybox-bg-w {
- top: 0;
- left: -20px;
- height: 100%;
- background-image: url('fancybox-y.png');
-}
-
-#fancybox-bg-nw {
- top: -20px;
- left: -20px;
- background-image: url('fancybox.png');
- background-position: -40px -122px;
-}
-
-#fancybox-title {
- font-family: Helvetica;
- font-size: 12px;
- z-index: 1102;
-}
-
-.fancybox-title-inside {
- padding-bottom: 10px;
- text-align: center;
- color: #333;
- background: #fff;
- position: relative;
-}
-
-.fancybox-title-outside {
- padding-top: 10px;
- color: #fff;
-}
-
-.fancybox-title-over {
- position: absolute;
- bottom: 0;
- left: 0;
- color: #FFF;
- text-align: left;
-}
-
-#fancybox-title-over {
- padding: 10px;
- background-image: url('fancy_title_over.png');
- display: block;
-}
-
-.fancybox-title-float {
- position: absolute;
- left: 0;
- bottom: -20px;
- height: 32px;
-}
-
-#fancybox-title-float-wrap {
- border: none;
- border-collapse: collapse;
- width: auto;
-}
-
-#fancybox-title-float-wrap td {
- border: none;
- white-space: nowrap;
-}
-
-#fancybox-title-float-left {
- padding: 0 0 0 15px;
- background: url('fancybox.png') -40px -90px no-repeat;
-}
-
-#fancybox-title-float-main {
- color: #FFF;
- line-height: 29px;
- font-weight: bold;
- padding: 0 0 3px 0;
- background: url('fancybox-x.png') 0px -40px;
-}
-
-#fancybox-title-float-right {
- padding: 0 0 0 15px;
- background: url('fancybox.png') -55px -90px no-repeat;
-}
-
-/* IE6 */
-
-.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_close.png', sizingMethod='scale'); }
-
-.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_left.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_right.png', sizingMethod='scale'); }
-
-.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; }
-.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_left.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_main.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_right.png', sizingMethod='scale'); }
-
-.fancybox-ie6 #fancybox-bg-w, .fancybox-ie6 #fancybox-bg-e, .fancybox-ie6 #fancybox-left, .fancybox-ie6 #fancybox-right, #fancybox-hide-sel-frame {
- height: expression(this.parentNode.clientHeight + "px");
-}
-
-#fancybox-loading.fancybox-ie6 {
- position: absolute; margin-top: 0;
- top: expression( (-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px');
-}
-
-#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_loading.png', sizingMethod='scale'); }
-
-/* IE6, IE7, IE8 */
-
-.fancybox-ie .fancybox-bg { background: transparent !important; }
-
-.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_n.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_ne.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_e.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_se.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_s.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_sw.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_w.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_nw.png', sizingMethod='scale'); }
\ No newline at end of file diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss index 3118eab3d..8aa8010ae 100644 --- a/app/assets/stylesheets/main.scss +++ b/app/assets/stylesheets/main.scss @@ -134,6 +134,10 @@ overflow:visible; margin:0; } +#wrapper_google_embed iframe { +min-height: 800px; +} + #content { position:relative; width:875px; diff --git a/app/assets/stylesheets/responsive/_attachments_layout.scss b/app/assets/stylesheets/responsive/_attachments_layout.scss new file mode 100644 index 000000000..1eedc601b --- /dev/null +++ b/app/assets/stylesheets/responsive/_attachments_layout.scss @@ -0,0 +1,66 @@ +/* Layout for the HTML view of attachments */ + +/* Generated HTML should be full row width */ +#view-html-content { + @include grid-column(12); + @include ie8{ + padding-left: 0.9375em; + padding-right: 0.9375em; + } + table { + border-collapse:collapse; + margin-bottom:1em; + } + + td { + vertical-align:top; + max-width:30em; + overflow:auto; + } + +} + +.view_html_prefix { + + @include grid-column(12); + @include ie8{ + padding-left: 0.9375em; + padding-right: 0.9375em; + width: $main_menu-mobile_menu_cutoff; + } + + .view_html_logo { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:3); + @include ie8{ + padding-right: 0.9375em; + } + } + } + + .view_html_description { + @include grid-column(12); + @include respond-min($main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:7, $pull: 2); + @include ie8{ + padding-left: 0.9375em; + padding-right: 0.9375em; + } + } + } + + .view_html_download_link { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:2, $push: 7); + @include ie8{ + padding-left: 0.9375em; + } + } + } +} + + + + diff --git a/app/assets/stylesheets/responsive/_attachments_style.scss b/app/assets/stylesheets/responsive/_attachments_style.scss new file mode 100644 index 000000000..79d52b7f6 --- /dev/null +++ b/app/assets/stylesheets/responsive/_attachments_style.scss @@ -0,0 +1,26 @@ +/* Styling for the HTML view of attachments */ + +#view-html-content { + + td,th { + border:solid 1px #000; + } + + tr:nth-child(odd) { + background-color:#bbb; + } + + tr:nth-child(even) { + background-color:#ddd; + } +} + +.view_html_prefix { + text-align:center; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + text-align:left; + min-height:3em; + padding:0.5em 1em; + } + border-bottom: 1px solid #5F5F5F; +} diff --git a/app/assets/stylesheets/responsive/_blog_layout.scss b/app/assets/stylesheets/responsive/_blog_layout.scss new file mode 100644 index 000000000..d15f46c76 --- /dev/null +++ b/app/assets/stylesheets/responsive/_blog_layout.scss @@ -0,0 +1,4 @@ +/* Layout for blog */ +.blog_post { + margin-bottom:2em; +} diff --git a/app/assets/stylesheets/responsive/_blog_style.scss b/app/assets/stylesheets/responsive/_blog_style.scss new file mode 100644 index 000000000..1d27289fc --- /dev/null +++ b/app/assets/stylesheets/responsive/_blog_style.scss @@ -0,0 +1,10 @@ +.blog_post { + h2 a { + text-decoration: none; + &:hover, + &:active, + &:focus { + text-decoration: underline; + } + } +} diff --git a/app/assets/stylesheets/responsive/_categorization_game_layout.scss b/app/assets/stylesheets/responsive/_categorization_game_layout.scss new file mode 100644 index 000000000..138dfe005 --- /dev/null +++ b/app/assets/stylesheets/responsive/_categorization_game_layout.scss @@ -0,0 +1,41 @@ +/* Layout for categorisation game */ + +#request_game_play { + @include grid-row($behavior: nest); +} + +#game_sidebar { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:4, $float:right); + @include ie8{ + padding-left: 0.9375em; + } + @include lte-ie7 { + width: 17.438em; + } + } +} + +#game { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:8); + @include ie8{ + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 36.813em; + } + } +} + +/* Don't display request extracts floated right as there is constrained space */ +#request_game_play{ + span.desc { + float: none; + padding: 0; + background: none; + min-height: inherit; + } +} diff --git a/app/assets/stylesheets/responsive/_categorization_game_style.scss b/app/assets/stylesheets/responsive/_categorization_game_style.scss new file mode 100644 index 000000000..59c971a89 --- /dev/null +++ b/app/assets/stylesheets/responsive/_categorization_game_style.scss @@ -0,0 +1,8 @@ +/* Styling for categorisation game */ +#game_sidebar { + font-size:0.9em; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + text-align: center; + } + +} diff --git a/app/assets/stylesheets/responsive/_contact_layout.scss b/app/assets/stylesheets/responsive/_contact_layout.scss new file mode 100644 index 000000000..9fb7bd2f1 --- /dev/null +++ b/app/assets/stylesheets/responsive/_contact_layout.scss @@ -0,0 +1,4 @@ +/* Layout for contact form page */ +#contact_preamble { + margin-bottom: 30px; +} diff --git a/app/assets/stylesheets/responsive/_contact_style.scss b/app/assets/stylesheets/responsive/_contact_style.scss new file mode 100644 index 000000000..6a4abfcac --- /dev/null +++ b/app/assets/stylesheets/responsive/_contact_style.scss @@ -0,0 +1 @@ +/* Styles for contact form page */ diff --git a/app/assets/stylesheets/responsive/_footer_layout.scss b/app/assets/stylesheets/responsive/_footer_layout.scss new file mode 100644 index 000000000..2b0c956fa --- /dev/null +++ b/app/assets/stylesheets/responsive/_footer_layout.scss @@ -0,0 +1,50 @@ +/* Footer layout */ +#footer { + width:100%; + margin:5em 0 0; + padding:0.5em 0; +} + +#footer-nav{ + + @include grid-row(); + @include ie8{ + width: $main_menu-mobile_menu_cutoff; + } + img { + display: none; + } + + ul{ + padding: 0; + list-style: none outside none; + } + + @include respond-min( $main_menu-mobile_menu_cutoff ){ + ul { + @include block-grid(4); + } + @include ie8{ + #footer-nav ul > li:nth-child(4n+1) { + padding-left: 0em; + padding-right: 1.40625em; + } + #footer-nav ul > li:nth-child(4n+2) { + padding-left: 0.46875rem; + padding-right: 0.9375rem; + } + #footer-nav ul > li:nth-child(4n+3) { + padding-left: 0.9375em; + padding-right: 0.46875em; + } + #footer-nav ul > li:nth-child(4n) { + padding-left: 1.40625em; + padding-right: 0em; + } + } + + img { + display: inherit; + } + } +} diff --git a/app/assets/stylesheets/responsive/_footer_style.scss b/app/assets/stylesheets/responsive/_footer_style.scss new file mode 100644 index 000000000..81d29b7e1 --- /dev/null +++ b/app/assets/stylesheets/responsive/_footer_style.scss @@ -0,0 +1,5 @@ +/* Footer styles */ +#footer { + text-align: center; + font-size:0.85em; +} diff --git a/app/assets/stylesheets/responsive/_frontpage_layout.scss b/app/assets/stylesheets/responsive/_frontpage_layout.scss new file mode 100644 index 000000000..4559c0f6d --- /dev/null +++ b/app/assets/stylesheets/responsive/_frontpage_layout.scss @@ -0,0 +1,86 @@ +/* Frontpage layout */ + +#frontpage_splash { + @include grid-row($behavior: nest); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + min-height: 375px; + } + + #left_column { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column(8); + margin-top:66px; + @include ie8{ + padding-right: 0.9375em; + } + @include lte-ie7{ + width: 36.813em; + } + } + } + + #right_column { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column(4); + margin-top: 30px; + @include ie8{ + padding-left: 0.9375em; + } + @include lte-ie7{ + width: 17.438em; + } + } + + input[type=text] { + width:180px; + } + } + + #frontpage_splash #frontpage_search_box { + margin-bottom:30px; + margin-top:-10px; + } + + #frontpage_right_to_know { + line-height:20px; + } +} + +/* Two even columns */ +#frontpage_examples { + @include grid-row($behavior: nest); + margin-top: 2em; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + margin-top: 0; + } + + #examples_0 { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:6); + @include ie8{ + padding-right: 0.9375em; + } + @include lte-ie7{ + width: 27.125em; + } + } + } + + #examples_1 { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:6); + @include ie8{ + padding-left: 0.9375em; + } + @include lte-ie7{ + width: 27.125em; + } + } + } + + +} diff --git a/app/assets/stylesheets/responsive/_frontpage_style.scss b/app/assets/stylesheets/responsive/_frontpage_style.scss new file mode 100644 index 000000000..99270231f --- /dev/null +++ b/app/assets/stylesheets/responsive/_frontpage_style.scss @@ -0,0 +1,28 @@ +/* Frontpage styles */ +#frontpage_splash { + h1, h2 { + font-weight: normal; + } + strong { + font-weight: bold; + } +} + +#frontpage_examples { + ul { + list-style:none outside none; + padding: 0; + } + .excerpt { + cursor:pointer; + font-style:italic; + padding:0 0 0 2em; + } + + #examples_1 { + li { + border-bottom:1px solid #ddd; + padding-top: 1em; + } + } +} diff --git a/app/assets/stylesheets/responsive/_global_layout.scss b/app/assets/stylesheets/responsive/_global_layout.scss new file mode 100644 index 000000000..d7b24df41 --- /dev/null +++ b/app/assets/stylesheets/responsive/_global_layout.scss @@ -0,0 +1,100 @@ +/* Layout across the site */ +#wrapper{ + @include grid-row(); + @include ie8{ + width: $main_menu-mobile_menu_cutoff; + } +} + +/* A global 12 column element provides padding for all pages */ +#content{ + @include grid-column(12); + @include ie8{ + padding-left: 0.9375em; + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 56.125em; + } +} + + +textarea{ + @include respond-min( $main_menu-mobile_menu_cutoff ){ + width: inherit; + } +} + + +/* Container grid-rows for pages that use these generic headers and columns */ +#public_body_list, +#user_profile_header, +#general_blog, +#request_show, +#info_request_batch_show { + @include grid-row($behavior: nest); +} + +/* Column headers */ +#header_right { + @include grid-column(12); + + + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:4, $float:right); + padding-top:27px; + @include ie8{ + padding-left: 0.9375em; + } + @include lte-ie7 { + width: 17.438em; + } + } +} + +#header_left { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column(8); + @include ie8{ + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 36.813em; + } + } +} + +/* Columns */ +#left_column_flip, #left_column{ + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column(9); + @include lte-ie7 { + width: 41.625em; + } + } +} + +#right_column_flip, #right_column { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:3); + margin-top:20px; + @include lte-ie7 { + width: 12.625em; + } + } +} + +#left_column_flip, #right_column { + @include ie8{ + padding-left: 0.9375em; + } +} + +#right_column_flip, #left_column { + @include ie8{ + padding-right: 0.9375em; + } +} diff --git a/app/assets/stylesheets/responsive/_global_style.scss b/app/assets/stylesheets/responsive/_global_style.scss new file mode 100644 index 000000000..5b268f3a6 --- /dev/null +++ b/app/assets/stylesheets/responsive/_global_style.scss @@ -0,0 +1,225 @@ +html { + height: 100%; + font-size: 1em; +} + +body { + color: #333; + line-height: 1.5em; + height: 100%; + min-height: 100%; +} + +a { + color: #2688dc; + &:hover, + &:active, + &:focus { + color: #333333; + } +} + +h1, h2, h3, h4, h5, h6 { + margin-bottom: 18px; + margin-bottom: 1rem; + line-height: 1.1em; + text-rendering: optimizeLegibility; +} + +h1 { + font-size: 2.5em; +} + + +h2 { + font-size: 2em; +} + +h3 { + font-size: 1.6em +} + +h4 { + font-size: 1.3em; +} + +h5 { + font-size: 1em; +} + +p { + margin-top: 0; + margin-bottom: 1em; +} + +p.subtitle { + margin-top:0.5em; + margin-bottom:1.5em; + font-size:1.2em; + font-style:normal; + color:#222; +} + +hr { + border: none; + border-top: 1px solid #e9e9e9; + margin: 0; +} + +img { + max-width: 100%; + height: auto; +} + +dt { + margin-top: 1em; +} + +dd { + margin-left: 2em; +} + +dt + dd { + margin-top: 0.5em; + > p { + margin-top: 0; + } +} + + +/* Links in sidebars usually only underlined on hover */ +.feed_link,.act_link { + margin-bottom:10px; + a{ + text-decoration:none; + } + a:hover{ + text-decoration:underline; + } +} + +#header_right { + > a { + text-decoration:none; + } + > a:hover{ + text-decoration:underline; + } + + br{ + line-height:200%; + } + +} + +/* Notices to the user (usually on action completion) */ +#notice, #error { + font-size:1em; + border-radius:3px; + margin:1em 0; + padding:1.5em; + + p:first-child { + margin-top:0; + } + + p:last-child { + margin-bottom:0; + } + +} + +#notice { + background-color: lighten(#62b356, 23%); +} + +#error { + background-color: lighten(#b05460, 23%); +} + +.big { + font-size: 1.2em; +} + +/* Form styling */ + +label.form_label { + font-size: 1.1em; +} + +.form_item_note,.form_note { + font-size:0.875em; +} + +p + .form_item_note { + position: relative; + top: -1.25em; +} + +form input[type=text],form input[type=password] { + font-size:1.1em; + width:200px; + border-radius:3px; + -moz-border-radius:3px; + border-color:#BBB; + border-style:solid; + border-width:1px; + padding:5px; + display: inline-block; +} + +.fieldWithErrors { + display:block; + padding:0.2em; + textarea, input { + border:solid 1px Red !important; + } +} + +.errorExplanation { + border-radius:6px; + -moz-border-radius:6px; + font-weight: normal; + margin:20px 0 30px; +} + +#error,#hidden_request { + font-weight: bold; + padding:0.5em; +} + +#preview_form ul { + margin:0; + padding:1px 32px 10px; +} + +#preview_form ul li { + margin:10px 0; +} + +label small{ + text-transform: none; +} + +/* Pagination */ + +div.pagination { + text-align:center; + padding-top:0.3em; + + span.current { + padding:0 0.6em 0.1em; + } + + span.disabled { + padding:0 0.6em 0.1em; + } + + a, a:visited { + text-decoration:none; + padding:0 0.6em 0.1em; + } + +} + + diff --git a/app/assets/stylesheets/responsive/_header_layout.scss b/app/assets/stylesheets/responsive/_header_layout.scss new file mode 100644 index 000000000..b3103e3a9 --- /dev/null +++ b/app/assets/stylesheets/responsive/_header_layout.scss @@ -0,0 +1,205 @@ +/* Header layout */ + +#banner_content{ + @include grid-row; + position: relative; + @include ie8{ + width: $main_menu-mobile_menu_cutoff; + } +} + +#banner{ + // Hide menu items by default on mobile + #logged_in_bar, + #topnav, + #user_locale_switcher{ + display:none; + } + + // …and show a button to reveal them + .rsp_menu_button{ + @include grid-column(4); + padding: 1em 1em 0 1em; + float: right; + a { + text-align: right; + &.open{ + display: block; + } + &.close{ + display: none; + } + } + } + + // Squeeze the logo up on small screens to make room for the button + #logo_wrapper{ + @include grid-column(8); + padding: 1em 1em 0 1em; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column(4); + padding: 1em; + margin-bottom: 1em; + @include lte-ie7 { + width: 17.313em; + } + } + } + + &:target{ + // Hide menu button when menu is open + .rsp_menu_button{ + .open{ + display:none; + } + .close{ + display:block; + } + } + @media( max-width: $main_menu-mobile_menu_cutoff ){ + // Show menu items when menu is targeted + #logged_in_bar, + #topnav, + #user_locale_switcher{ + display:block; + clear:both; + } + } + + + } + + @include respond-min( $main_menu-mobile_menu_cutoff ){ + // On larger screens show the menu + #banner_nav, + #logged_in_bar, + #topnav, + #user_locale_switcher{ + display:block; + } + + // …and hide the menu button + .rsp_menu_button{ + display:none; + } + } + +} + + +#topnav{ + padding: 0 0 1em 0; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + padding: 0; + } +} + +#navigation { + list-style: none outside none; + @include grid-row; + padding: 0; + position: relative; + @include ie8{ + width: $main_menu-mobile_menu_cutoff; + } + /* Spread the nav elements horizontally on larger screens */ + li{ + display: block; + + @include respond-min( $main_menu-mobile_menu_cutoff ){ + display: inline-block; + float: left; + } + @include lte-ie7 { + display: inline; + } + } + a{ + padding: 0.5em 1em; + display: block; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + display: inline-block; + } + } +} + +#navigation_search { + @include respond-min( $main_menu-mobile_menu_cutoff ){ + position: absolute; + top: 0; + right: 0; + } + form{ + @include grid-row; + padding-right: 1em; + @include lte-ie7 { + display: inline; + } + } + input{ + @include grid-column($columns:9); + margin:0; + @include lte-ie7 { + width: 10.063em; + } + } + label{ + @include prefix-postfix-base; + @include grid-column($columns:3,$float:left); + border:none; + img{ + max-width: 100%; + } + @include lte-ie7 { + width: 2.125em; + } + } +} + +#logged_in_bar{ + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column(8); + @include ie8{ + padding-left: 0.9375em; + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 36.813em; + } + } + + a, .greeting { + display:block; + padding: 0.5em 1em; + } + + @include respond-min( $main_menu-mobile_menu_cutoff ){ + #logged_in_links { + top: 3em; + position: absolute; + right: 0.9375em; + a, .greeting{ + display:inline; + font-weight: bold; + padding:0 0 0 1em; + } + + } + } +} + +#user_locale_switcher { + @include respond-min( $main_menu-mobile_menu_cutoff ){ + position: absolute; + right: 0; + top: 0; + } + a{ + display: block; + padding: 0.5em 1em; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + display: inline-block; + } + } + +} diff --git a/app/assets/stylesheets/responsive/_header_style.scss b/app/assets/stylesheets/responsive/_header_style.scss new file mode 100644 index 000000000..9008a73a7 --- /dev/null +++ b/app/assets/stylesheets/responsive/_header_style.scss @@ -0,0 +1,4 @@ +/* Header style */ +#navigation { + border-bottom: 1px solid #e9e9e9; +} diff --git a/app/assets/stylesheets/responsive/_help_layout.scss b/app/assets/stylesheets/responsive/_help_layout.scss new file mode 100644 index 000000000..60e557660 --- /dev/null +++ b/app/assets/stylesheets/responsive/_help_layout.scss @@ -0,0 +1,17 @@ +/* Help layout */ + +/* These help pages use grid-column elements, so need grid-row mixed in */ +#help_about, +#help_alaveteli, +#help_api, +#help_credits, +#help_officers, +#help_privacy, +#help_requesting, +#help_unhappy { + @include grid-row($behavior: nest); +} + +#hash_link_padding { + margin-bottom:10em; +} diff --git a/app/assets/stylesheets/responsive/_help_style.scss b/app/assets/stylesheets/responsive/_help_style.scss new file mode 100644 index 000000000..f339bec8c --- /dev/null +++ b/app/assets/stylesheets/responsive/_help_style.scss @@ -0,0 +1,29 @@ +/* Help style */ + +div.controller_help { + /* Underline links on hover */ + dt a, h1 a { + text-decoration:none; + font-size:0.9em; + } + dt:hover, h1:hover { + > a { + color:#777; + } + > a:hover{ + text-decoration: underline; + } + } +} + + + +ul.no_bullets { + list-style-type:none; + margin:0 0 30px; + padding:0; + + li { + margin-bottom:6px; + } +} diff --git a/app/assets/stylesheets/responsive/_lists_layout.scss b/app/assets/stylesheets/responsive/_lists_layout.scss new file mode 100644 index 000000000..69237ae91 --- /dev/null +++ b/app/assets/stylesheets/responsive/_lists_layout.scss @@ -0,0 +1,84 @@ +/* Layout for lists of requests, authorities, users */ +.request_listing,.body_listing,.user_listing { + overflow:hidden; + margin-top: 1.5em; + .head { + display:block; + margin-bottom: 0.33em; + } + .requester { + margin-bottom: 0.5em; + } + .bottomline { + display:block; + margin-bottom: 0.5em; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + margin-bottom: 1.5em; + } + } +} + +.desc { + display:block; + float:right; + clear:none; + overflow:hidden; + margin-bottom: 1.5em; +} + +.body_listing, .user_listing { + .desc, .bottomline { + clear: both; + float: none; + margin-bottom: 0; + } + .bottomline { + margin-bottom: 1.5em + } +} + +.info_request_batch_intro{ + @include grid-column(12); +} + +.request_listing{ + @include grid-row($behavior:nest); + margin-top: 1.5em; + .request_right { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:4, $float:right); + @include ie8{ + padding-left: 0.9375em; + } + @include lte-ie7 { + width: 17.438em; + } + } + } + + .request_left { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:8); + @include ie8{ + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 36.813em; + } + } + } + + .desc { + width:100%; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + padding:0 0 0 2em; + @include lte-ie7 { + padding: 0; + } + } + } +} + + diff --git a/app/assets/stylesheets/responsive/_lists_style.scss b/app/assets/stylesheets/responsive/_lists_style.scss new file mode 100644 index 000000000..762901a5f --- /dev/null +++ b/app/assets/stylesheets/responsive/_lists_style.scss @@ -0,0 +1,107 @@ +/* Styles for lists of requests, authorities, users */ +.request_listing,.body_listing,.user_listing { + border-bottom:1px solid #e9e9e9; + .head { + font-weight: bold; + font-size: 1.6em; // =h3 + } + a { + text-decoration: none; + &:hover, + &:active, + &:focus { + text-decoration: underline; + } + } +} + +.request_listing{ + .bottomline { + background-position:top left; + background-repeat: no-repeat; + padding:0 0 0 27px; + } + .desc { + font-style: italic; + } +} + +.request_icon_line { + background-repeat:no-repeat; + background-position:left center; + padding:0 0 0 42px; +} + +.request_short_listing { + margin-top:1em; + h3 { + font-size: 1.3em; + margin-bottom: 0.33em; + } + a { + text-decoration: none; + &:hover, + &:active, + &:focus { + text-decoration: underline; + } + } +} + +/* Status lines and icons */ +.icon_waiting_response,.icon_waiting_classification,.icon_waiting_clarification { + background-image:image-url('status-pending.png'); + color:#A68C2E; +} + + +.icon_not_held, .icon_attention_requested { + background-image:image-url('status-not-held.png'); + color:#A68C2E; +} + +.icon_successful,.icon_partially_successful { + background-image:image-url('status-complete.png'); + color:#69952F; +} + +.icon_requires_admin,.icon_waiting_response_overdue,.icon_waiting_response_very_overdue { + background-image:image-url('status-overdue.png'); + color:#C1272D; +} + +.icon_gone_postal { + background-image:image-url('status-gone-postal.png'); + color:#A68C2E; +} + +.icon_error_message { + background-image:image-url('status-error.png'); + color:#C1272D; +} + +.icon_internal_review { + background-image:image-url('status-internal-review.png'); + color:#A68C2E; +} + +.icon_user_withdrawn { + background-image:image-url('status-withdrawn.png'); + color:#A68C2E; +} + +.icon_failed,.icon_rejected { + background-image:image-url('status-denied.png'); + color:#C1272D; +} + +#public_body_list { + ul { + list-style: none outside none; + padding-left: 0; + } + li { + line-height: 1.2em; + margin-bottom: 0.4em; + } +} diff --git a/app/assets/stylesheets/responsive/_new_request_layout.scss b/app/assets/stylesheets/responsive/_new_request_layout.scss new file mode 100644 index 000000000..eec95ae77 --- /dev/null +++ b/app/assets/stylesheets/responsive/_new_request_layout.scss @@ -0,0 +1,184 @@ +/* Layout for pages in making a new request */ + +/* /select_authority page */ +#authority_selection { + @include grid-column($columns: 12, $collapse: true); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns: 6, $collapse: true); + @include ie8{ + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 27.125em; + } + } +} + +.new_info_request{ + @include grid-row($behavior: nest); +} + +#authority_preview { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column(6); + margin-top:-67px; + @include ie8{ + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 26.188em; + } + } + + /* Hide some elements of the public body that aren't appropriate in this + context */ + #list-filter, h2.foi_results, .public-body-name-prefix { + display: none; + } + + /* Compact request list for viewing in authority preview column */ + .request_left, #header_left { + @include grid-column(12, $collapse: true); + } + + .request_right { + @include grid-column(12, $collapse: true); + } + + span.desc { + background:none; + line-height:18px; + padding: 0; + } + +} +/* /new/[body_name] page */ +#request_header { + @include grid-row; + + /* Restrict width of form elements on wide screens */ + #request_header_body, #request_header_subject, #typeahead_response { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:8, $last-column:true); + @include ie8{ + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 36.813em; + } + } + } + + span#to_public_body { + display:block; + margin-bottom:15px; + } +} + +/* Advice sits on right hand side */ +#request_advice { + + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:4, $push: 8); + @include ie8{ + padding-left: 0.9375em; + } + @include lte-ie7 { + width: 17.438em; + } + } +} + +#request_form { + + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:8, $pull: 4); + @include ie8{ + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 36.813em; + } + } + +} + +#preview_form { + @include grid-column(12); +} + + +/* Batch request page*/ + +div.batch_public_body_toggle { + display:none; +} + +#body_selection { + @include grid-row($behavior: nest); + /* Equal columns */ + .body_list { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column(5); + } + @include lte-ie7 { + width: 22.313em; + } + } + + select { + height: inherit; + } + + #body_candidates { + float: left; + @include ie8{ + padding-right: 0.9375em; + } + } + + #body_selections { + float: right; + @include ie8{ + padding-left: 0.9375em; + } + } + + input[type='submit'] { + margin: 10px 0; + width: 45%; + } + + #body_select_all_button, #body_deselect_button { + float: right; + } + + #body_submission { + input[type='submit'] { + margin: 10px 0; + width:100%; + } + } + + .select_all_button { + display: none; + } + + .body_select { + width: 100%; + } + +} + +.batch_public_body_list { + margin-left: 110px; +} + + + + diff --git a/app/assets/stylesheets/responsive/_new_request_style.scss b/app/assets/stylesheets/responsive/_new_request_style.scss new file mode 100644 index 000000000..ab144b39f --- /dev/null +++ b/app/assets/stylesheets/responsive/_new_request_style.scss @@ -0,0 +1,56 @@ +/* Styles for pages in making a new request */ + +/* /new/[body_name] page */ +.new_info_request { + label { + display: block; + margin-bottom: 0.5em; + } + input[type=text], + textarea { + width: 100%; + font-size: 1em; + } +} + +#request_header { + padding-top:0.5em; + padding-bottom:1em; + +} + +#to_public_body { + font-weight: bold; + font-size: 1.3em; +} + +#request_header_text { + border-radius:3px; + background-color: lighten(#62b356, 23%); + padding:0 1em; + margin-bottom: 1.5em; + margin-top: 1.5em; + overflow: hidden; + h3 { + font-size: 1em; + } + +} + +#request_advice { + ul { + margin:0 auto; + + li { + margin:0 0 1em; + } + } +} + + +/* Batch request page */ + +.batch_public_body_toggle { + color: #0000EE; + font-size: 0.9em; +} diff --git a/app/assets/stylesheets/responsive/_popups_layout.scss b/app/assets/stylesheets/responsive/_popups_layout.scss new file mode 100644 index 000000000..700361609 --- /dev/null +++ b/app/assets/stylesheets/responsive/_popups_layout.scss @@ -0,0 +1,31 @@ +/* Layout for popup messages */ + +.popup { + @include ie8{ + width: 100%; + } +} +.popup .popup-content{ + margin:0.5em; + width: 95%; + float: left; +} + +.popup .popup-close { + display:inline-block; + overflow:hidden; + float:right; + padding:10px 0; +} + +#other-country-notice{ + display:none; +} + +#link_box { + position:absolute; + z-index:999; + display:none; +} + + diff --git a/app/assets/stylesheets/responsive/_popups_style.scss b/app/assets/stylesheets/responsive/_popups_style.scss new file mode 100644 index 000000000..dd6af7ba5 --- /dev/null +++ b/app/assets/stylesheets/responsive/_popups_style.scss @@ -0,0 +1,57 @@ +/* Styles for popup messages */ +.popup { + background-color:#D5FFD8; + border:solid 3px #16C132; + z-index:2000; + overflow:auto; + text-align:center; + margin-top:2px; +} + +.popup p { + margin: 0; +} + +#everypage h2,#everypage h3 { + margin:0.5em 0; +} + +.popup .popup-close { + color:#FFF; + text-decoration:none; + border-radius:2px; + -moz-border-radius:2px; + width:15px; + height:15px; + cursor:pointer; + background: image-url('small-green-cross.png') no-repeat 0; + border:solid 0 #FFF; + text-indent:-999px; + overflow:hidden; + float:right; +} + +/* Box that appears when you click the link icon in a request thread */ +#link_box { + text-align:left; + background-color:#FFF; + opacity:0.9; + border-radius:6px; + -moz-border-radius:6px; + border:1px solid #444; + padding:5px; +} + +#link_box .close-button { + background-color:#444; + margin-left:15px; + padding:0; +} + +a.link_to_this { + display:inline-block; + width:20px; + letter-spacing:-1000em; + overflow:hidden; + background:image-url('link-icon.png') no-repeat; +} diff --git a/app/assets/stylesheets/responsive/_print_layout.scss b/app/assets/stylesheets/responsive/_print_layout.scss new file mode 100644 index 000000000..514d22f83 --- /dev/null +++ b/app/assets/stylesheets/responsive/_print_layout.scss @@ -0,0 +1,45 @@ +div#content, div#left_column, div.entirebody div#wrapper { + width: 100%; + margin: 0; + float: none; +} + +div#content { + padding-right: 0; + width: 96%; +} + +#wrapper { + width: auto; + padding: 0; + +} + +p.event_actions, +div#after_actions, +#right_column, +#banner, +.admin .navbar, +#header_right, +#describe_state_form_1, +#describe_state_form_2, +.attachment_image, +#footer { + display: none; +} + +p#request_status { + page-break-after: avoid; +} +div.correspondence { + page-break-before: avoid; +} + +#other-country-notice { + display: none; +} + +.not-for-print { + display: none !IMPORTANT; +} + diff --git a/app/assets/stylesheets/responsive/_print_style.scss b/app/assets/stylesheets/responsive/_print_style.scss new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/app/assets/stylesheets/responsive/_print_style.scss diff --git a/app/assets/stylesheets/responsive/_public_body_layout.scss b/app/assets/stylesheets/responsive/_public_body_layout.scss new file mode 100644 index 000000000..ac02b1c10 --- /dev/null +++ b/app/assets/stylesheets/responsive/_public_body_layout.scss @@ -0,0 +1,5 @@ +/* Layout for public body pages */ + +#foi_results_section { + @include grid-column(12); +} diff --git a/app/assets/stylesheets/responsive/_public_body_stats_layout.scss b/app/assets/stylesheets/responsive/_public_body_stats_layout.scss new file mode 100644 index 000000000..81e784094 --- /dev/null +++ b/app/assets/stylesheets/responsive/_public_body_stats_layout.scss @@ -0,0 +1,24 @@ +/* Layout for public body stats page */ +.public-body-ranking { + margin-bottom: 40px; +} + +.public-body-ranking-title { + margin-top: 25px; + margin-bottom: 10px; +} + +.public-body-ranking table { + margin-top: 20px; + margin-left: 30px; +} + +.public-body-ranking td, th { + border: 0px; + padding: 5px; + padding-right: 20px; +} + +.public-body-ranking td.statistic { + text-align: center; +} diff --git a/app/assets/stylesheets/responsive/_public_body_stats_style.scss b/app/assets/stylesheets/responsive/_public_body_stats_style.scss new file mode 100644 index 000000000..79a379af1 --- /dev/null +++ b/app/assets/stylesheets/responsive/_public_body_stats_style.scss @@ -0,0 +1,11 @@ +/* Style for public body stats page */ +.public-body-ranking .axisLabels { + /* Justification for using !important here: the axis label color is + set in the style attribute in Flot's Javascript to the same + colour as the grid background. Changing this requires quite + invasive changes to the Javascript, and is likely to be + irrelevant in the next version of Flot anyway, which will have + core support for axis labels. So, just use !important to make + the axes black rather than transparent grey for the moment: */ + color: #000 !important; +} diff --git a/app/assets/stylesheets/responsive/_public_body_style.scss b/app/assets/stylesheets/responsive/_public_body_style.scss new file mode 100644 index 000000000..240d92618 --- /dev/null +++ b/app/assets/stylesheets/responsive/_public_body_style.scss @@ -0,0 +1,14 @@ +/* Style for public body pages */ +.public-body-name-prefix { + color:#888; + font-size: 1.3em; + position: relative; + top: 1em; +} + +#follow_count { + font-weight: bold; + font-size: 3em; + position: relative; + top: 0.25em; +} diff --git a/app/assets/stylesheets/responsive/_request_layout.scss b/app/assets/stylesheets/responsive/_request_layout.scss new file mode 100644 index 000000000..ec2d0d149 --- /dev/null +++ b/app/assets/stylesheets/responsive/_request_layout.scss @@ -0,0 +1,50 @@ +/* Layout for request page */ + + +.gone_postal_help{ + @include grid-column(12); +} + +#describe_state_form_1 { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column(9); + } +} + +#show_response_view { + @include grid-row(); + + > h2 { + @include grid-column($columns: 12, $collapse: true); + } + + .correspondence { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column(9); + @include ie8{ + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 41.625em; + } + } + } + + + #followup { + @include grid-column(12, $collapse: true); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column(8, $collapse: true); + } + } +} + + +/* Event history details */ +#request_details { + table { + margin-bottom:1em; + } +} diff --git a/app/assets/stylesheets/responsive/_request_style.scss b/app/assets/stylesheets/responsive/_request_style.scss new file mode 100644 index 000000000..c33688793 --- /dev/null +++ b/app/assets/stylesheets/responsive/_request_style.scss @@ -0,0 +1,112 @@ +/* Style for request page */ + +div.correspondence { + border: 1px solid #ccc; + margin: 0 0 1em; + padding: 0.5em 1em 0 0.5em; + + h2 { + text-align:right; + font-size:1em; + } +} + +div.comment_in_request { + border: 1px dotted #ccc; + margin:0 0 1em 3em; + padding:0 0.5em; + + h2 { + font-size:1em; + } + p { + font-size: 0.9em; + } +} + +.event_actions { + text-align:right; + line-height: 1em; + margin-bottom: 1em; +} + +.correspondence_text,.comment_in_request_text { + margin:0 1.2em 0 0.9em; +} + +.user_photo_on_request img { + width:48px; + height:48px; + float:left; + vertical-align:middle; + margin-right:0.5em; +} + +.user_photo_on_comment img { + width:36px; + height:36px; + float:left; + vertical-align:middle; + margin-top: 0.5em; + margin-right:0.5em; +} + +a img.attachment_image { + float:left; + border:0; + vertical-align:middle; + margin:0 0.2em 0.2em 0; +} + +.attachments hr.top { + clear:both; + margin:0 0 1em; +} + +.attachments hr.bottom { + clear:both; + margin:1em 0 0; +} + +.describe_state_form,#other_recipients { + + border-radius:3px; + -moz-border-radius:3px; + margin:1em 0; + padding:0.5em 1em; +} + +.describe_state_form { + hr { + margin-top: 1em; + &+p { + margin-top: 1em; + } + } +} + +#follow_box .feed_link { + text-align: center; +} + + +/* Event history details */ + +#request_details { + + table { + border-collapse: collapse; + } + + td,th { + border:solid 1px #000; + } + + tr.odd { + background-color:#bbb; + } + + tr.even { + background-color:#ddd; + } +} diff --git a/app/assets/stylesheets/responsive/_search_layout.scss b/app/assets/stylesheets/responsive/_search_layout.scss new file mode 100644 index 000000000..48dd0c6a7 --- /dev/null +++ b/app/assets/stylesheets/responsive/_search_layout.scss @@ -0,0 +1,59 @@ +/* Layout for search (and filters on request list)*/ +/* These pages use grid-columns, so are contained in a grid-row */ +#general_search, +#general_search_redirect, +#public_body_show, +#request_list { + @include grid-row($behavior: nest); +} + + +#filter_requests_form, #search_form, #filter_form { + + label { + display:inline; + float:none; + padding-right:5px; + } + + label.title { + @include respond-min( $main_menu-mobile_menu_cutoff ){ + display:inline-block; + float:none; + width:110px; + } + } + + .filter-request-types { + display: inline-block; + line-height: 1.5em; + } + + #requests-subfilters div { + margin-top:10px; + } + + .list-filter-item{ + margin-bottom:0.5em; + } +} + + +.results_section { + @include grid-column(12); + .results-block:last-child { + border-bottom: none; + padding-bottom:0; + } + .results_section { + @include grid-column(12, $collapse:true); + } +} + +#advanced-search input[type=text] { + width:50%; +} + +#advanced-search-tips{ + @include grid-column(12); +} diff --git a/app/assets/stylesheets/responsive/_search_style.scss b/app/assets/stylesheets/responsive/_search_style.scss new file mode 100644 index 000000000..dfd40fc67 --- /dev/null +++ b/app/assets/stylesheets/responsive/_search_style.scss @@ -0,0 +1,54 @@ +/* Style for search (and filters on request list) */ +.user_photo_on_search img { + width:48px; + height:48px; + vertical-align:middle; + border:1px solid #ddd; + margin-right:5px; + padding:2px; + float: left; +} + +input.use-datepicker[type=text] { + width: 130px; + background:image-url('calendar.png') no-repeat 100px 5px; +} + +#ui-datepicker-div.ui-widget { + font-family:Arial, sans-serif; +} + +#ui-datepicker-div .ui-datepicker-header,#ui-datepicker-div .ui-widget-header { + background:none; + border:solid 0 #FFF; + color:#444; + font-size:17px; + font-weight:normal; + line-height:1.5em !important; +} + +#ui-datepicker-div { + .ui-datepicker-prev, .ui-datepicker-next { + margin-top:2px; + opacity:0.5; + } + .ui-datepicker-prev-hover { + left:2px; + top:2px; + border:none; + background:#FFF; + cursor:pointer; + opacity:1; + } + + .ui-datepicker-next-hover { + right:2px; + top:2px; + border:none; + background:#FFF; + cursor:pointer; + opacity:1; + } +} + + diff --git a/app/assets/stylesheets/responsive/_settings.scss b/app/assets/stylesheets/responsive/_settings.scss new file mode 100644 index 000000000..c52451b46 --- /dev/null +++ b/app/assets/stylesheets/responsive/_settings.scss @@ -0,0 +1,5 @@ +$main_menu-mobile_menu_cutoff: 58em; +$row-width: 64em; +$body-font-family: "Helvetica Neue", Arial, Helvetica, Helmet, Freesans, sans-serif; +$form-label-font-color: #333333; +$base-font-size: 16px; diff --git a/app/assets/stylesheets/responsive/_signin_layout.scss b/app/assets/stylesheets/responsive/_signin_layout.scss new file mode 100644 index 000000000..44999d31b --- /dev/null +++ b/app/assets/stylesheets/responsive/_signin_layout.scss @@ -0,0 +1,82 @@ +/* Signin layout */ + +#sign_in_reason { + @include grid-column(12); +} +#left_half { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:5,$float:left); + @include ie8{ + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 22.313em; + } + } +} + +#right_half { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:5,$float:right); + @include ie8{ + padding-left: 0.9375em; + } + @include lte-ie7 { + width: 22.313em; + } + } +} + +#middle_strip { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:2,$float:left); + @include ie8{ + padding-left: 0.9375em; + padding-right: 0.9375em; + } + @include lte-ie7 { + width: 7.438em; + } + } +} + +#sign_together{ + @include grid-row($behavior: nest); +} + +#sign_alone{ + @include grid-row($behavior: nest); + #signin { + @include grid-column(12); + @include respond-min( $main_menu-mobile_menu_cutoff ){ + @include grid-column($columns:6,$push:3); + @include ie8{ + padding-left: 0.9375em; + padding-right: 0.9375em; + } + } + } + +} + +#signup, #signin { +margin-top:20px; + + .form_checkbox { + input{ + margin-bottom: 0; + } + label { + font-size:1em; + display:inline; + margin-right: 0; + } + } +} + +#sign_in_reason { + margin-top: 0.5em; +} diff --git a/app/assets/stylesheets/responsive/_signin_style.scss b/app/assets/stylesheets/responsive/_signin_style.scss new file mode 100644 index 000000000..2bd2802b4 --- /dev/null +++ b/app/assets/stylesheets/responsive/_signin_style.scss @@ -0,0 +1,28 @@ +/* Signin styles */ +#signup, #signin { + input[type=text], + input[type=password] { + width: 100%; + } +} + +#middle_strip { + text-align:center; + position: relative; + @include respond-min( $main_menu-mobile_menu_cutoff ){ + top: 3em; + } + font-size:1.2em; +} + +p#sign_in_reason, p#superuser_message { + font-size:2em; + font-weight:bold; + line-height:1em; +} + +p#superuser_message { + font-size:1.2em; +} + + diff --git a/app/assets/stylesheets/responsive/_user_layout.scss b/app/assets/stylesheets/responsive/_user_layout.scss new file mode 100644 index 000000000..8087f978c --- /dev/null +++ b/app/assets/stylesheets/responsive/_user_layout.scss @@ -0,0 +1,2 @@ +/* Layout for user pages */ + diff --git a/app/assets/stylesheets/responsive/_user_style.scss b/app/assets/stylesheets/responsive/_user_style.scss new file mode 100644 index 000000000..31e7e6bc0 --- /dev/null +++ b/app/assets/stylesheets/responsive/_user_style.scss @@ -0,0 +1,36 @@ +/* Style for user pages */ + +#set_photo { + background:image-url('defaultprofilepic.png'); +} + +#user_public_banned { + background-color:#d0d0d0; +} + +#user_photo_on_profile { + img, #set_photo { + width:96px; + height:96px; + float:left; + vertical-align:middle; + text-align:center; + margin-right:0.5em; + } +} + +div.user_about_me { + overflow:auto; + margin:1em 1.5em; + padding:0 0.5em; +} + +#user_public_banned { + + padding:0.5em 1em; + + .details { + font-size:0.9em; + font-style:italic; + } +} diff --git a/app/assets/stylesheets/responsive/_utils.scss b/app/assets/stylesheets/responsive/_utils.scss new file mode 100644 index 000000000..68884fa7a --- /dev/null +++ b/app/assets/stylesheets/responsive/_utils.scss @@ -0,0 +1,35 @@ +$fix-mqs: false !default; + +@mixin respond-min($width) { + // If we're outputting for a fixed media query set... + @if $fix-mqs { + // ...and if we should apply these rules... + @if $fix-mqs >= $width { + // ...output the content the user gave us. + @content; + } + } + @else { + // Otherwise, output it using a regular media query + @media(min-width: $width) { + @content; + } + } +} + +$ie8: false !default; +$lte-ie7: false !default; + +@mixin ie8 { + // Only use this content if we're dealing with IE8 + @if $ie8 { + @content; + } +} + +@mixin lte-ie7 { + // Only use this content if we're dealing with oldest IE (<= 7) + @if $lte-ie7 { + @content; + } +} diff --git a/app/assets/stylesheets/responsive/all.scss b/app/assets/stylesheets/responsive/all.scss new file mode 100644 index 000000000..4c935bed3 --- /dev/null +++ b/app/assets/stylesheets/responsive/all.scss @@ -0,0 +1,68 @@ +@import "foundation/functions"; +@import "_settings"; + +@import "foundation/components/grid"; +@import "foundation/components/block-grid"; +@import "foundation/components/forms"; + + +// Our own style components +@import "_utils"; + +// Global styles +@import "_global_layout"; +@import "_global_style"; + +@import "_header_layout"; +@import "_header_style"; + +@import "_popups_layout"; +@import "_popups_style"; + +@import "_footer_layout"; +@import "_footer_style"; + +@import "_lists_layout"; +@import "_lists_style"; + +// Styles that are only used on particular pages +@import "_attachments_layout"; +@import "_attachments_style"; + +@import "_blog_layout"; +@import "_blog_style"; + +@import "_categorization_game_style"; +@import "_categorization_game_layout"; + +@import "_contact_style"; +@import "_contact_layout"; + +@import "_frontpage_layout"; +@import "_frontpage_style"; + +@import "_help_style"; +@import "_help_layout"; + +@import "_new_request_layout"; +@import "_new_request_style"; + +@import "_search_layout"; +@import "_search_style"; + +@import "_request_layout"; +@import "_request_style"; + +@import "_signin_layout"; +@import "_signin_style"; + +@import "_public_body_layout"; +@import "_public_body_style"; + +@import "_public_body_stats_layout"; +@import "_public_body_stats_style"; + +@import "_user_style"; +@import "_user_layout"; + +@import "custom"; diff --git a/app/assets/stylesheets/responsive/application-ie8.css b/app/assets/stylesheets/responsive/application-ie8.css new file mode 100644 index 000000000..38cdf3b47 --- /dev/null +++ b/app/assets/stylesheets/responsive/application-ie8.css @@ -0,0 +1,7 @@ +/* ... +*= require_self +*= require normalize +*= require responsive/ie8 +*= require jquery.ui.datepicker +*= require jquery.ui.tabs +*/ diff --git a/app/assets/stylesheets/responsive/application-lte-ie7.css b/app/assets/stylesheets/responsive/application-lte-ie7.css new file mode 100644 index 000000000..5b8802cd5 --- /dev/null +++ b/app/assets/stylesheets/responsive/application-lte-ie7.css @@ -0,0 +1,7 @@ +/* ... +*= require_self +*= require normalize +*= require responsive/lte-ie7 +*= require jquery.ui.datepicker +*= require jquery.ui.tabs +*/ diff --git a/app/assets/stylesheets/responsive/application.css b/app/assets/stylesheets/responsive/application.css new file mode 100644 index 000000000..0b5aa8d66 --- /dev/null +++ b/app/assets/stylesheets/responsive/application.css @@ -0,0 +1,7 @@ +/* ... +*= require_self +*= require normalize +*= require responsive/main +*= require jquery.ui.datepicker +*= require jquery.ui.tabs +*/ diff --git a/app/assets/stylesheets/responsive/custom.scss b/app/assets/stylesheets/responsive/custom.scss new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/app/assets/stylesheets/responsive/custom.scss diff --git a/app/assets/stylesheets/responsive/ie8.scss b/app/assets/stylesheets/responsive/ie8.scss new file mode 100644 index 000000000..32d545c47 --- /dev/null +++ b/app/assets/stylesheets/responsive/ie8.scss @@ -0,0 +1,3 @@ +$ie8: true; +$fix-mqs: 58em; +@import 'all'; diff --git a/app/assets/stylesheets/responsive/lte-ie7.scss b/app/assets/stylesheets/responsive/lte-ie7.scss new file mode 100644 index 000000000..b1519d6f0 --- /dev/null +++ b/app/assets/stylesheets/responsive/lte-ie7.scss @@ -0,0 +1,4 @@ +$lte-ie7: true; +$ie8: true; +$fix-mqs: 58em; +@import 'all'; diff --git a/app/assets/stylesheets/responsive/main.scss b/app/assets/stylesheets/responsive/main.scss new file mode 100644 index 000000000..ff4314781 --- /dev/null +++ b/app/assets/stylesheets/responsive/main.scss @@ -0,0 +1 @@ +@import 'all'; diff --git a/app/assets/stylesheets/responsive/print.scss b/app/assets/stylesheets/responsive/print.scss new file mode 100644 index 000000000..b643c11ff --- /dev/null +++ b/app/assets/stylesheets/responsive/print.scss @@ -0,0 +1,2 @@ +@import "_print_layout"; +@import "_print_style"; diff --git a/app/controllers/admin_spam_addresses_controller.rb b/app/controllers/admin_spam_addresses_controller.rb new file mode 100644 index 000000000..f5c7e93da --- /dev/null +++ b/app/controllers/admin_spam_addresses_controller.rb @@ -0,0 +1,27 @@ +class AdminSpamAddressesController < AdminController + + def index + @spam_addresses = SpamAddress.all + @spam_address = SpamAddress.new + end + + def create + @spam_address = SpamAddress.new(params[:spam_address]) + + if @spam_address.save + notice = "#{ @spam_address.email } has been added to the spam addresses list" + redirect_to spam_addresses_path, :notice => notice + else + @spam_addresses = SpamAddress.all + render :index + end + end + + def destroy + @spam_address = SpamAddress.find(params[:id]) + @spam_address.destroy + notice = "#{ @spam_address.email } has been removed from the spam addresses list" + redirect_to spam_addresses_path, :notice => notice + end + +end diff --git a/app/controllers/admin_user_controller.rb b/app/controllers/admin_user_controller.rb index 940a5fe8f..a6438e151 100644 --- a/app/controllers/admin_user_controller.rb +++ b/app/controllers/admin_user_controller.rb @@ -99,6 +99,12 @@ class AdminUserController < AdminController redirect_to admin_user_show_url(@admin_user) end + def modify_comment_visibility + @visibility_value = params.key?(:hide_selected) ? false : true + Comment.update_all(["visible=?", @visibility_value], :id => params[:comment_ids]) + redirect_to :back + end + private end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 370e8e15c..78a82316a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -129,8 +129,9 @@ class ApplicationController < ActionController::Base @exception_class = exception.class.to_s @exception_message = exception.message case exception - when ActiveRecord::RecordNotFound, RouteNotFound + when ActiveRecord::RecordNotFound, RouteNotFound, WillPaginate::InvalidPage @status = 404 + sanitize_path(params) when PermissionDenied @status = 403 else @@ -431,7 +432,11 @@ class ApplicationController < ActionController::Base def country_from_ip country = "" if !AlaveteliConfiguration::gaze_url.empty? - country = quietly_try_to_open("#{AlaveteliConfiguration::gaze_url}/gaze-rest?f=get_country_from_ip;ip=#{request.remote_ip}") + begin + country = quietly_try_to_open("#{AlaveteliConfiguration::gaze_url}/gaze-rest?f=get_country_from_ip;ip=#{request.remote_ip}") + rescue ActionDispatch::RemoteIp::IpSpoofAttackError + country = AlaveteliConfiguration::iso_country_code + end end country = AlaveteliConfiguration::iso_country_code if country.empty? return country @@ -441,6 +446,15 @@ class ApplicationController < ActionController::Base `git log -1 --format="%H"`.strip end + # URL Encode the path parameter for use in render_exception + # + # params - the params Hash + # + # Returns a Hash + def sanitize_path(params) + params.merge!(:path => Rack::Utils.escape(params[:path])) if params.key?(:path) + end + # URL generating functions are needed by all controllers (for redirects), # views (for links) and mailers (for use in emails), so include them into # all of all. diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb index cda56a211..5e39c3a2c 100644 --- a/app/controllers/comment_controller.rb +++ b/app/controllers/comment_controller.rb @@ -6,34 +6,18 @@ class CommentController < ApplicationController before_filter :check_read_only, :only => [ :new ] + before_filter :find_info_request, :only => [ :new ] + before_filter :create_track_thing, :only => [ :new ] + before_filter :reject_unless_comments_allowed, :only => [ :new ] + before_filter :reject_if_user_banned, :only => [ :new ] protect_from_forgery :only => [ :new ] def new - if params[:type] == 'request' - @info_request = InfoRequest.find_by_url_title!(params[:url_title]) - @track_thing = TrackThing.create_track_for_request(@info_request) - if params[:comment] - @comment = Comment.new(params[:comment].merge({ - :comment_type => 'request', - :user => @user - })) - end - else - raise "Unknown type " + params[:type] - end - - # Are comments disabled on this request? - # - # There is no “add comment” link when comments are disabled, so users should - # not usually hit this unless they are explicitly attempting to avoid the comment - # block, so we just raise an exception. - raise "Comments are not allowed on this request" if !@info_request.comments_allowed? - - # Banned from adding comments? - if !authenticated_user.nil? && !authenticated_user.can_make_comments? - @details = authenticated_user.can_fail_html - render :template => 'user/banned' - return + if params[:comment] + @comment = Comment.new(params[:comment].merge({ + :comment_type => 'request', + :user => @user + })) end if params[:comment] @@ -92,5 +76,36 @@ class CommentController < ApplicationController end end -end + private + def find_info_request + if params[:type] == 'request' + @info_request = InfoRequest.find_by_url_title!(params[:url_title]) + else + raise "Unknown type #{ params[:type] }" + end + end + + def create_track_thing + @track_thing = TrackThing.create_track_for_request(@info_request) + end + + # Are comments disabled on this request? + # + # There is no “add comment” link when comments are disabled, so users should + # not usually hit this unless they are explicitly attempting to avoid the comment block + def reject_unless_comments_allowed + unless @info_request.comments_allowed? + redirect_to request_url(@info_request), :notice => "Comments are not allowed on this request" + end + end + + # Banned from adding comments? + def reject_if_user_banned + if authenticated_user && !authenticated_user.can_make_comments? + @details = authenticated_user.can_fail_html + render :template => 'user/banned' + end + end + +end diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index 9959df6d8..9033198a0 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -9,6 +9,7 @@ class HelpController < ApplicationController # we don't even have a control subroutine for most help pages, just see their templates before_filter :long_cache + before_filter :catch_spam, :only => [:contact] def unhappy @info_request = nil @@ -69,4 +70,12 @@ class HelpController < ApplicationController end + private + + def catch_spam + if request.post? && !params[:contact][:comment].empty? + redirect_to frontpage_url + end + end + end diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index a94461758..d66c28275 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -447,9 +447,9 @@ class RequestController < ApplicationController flash[:notice] = case info_request.calculate_status when 'waiting_response' _("<p>Thank you! Hopefully your wait isn't too long.</p> <p>By law, you should get a response promptly, and normally before the end of <strong> -{{date_response_required_by}}</strong>.</p>",:date_response_required_by=>simple_date(info_request.date_response_required_by)) +{{date_response_required_by}}</strong>.</p>",:date_response_required_by=>view_context.simple_date(info_request.date_response_required_by)) when 'waiting_response_overdue' - _("<p>Thank you! Hope you don't have to wait much longer.</p> <p>By law, you should have got a response promptly, and normally before the end of <strong>{{date_response_required_by}}</strong>.</p>",:date_response_required_by=>simple_date(info_request.date_response_required_by)) + _("<p>Thank you! Hope you don't have to wait much longer.</p> <p>By law, you should have got a response promptly, and normally before the end of <strong>{{date_response_required_by}}</strong>.</p>",:date_response_required_by=>view_context.simple_date(info_request.date_response_required_by)) when 'waiting_response_very_overdue' _("<p>Thank you! Your request is long overdue, by more than {{very_late_number_of_days}} working days. Most requests should be answered within {{late_number_of_days}} working days. You might like to complain about this, see below.</p>", :very_late_number_of_days => AlaveteliConfiguration::reply_very_late_after_days, :late_number_of_days => AlaveteliConfiguration::reply_late_after_days) when 'not_held' @@ -763,18 +763,17 @@ class RequestController < ApplicationController key_path = foi_fragment_cache_path(key) image_dir = File.dirname(key_path) FileUtils.mkdir_p(image_dir) - html, wrapper_id = @attachment.body_as_html(image_dir) - view_html_stylesheet = render_to_string :partial => "request/view_html_stylesheet" - html.sub!(/<head>/i, "<head>" + view_html_stylesheet) - html.sub!(/<body[^>]*>/i, '<body><prefix-here><div id="' + wrapper_id + '"><div id="view-html-content">') - html.sub!(/<\/body[^>]*>/i, '</div></div></body>') - - view_html_prefix = render_to_string :partial => "request/view_html_prefix" - html.sub!("<prefix-here>", view_html_prefix) - html.sub!("<attachment-url-here>", CGI.escape(@attachment_url)) + html = @attachment.body_as_html(image_dir, + :attachment_url => Rack::Utils.escape(@attachment_url), + :content_for => { + :head_suffix => render_to_string(:partial => "request/view_html_stylesheet"), + :body_prefix => render_to_string(:partial => "request/view_html_prefix") + } + ) @incoming_message.html_mask_stuff!(html) + response.content_type = 'text/html' render :text => html end diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index 78c494dba..97c47c448 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -17,8 +17,15 @@ class ServicesController < ApplicationController text = _("Hello! You can make Freedom of Information requests within {{country_name}} at {{link_to_website}}", :country_name => found_country[:country_name], :link_to_website => "<a href=\"#{found_country[:url]}\">#{found_country[:name]}</a>".html_safe) else - current_country = WorldFOIWebsites.by_code(iso_country_code)[:country_name] - text = _("Hello! We have an <a href=\"/help/alaveteli?country_name=#{CGI.escape(current_country)}\">important message</a> for visitors outside {{country_name}}", :country_name => current_country) + country_data = WorldFOIWebsites.by_code(iso_country_code) + if country_data + text = _("Hello! We have an <a href=\"{{url}}\">important message</a> for visitors outside {{country_name}}", + :country_name => country_data[:country_name], + :url => "/help/alaveteli?country_name=#{CGI.escape(country_data[:country_name])}") + else + text = _("Hello! We have an <a href=\"{{url}}\">important message</a> for visitors in other countries", + :url => "/help/alaveteli") + end end ensure FastGettext.locale = old_fgt_locale diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 83e05ebbc..dccc52efc 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -118,7 +118,7 @@ class TrackController < ApplicationController if @user @existing_track = TrackThing.find_existing(@user, @track_thing) if @existing_track - flash[:notice] = _("You are already following updates about {{track_description}}", :track_description => @track_thing.params[:list_description]) + flash[:notice] = view_context.already_subscribed_notice(@track_thing) return true end end @@ -130,11 +130,7 @@ class TrackController < ApplicationController @track_thing.track_medium = 'email_daily' @track_thing.tracking_user_id = @user.id @track_thing.save! - if @user.receive_email_alerts - flash[:notice] = _('You will now be emailed updates about {{track_description}}. <a href="{{change_email_alerts_url}}">Prefer not to receive emails?</a>', :track_description => @track_thing.params[:list_description], :change_email_alerts_url => url_for(:controller => "user", :action => "wall", :url_name => @user.url_name)) - else - flash[:notice] = _('You are now <a href="{{wall_url_user}}">following</a> updates about {{track_description}}', :track_description => @track_thing.params[:list_description], :wall_url_user => url_for(:controller => "user", :action => "wall", :url_name => @user.url_name)) - end + flash[:notice] = render_to_string(:partial => 'track_set').html_safe return true end @@ -183,16 +179,8 @@ class TrackController < ApplicationController new_medium = params[:track_medium] if new_medium == 'delete' track_thing.destroy - flash[:notice] = _("You are no longer following {{track_description}}.", :track_description => track_thing.params[:list_description]) + flash[:notice] = view_context.unsubscribe_notice(track_thing) redirect_to URI.parse(params[:r]).path - - # Reuse code like this if we let medium change again. - #elsif new_medium == 'email_daily' - # track_thing.track_medium = new_medium - # track_thing.created_at = Time.now() # as created_at is used to limit the alerts to start with - # track_thing.save! - # flash[:notice] = "You are now tracking " + track_thing.params[:list_description] + " by email daily" - # redirect_to user_url(track_thing.tracking_user) else raise "new medium not handled " + new_medium end @@ -217,7 +205,6 @@ class TrackController < ApplicationController for track_thing in TrackThing.find(:all, :conditions => [ "track_type = ? and tracking_user_id = ?", track_type, user_id ]) track_thing.destroy end - flash[:notice] += "</ul>" redirect_to params[:r] end diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 059cebdfa..151e53758 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -33,5 +33,10 @@ module AdminHelper link_to(eye, user_path(user), :title => "view user's page on public website") + " " + link_to(h(user.name), admin_user_show_path(user), :title => "view full details") end + + def comment_visibility(comment) + comment.visible? ? 'Visible' : 'Hidden' + end + end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 154697377..33525cb3d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -136,5 +136,47 @@ module ApplicationHelper nil end end + + def event_description(event) + body_link = public_body_link_absolute(event.info_request.public_body) + user_link = request_user_link_absolute(event.info_request) + date = simple_date(event.created_at) + case event.event_type + when 'sent' + _('Request sent to {{public_body_name}} by {{info_request_user}} on {{date}}.', + :public_body_name => body_link, + :info_request_user => user_link, + :date => date) + when 'followup_sent' + case event.calculated_state + when 'internal_review' + _('Internal review request sent to {{public_body_name}} by {{info_request_user}} on {{date}}.', + :public_body_name => body_link, + :info_request_user => user_link, + :date => date) + when 'waiting_response' + _('Clarification sent to {{public_body_name}} by {{info_request_user}} on {{date}}.', + :public_body_name => body_link, + :info_request_user => user_link, + :date => date) + else + _('Follow up sent to {{public_body_name}} by {{info_request_user}} on {{date}}.', + :public_body_name => body_link, + :info_request_user => user_link, + :date => date) + end + when 'response' + _('Response by {{public_body_name}} to {{info_request_user}} on {{date}}.', + :public_body_name => body_link, + :info_request_user => user_link, + :date => date) + when 'comment' + _('Request to {{public_body_name}} by {{info_request_user}}. Annotated by {{event_comment_user}} on {{date}}.', + :public_body_name => body_link, + :info_request_user => user_link, + :event_comment_user => user_link_absolute(event.comment.user), + :date => date) + end + end end diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 405886a85..dd6ffa805 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -18,8 +18,8 @@ module LinkToHelper request_url(info_request, {:only_path => true}.merge(options)) end - def request_link(info_request, cls=nil ) - link_to h(info_request.title), request_path(info_request), :class => cls + def request_link(info_request, cls=nil) + link_to info_request.title, request_path(info_request), :class => cls end def request_details_path(info_request) @@ -75,15 +75,15 @@ module LinkToHelper end def public_body_link_short(public_body) - link_to h(public_body.short_or_long_name), public_body_path(public_body) + link_to public_body.short_or_long_name, public_body_path(public_body) end def public_body_link(public_body, cls=nil) - link_to h(public_body.name), public_body_path(public_body), :class => cls + link_to public_body.name, public_body_path(public_body), :class => cls end def public_body_link_absolute(public_body) # e.g. for in RSS - link_to h(public_body.name), public_body_url(public_body) + link_to public_body.name, public_body_url(public_body) end # Users @@ -96,19 +96,19 @@ module LinkToHelper end def user_link(user, cls=nil) - link_to h(user.name), user_path(user), :class => cls + link_to user.name, user_path(user), :class => cls end def user_link_for_request(request, cls=nil) if request.is_external? user_name = request.external_user_name || _("Anonymous user") if !request.external_url.nil? - link_to h(user_name), request.external_url + link_to user_name, request.external_url else user_name end else - link_to h(request.user.name), user_path(request.user), :class => cls + link_to request.user.name, user_path(request.user), :class => cls end end @@ -116,7 +116,7 @@ module LinkToHelper if request.is_external? external_text || (request.external_user_name || _("Anonymous user")) + " (external)" else - link_to(h(internal_text || request.user.name), admin_user_show_url(request.user)) + link_to(internal_text || request.user.name, admin_user_show_url(request.user)) end end @@ -279,13 +279,58 @@ module LinkToHelper end end - # Basic date format - def simple_date(date) + # Public: Usually-correct format for a DateTime-ish object + # To define a new new format define the `simple_date_{FORMAT}` method + # + # date - a DateTime, Date or Time + # opts - a Hash of options (default: { format: :html}) + # :format - :html returns a HTML <time> tag + # :text returns a plain String + # + # Examples + # + # simple_date(Time.now) + # # => "<time>..." + # + # simple_date(Time.now, :format => :text) + # # => "March 10, 2014" + # + # Returns a String + # Raises ArgumentError if the format is unrecognized + def simple_date(date, opts = {}) + opts = { :format => :html }.merge(opts) + date_formatter = "simple_date_#{ opts[:format] }" + + if respond_to?(date_formatter) + send(date_formatter, date) + else + raise ArgumentError, "Unrecognised format :#{ opts[:format] }" + end + end + + # Usually-correct HTML formatting of a DateTime-ish object + # Use LinkToHelper#simple_date with desired formatting options + # + # date - a DateTime, Date or Time + # + # Returns a String + def simple_date_html(date) + date = date.in_time_zone unless date.is_a? Date + time_tag date, simple_date_text(date), :title => date.to_s + end + + # Usually-correct plain text formatting of a DateTime-ish object + # Use LinkToHelper#simple_date with desired formatting options + # + # date - a DateTime, Date or Time + # + # Returns a String + def simple_date_text(date) date = date.in_time_zone.to_date unless date.is_a? Date date_format = _("simple_date_format") date_format = :long if date_format == "simple_date_format" - return I18n.l(date, :format => date_format) + I18n.l(date, :format => date_format) end def simple_time(date) diff --git a/app/helpers/track_helper.rb b/app/helpers/track_helper.rb new file mode 100644 index 000000000..ca698926c --- /dev/null +++ b/app/helpers/track_helper.rb @@ -0,0 +1,122 @@ +module TrackHelper + + def already_subscribed_notice(track_thing) + case track_thing.track_type + when 'request_updates' + _("You are already subscribed to '{{link_to_request}}', a request.", + :link_to_request => request_link(track_thing.info_request)) + when 'all_new_requests' + _('You are already subscribed to any <a href="{{new_requests_url}}">new requests</a>.', + :new_requests_url => request_list_path) + when 'all_successful_requests' + _('You are already subscribed to any <a href="{{successful_requests_url}}">successful requests</a>.', + :successful_requests_url => request_list_successful_path ) + when 'public_body_updates' + _("You are already subscribed to '{{link_to_authority}}', a public authority.", + :link_to_authority => public_body_link(track_thing.public_body)) + when 'user_updates' + _("You are already subscribed to '{{link_to_user}}', a person.", + :link_to_user => user_link(track_thing.tracked_user)) + when 'search_query' + _('You are already subscribed to <a href="{{search_url}}">this search</a>.', + :search_url => search_path([track_thing.track_query, 'newest', 'advanced'])) + end + end + + def subscribe_email_notice(track_thing) + case track_thing.track_type + when 'request_updates' + _("You will now be emailed updates about '{{link_to_request}}', a request.", + :link_to_request => request_link(track_thing.info_request)) + when 'all_new_requests' + _('You will now be emailed updates about any <a href="{{new_requests_url}}">new requests</a>.', + :new_requests_url => request_list_path) + when 'all_successful_requests' + _('You will now be emailed updates about <a href="{{successful_requests_url}}">successful requests</a>.', + :successful_requests_url => request_list_successful_path ) + when 'public_body_updates' + _("You will now be emailed updates about '{{link_to_authority}}', a public authority.", + :link_to_authority => public_body_link(track_thing.public_body)) + when 'user_updates' + _("You will now be emailed updates about '{{link_to_user}}', a person.", + :link_to_user => user_link(track_thing.tracked_user)) + when 'search_query' + _("You will now be emailed updates about <a href=\"{{search_url}}\">this search</a>.", + :search_url => search_path([track_thing.track_query, 'newest', 'advanced'])) + end + end + + def subscribe_follow_notice(track_thing) + wall_url_user = show_user_wall_path(:url_name => track_thing.tracking_user.url_name) + case track_thing.track_type + when 'request_updates' + _('You are now <a href="{{wall_url_user}}">following</a> updates about \'{{link_to_request}}\', a request.', + :link_to_request => request_link(track_thing.info_request), + :wall_url_user => wall_url_user) + when 'all_new_requests' + _('You are now <a href="{{wall_url_user}}">following</a> updates about <a href="{{new_requests_url}}">new requests</a>.', + :new_requests_url => request_list_path, + :wall_url_user => wall_url_user) + when 'all_successful_requests' + _('You are now <a href="{{wall_url_user}}">following</a> updates about <a href="{{successful_requests_url}}">successful requests</a>.', + :successful_requests_url => request_list_successful_path, + :wall_url_user => wall_url_user) + when 'public_body_updates' + _('You are now <a href="{{wall_url_user}}">following</a> updates about \'{{link_to_authority}}\', a public authority.', + :wall_url_user => wall_url_user, + :link_to_authority => public_body_link(track_thing.public_body)) + when 'user_updates' + _('You are now <a href="{{wall_url_user}}">following</a> updates about \'{{link_to_user}}\', a person.', + :wall_url_user => wall_url_user, + :link_to_user => user_link(track_thing.tracked_user)) + when 'search_query' + _('You are now <a href="{{wall_url_user}}">following</a> updates about <a href="{{search_url}}">this search</a>.', + :wall_url_user => wall_url_user, + :search_url => search_path([track_thing.track_query, 'newest', 'advanced'])) + end + end + + def unsubscribe_notice(track_thing) + case track_thing.track_type + when 'request_updates' + _("You are no longer following '{{link_to_request}}', a request.", + :link_to_request => request_link(track_thing.info_request)) + when 'all_new_requests' + _('You are no longer following <a href="{{new_requests_url}}">new requests</a>.', + :new_requests_url => request_list_path) + when 'all_successful_requests' + _('You are no longer following <a href="{{successful_requests_url}}">successful requests</a>.', + :successful_requests_url => request_list_successful_path ) + when 'public_body_updates' + _("You are no longer following '{{link_to_authority}}', a public authority.", + :link_to_authority => public_body_link(track_thing.public_body)) + when 'user_updates' + _("You are no longer following '{{link_to_user}}', a person.", + :link_to_user => user_link(track_thing.tracked_user)) + when 'search_query' + _('You are no longer following <a href="{{search_url}}">this search</a>.', + :search_url => search_path([track_thing.track_query, 'newest', 'advanced'])) + end + end + + def track_description(track_thing) + case track_thing.track_type + when 'request_updates' + _("'{{link_to_request}}', a request", + :link_to_request => request_link(track_thing.info_request)) + when 'all_new_requests' + link_to(_('new requests'), request_list_path) + when 'all_successful_requests' + link_to(_('successful requests'), request_list_successful_path) + when 'public_body_updates' + _("'{{link_to_authority}}', a public authority", + :link_to_authority => public_body_link(track_thing.public_body)) + when 'user_updates' + _("'{{link_to_user}}', a person", + :link_to_user => user_link(track_thing.tracked_user)) + when 'search_query' + link_to(track_thing.track_query_description, + search_path([track_thing.track_query, 'newest', 'advanced'])) + end + end +end diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb index af1a75df9..1fd5b9ba7 100644 --- a/app/mailers/request_mailer.rb +++ b/app/mailers/request_mailer.rb @@ -250,7 +250,7 @@ class RequestMailer < ApplicationMailer if reply_info_requests.size == 0 reason = _("Could not identify the request from the email address") request = InfoRequest.holding_pen_request - request.receive(email, raw_email, false, reason) + request.receive(email, raw_email, false, reason) unless SpamAddress.spam?(email.to) return end diff --git a/app/models/contact_validator.rb b/app/models/contact_validator.rb index 65e539669..e9a6e491c 100644 --- a/app/models/contact_validator.rb +++ b/app/models/contact_validator.rb @@ -7,7 +7,7 @@ class ContactValidator include ActiveModel::Validations - attr_accessor :name, :email, :subject, :message + attr_accessor :name, :email, :subject, :message, :comment validates_presence_of :name, :message => N_("Please enter your name") validates_presence_of :email, :message => N_("Please enter your email address") diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb index ecd4a1872..6f198249a 100644 --- a/app/models/foi_attachment.rb +++ b/app/models/foi_attachment.rb @@ -292,83 +292,10 @@ class FoiAttachment < ActiveRecord::Base end # For "View as HTML" of attachment - def body_as_html(dir) - html = nil - wrapper_id = "wrapper" - - # simple cases, can never fail - if self.content_type == 'text/plain' - text = self.body.strip - text = CGI.escapeHTML(text) - text = MySociety::Format.make_clickable(text) - html = text.gsub(/\n/, '<br>') - return '<!DOCTYPE html><html><head><title></title></head><body>' + html + "</body></html>", wrapper_id - end - - # the extractions will also produce image files, which go in the - # current directory, so change to the directory the function caller - # wants everything in - - html = nil - if ['application/pdf', 'application/rtf'].include?(self.content_type) - text = self.body - Dir.chdir(dir) do - if RUBY_VERSION.to_f >= 1.9 - tempfile = Tempfile.new('foiextract', '.', :encoding => text.encoding) - else - tempfile = Tempfile.new('foiextract', '.') - end - tempfile.print text - tempfile.flush - - - if self.content_type == 'application/pdf' - # We set a timeout here, because pdftohtml can spiral out of control - # on some PDF files and we don't want to crash the whole server. - html = AlaveteliExternalCommand.run("pdftohtml", "-nodrm", "-zoom", "1.0", "-stdout", "-enc", "UTF-8", "-noframes", tempfile.path, :timeout => 30) - elsif self.content_type == 'application/rtf' - html = AlaveteliExternalCommand.run("unrtf", "--html", tempfile.path, :timeout => 120) - end - - tempfile.close - tempfile.delete - end - end - if html.nil? - if self.has_google_docs_viewer? - html = '' # force error and using Google docs viewer - else - raise "No HTML conversion available for type " + self.content_type - end - end - - - - # We need to look at: - # a) Any error code - # b) The output size, as pdftohtml does not return an error code upon error. - # c) For cases when there is no text in the body of the HTML, or - # images, so nothing will be rendered. This is to detect some bug in - # pdftohtml, which sometimes makes it return just <hr>s and no other - # content. - html.match(/(\<body[^>]*\>.*)/mi) - body = $1.to_s - body_without_tags = body.gsub(/\s+/,"").gsub(/\<[^\>]*\>/, "") - contains_images = html.match(/<img/mi) ? true : false - if html.size == 0 || !$?.success? || (body_without_tags.size == 0 && !contains_images) - ret = "<html><head></head><body>"; - if self.has_google_docs_viewer? - wrapper_id = "wrapper_google_embed" - protocol = AlaveteliConfiguration::force_ssl ? 'https' : 'http' - ret = ret + "<iframe src='#{protocol}://docs.google.com/viewer?url=<attachment-url-here>&embedded=true' width='100%' height='100%' style='border: none;'></iframe>"; - else - ret = ret + "<p>Sorry, we were unable to convert this file to HTML. Please use the download link at the top right.</p>" - end - ret = ret + "</body></html>" - return ret, wrapper_id - end - - return html, wrapper_id + def body_as_html(dir, opts = {}) + attachment_url = opts.fetch(:attachment_url, nil) + to_html_opts = opts.merge(:tmpdir => dir, :attachment_url => attachment_url) + AttachmentToHTML.to_html(self, to_html_opts) end end diff --git a/app/models/info_request_batch.rb b/app/models/info_request_batch.rb index 498ab4951..d7c5eb9af 100644 --- a/app/models/info_request_batch.rb +++ b/app/models/info_request_batch.rb @@ -1,13 +1,14 @@ # == Schema Information -# Schema version: 20131024114346 # # Table name: info_request_batches # # id :integer not null, primary key # title :text not null # user_id :integer not null -# created_at :datetime -# updated_at :datetime +# created_at :datetime not null +# updated_at :datetime not null +# body :text +# sent_at :datetime # class InfoRequestBatch < ActiveRecord::Base diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 7b1ded820..03ec270ee 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -6,7 +6,7 @@ # # id :integer not null, primary key # name :text not null -# short_name :text not null +# short_name :text default(""), not null # request_email :text not null # version :integer not null # last_edit_editor :string(255) not null @@ -37,7 +37,8 @@ class PublicBody < ActiveRecord::Base validates_presence_of :name, :message => N_("Name can't be blank") validates_presence_of :url_name, :message => N_("URL name can't be blank") - validates_uniqueness_of :short_name, :message => N_("Short name is already taken"), :if => Proc.new { |pb| pb.short_name != "" } + validates_uniqueness_of :short_name, :message => N_("Short name is already taken"), :allow_blank => true + validates_uniqueness_of :url_name, :message => N_("URL name is already taken") validates_uniqueness_of :name, :message => N_("Name is already taken") validate :request_email_if_requestable @@ -59,6 +60,34 @@ class PublicBody < ActiveRecord::Base translates :name, :short_name, :request_email, :url_name, :notes, :first_letter, :publication_scheme + # Public: Search for Public Bodies whose name, short_name, request_email or + # tags contain the given query + # + # query - String to query the searchable fields + # locale - String to specify the language of the seach query + # (default: I18n.locale) + # + # Returns an ActiveRecord::Relation + def self.search(query, locale = I18n.locale) + locale = locale.to_s.gsub('-', '_') # Clean the locale string + + sql = <<-SQL + ( + lower(public_body_translations.name) like lower('%'||?||'%') + OR lower(public_body_translations.short_name) like lower('%'||?||'%') + OR lower(public_body_translations.request_email) like lower('%'||?||'%' ) + OR lower(has_tag_string_tags.name) like lower('%'||?||'%' ) + ) + AND has_tag_string_tags.model_id = public_bodies.id + AND has_tag_string_tags.model = 'PublicBody' + AND (public_body_translations.locale = ?) + SQL + + PublicBody.joins(:translations, :tags). + where([sql, query, query, query, query, locale]). + uniq + end + # Convenience methods for creating/editing translations via forms def find_translation_by_locale(locale) self.translations.find_by_locale(locale) @@ -505,7 +534,15 @@ class PublicBody < ActiveRecord::Base public_body.publication_scheme = public_body.publication_scheme || "" public_body.last_edit_editor = editor public_body.last_edit_comment = 'Created from spreadsheet' - public_body.save! + + begin + public_body.save! + rescue ActiveRecord::RecordInvalid + public_body.errors.full_messages.each do |msg| + errors.push "error: line #{ line }: #{ msg } for authority '#{ name }'" + end + next + end end end end diff --git a/app/models/request_classification.rb b/app/models/request_classification.rb index 6873d468b..478a543d3 100644 --- a/app/models/request_classification.rb +++ b/app/models/request_classification.rb @@ -5,8 +5,8 @@ # id :integer not null, primary key # user_id :integer # info_request_event_id :integer -# created_at :datetime -# updated_at :datetime +# created_at :datetime not null +# updated_at :datetime not null # class RequestClassification < ActiveRecord::Base diff --git a/app/models/spam_address.rb b/app/models/spam_address.rb new file mode 100644 index 000000000..2c84beaa0 --- /dev/null +++ b/app/models/spam_address.rb @@ -0,0 +1,21 @@ +# == Schema Information +# +# Table name: spam_addresses +# +# id :integer not null, primary key +# email :string(255) not null +# created_at :datetime not null +# updated_at :datetime not null +# + +class SpamAddress < ActiveRecord::Base + attr_accessible :email + + validates_presence_of :email, :message => 'Please enter the email address to mark as spam' + validates_uniqueness_of :email, :message => 'This address is already marked as spam' + + def self.spam?(email_address) + exists?(:email => email_address) + end + +end diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb index d5dda7bb5..13b6f78dd 100644 --- a/app/models/track_thing.rb +++ b/app/models/track_thing.rb @@ -69,66 +69,30 @@ class TrackThing < ActiveRecord::Base end def track_query_description - # XXX this is very brittle... we should probably ask users - # simply to name their tracks when they make them? - original_text = parsed_text = self.track_query.gsub(/([()]|OR)/, "") - filters = parsed_text.scan /\b\S+:\S+\b/ - varieties = Set.new - date = "" - statuses = Set.new - for filter in filters - parsed_text = parsed_text.sub(filter, "") - if filter =~ /variety:user/ - varieties << _("users") - end - if filter =~ /variety:comment/ - varieties << _("comments") - end - if filter =~ /variety:authority/ - varieties << _("authorities") - end - if filter =~ /(variety:(sent|followup_sent|response)|latest_status)/ - varieties << _("requests") - end - if filter =~ /[0-9\/]+\.\.[0-9\/]+/ - date = _("between two dates") - end - if filter =~ /(rejected|not_held)/ - statuses << _("unsuccessful") - end - if filter =~ /(:successful|:partially_successful)/ - statuses << _("successful") - end - if filter =~ /waiting/ - statuses << _("awaiting a response") - end - end - if filters.empty? - parsed_text = original_text - end - descriptions = [] - if varieties.include? _("requests") - if statuses.empty? - # HACK: Relies on the 'descriptions.sort' below to luckily put this first - descriptions << _("all requests") + filter_description = query_filter_description('(variety:sent OR variety:followup_sent OR variety:response OR variety:comment)', + :no_query => N_("all requests or comments"), + :query => N_("all requests or comments matching text '{{query}}'")) + return filter_description if filter_description + filter_description = query_filter_description('(latest_status:successful OR latest_status:partially_successful)', + :no_query => N_("requests which are successful"), + :query => N_("requests which are successful matching text '{{query}}'")) + return filter_description if filter_description + return _("anything matching text '{{query}}'", :query => track_query) + end + + # Return a readable query description for queries involving commonly used filter clauses + def query_filter_description(string, options) + parsed_query = track_query.gsub(string, '') + if parsed_query != track_query + parsed_query.strip! + if parsed_query.empty? + _(options[:no_query]) else - descriptions << _("requests which are {{list_of_statuses}}", :list_of_statuses => Array(statuses).sort.join(_(' or '))) + _(options[:query], :query => parsed_query) end - varieties -= [_("requests")] end - if descriptions.empty? and varieties.empty? - varieties << _("anything") - end - descriptions += Array(varieties) - parsed_text = parsed_text.strip - descriptions = descriptions.sort.join(_(" or ")) - if !parsed_text.empty? - descriptions += _("{{list_of_things}} matching text '{{search_query}}'", :list_of_things => "", :search_query => parsed_text) - end - return descriptions end - def TrackThing.create_track_for_request(info_request) track_thing = TrackThing.new track_thing.track_type = 'request_updates' @@ -194,30 +158,32 @@ class TrackThing < ActiveRecord::Base end # Return hash of text parameters describing the request etc. - include LinkToHelper def params if @params.nil? if self.track_type == 'request_updates' @params = { # Website - :list_description => _("'{{link_to_request}}', a request", - :link_to_request => ("<a href=\"/request/" + CGI.escapeHTML(self.info_request.url_title) + "\">" + CGI.escapeHTML(self.info_request.title) + "</a>").html_safe), # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how + :verb_on_page => _("Follow this request"), :verb_on_page_already => _("You are already following this request"), # Email - :title_in_email => _("New updates for the request '{{request_title}}'", :request_title => self.info_request.title.html_safe), - :title_in_rss => _("New updates for the request '{{request_title}}'", :request_title => self.info_request.title), + :title_in_email => _("New updates for the request '{{request_title}}'", + :request_title => self.info_request.title.html_safe), + :title_in_rss => _("New updates for the request '{{request_title}}'", + :request_title => self.info_request.title), # Authentication - :web => _("To follow the request '{{request_title}}'", :request_title => CGI.escapeHTML(self.info_request.title)), - :email => _("Then you will be updated whenever the request '{{request_title}}' is updated.", :request_title => CGI.escapeHTML(self.info_request.title)), - :email_subject => _("Confirm you want to follow the request '{{request_title}}'", :request_title => self.info_request.title), + :web => _("To follow the request '{{request_title}}'", + :request_title => self.info_request.title), + :email => _("Then you will be updated whenever the request '{{request_title}}' is updated.", + :request_title => self.info_request.title), + :email_subject => _("Confirm you want to follow the request '{{request_title}}'", + :request_title => self.info_request.title), # RSS sorting :feed_sortby => 'newest' } elsif self.track_type == 'all_new_requests' @params = { # Website - :list_description => _("any <a href=\"/list\">new requests</a>"), :verb_on_page => _("Follow all new requests"), :verb_on_page_already => _("You are already following new requests"), # Email @@ -233,7 +199,6 @@ class TrackThing < ActiveRecord::Base elsif self.track_type == 'all_successful_requests' @params = { # Website - :list_description => _("any <a href=\"/list/successful\">successful requests</a>"), :verb_on_page => _("Follow new successful responses"), :verb_on_page_already => _("You are following all new successful responses"), # Email @@ -252,39 +217,51 @@ class TrackThing < ActiveRecord::Base elsif self.track_type == 'public_body_updates' @params = { # Website - :list_description => _("'{{link_to_authority}}', a public authority", :link_to_authority => ("<a href=\"/body/" + CGI.escapeHTML(self.public_body.url_name) + "\">" + CGI.escapeHTML(self.public_body.name) + "</a>").html_safe), # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how - :verb_on_page => _("Follow requests to {{public_body_name}}",:public_body_name=>CGI.escapeHTML(self.public_body.name)), - :verb_on_page_already => _("You are already following requests to {{public_body_name}}", :public_body_name=>CGI.escapeHTML(self.public_body.name)), + :verb_on_page => _("Follow requests to {{public_body_name}}", + :public_body_name => self.public_body.name), + :verb_on_page_already => _("You are already following requests to {{public_body_name}}", + :public_body_name => self.public_body.name), # Email - :title_in_email => self.public_body.law_only_short + " requests to '" + self.public_body.name + "'", - :title_in_rss => self.public_body.law_only_short + " requests to '" + self.public_body.name + "'", + :title_in_email => _("{{foi_law}} requests to '{{public_body_name}}'", + :foi_law => self.public_body.law_only_short, + :public_body_name => self.public_body.name), + :title_in_rss => _("{{foi_law}} requests to '{{public_body_name}}'", + :foi_law => self.public_body.law_only_short, + :public_body_name => self.public_body.name), # Authentication - :web => _("To follow requests made using {{site_name}} to the public authority '{{public_body_name}}'", :site_name=>AlaveteliConfiguration::site_name, :public_body_name=>CGI.escapeHTML(self.public_body.name)), - :email => _("Then you will be notified whenever someone requests something or gets a response from '{{public_body_name}}'.", :public_body_name=>CGI.escapeHTML(self.public_body.name)), - :email_subject => _("Confirm you want to follow requests to '{{public_body_name}}'", :public_body_name=>self.public_body.name), + :web => _("To follow requests made using {{site_name}} to the public authority '{{public_body_name}}'", + :site_name => AlaveteliConfiguration::site_name, + :public_body_name => self.public_body.name), + :email => _("Then you will be notified whenever someone requests something or gets a response from '{{public_body_name}}'.", + :public_body_name => self.public_body.name), + :email_subject => _("Confirm you want to follow requests to '{{public_body_name}}'", + :public_body_name => self.public_body.name), # RSS sorting :feed_sortby => 'newest' } elsif self.track_type == 'user_updates' @params = { # Website - :list_description => _("'{{link_to_user}}', a person", :link_to_user => ("<a href=\"/user/" + CGI.escapeHTML(self.tracked_user.url_name) + "\">" + CGI.escapeHTML(self.tracked_user.name) + "</a>").html_safe), # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how :verb_on_page => _("Follow this person"), :verb_on_page_already => _("You are already following this person"), # Email - :title_in_email => _("FOI requests by '{{user_name}}'", :user_name=>self.tracked_user.name.html_safe), - :title_in_rss => _("FOI requests by '{{user_name}}'", :user_name=>self.tracked_user.name), + :title_in_email => _("FOI requests by '{{user_name}}'", + :user_name => self.tracked_user.name.html_safe), + :title_in_rss => _("FOI requests by '{{user_name}}'", + :user_name => self.tracked_user.name), # Authentication - :web => _("To follow requests by '{{user_name}}'", :user_name=>CGI.escapeHTML(self.tracked_user.name)), - :email => _("Then you will be notified whenever '{{user_name}}' requests something or gets a response.", :user_name=>CGI.escapeHTML(self.tracked_user.name)), - :email_subject => _("Confirm you want to follow requests by '{{user_name}}'", :user_name=>self.tracked_user.name), + :web => _("To follow requests by '{{user_name}}'", + :user_name=> self.tracked_user.name), + :email => _("Then you will be notified whenever '{{user_name}}' requests something or gets a response.", + :user_name => self.tracked_user.name), + :email_subject => _("Confirm you want to follow requests by '{{user_name}}'", + :user_name => self.tracked_user.name), # RSS sorting :feed_sortby => 'newest' } elsif self.track_type == 'search_query' @params = { # Website - :list_description => ("<a href=\"/search/" + CGI.escapeHTML(self.track_query) + "/newest/advanced\">" + CGI.escapeHTML(self.track_query_description) + "</a>").html_safe, # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how :verb_on_page => _("Follow things matching this search"), :verb_on_page_already => _("You are already following things matching this search"), # Email diff --git a/app/models/user.rb b/app/models/user.rb index e63ce8129..d75622b37 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,26 +1,25 @@ # == Schema Information -# Schema version: 20131024114346 # # Table name: users # -# id :integer not null, primary key -# email :string(255) not null -# name :string(255) not null -# hashed_password :string(255) not null -# salt :string(255) not null -# created_at :datetime not null -# updated_at :datetime not null -# email_confirmed :boolean default(FALSE), not null -# url_name :text not null -# last_daily_track_email :datetime default(2000-01-01 00:00:00 UTC) -# admin_level :string(255) default("none"), not null -# ban_text :text default(""), not null -# about_me :text default(""), not null -# locale :string(255) -# email_bounced_at :datetime -# email_bounce_message :text default(""), not null -# no_limit :boolean default(FALSE), not null -# receive_email_alerts :boolean default(TRUE), not null +# id :integer not null, primary key +# email :string(255) not null +# name :string(255) not null +# hashed_password :string(255) not null +# salt :string(255) not null +# created_at :datetime not null +# updated_at :datetime not null +# email_confirmed :boolean default(FALSE), not null +# url_name :text not null +# last_daily_track_email :datetime default(Sat Jan 01 00:00:00 UTC 2000) +# admin_level :string(255) default("none"), not null +# ban_text :text default(""), not null +# about_me :text default(""), not null +# locale :string(255) +# email_bounced_at :datetime +# email_bounce_message :text default(""), not null +# no_limit :boolean default(FALSE), not null +# receive_email_alerts :boolean default(TRUE), not null # can_make_batch_requests :boolean default(FALSE), not null # diff --git a/app/views/admin_public_body/import_csv.html.erb b/app/views/admin_public_body/import_csv.html.erb index 18341ecf1..d15ef1791 100644 --- a/app/views/admin_public_body/import_csv.html.erb +++ b/app/views/admin_public_body/import_csv.html.erb @@ -36,23 +36,35 @@ %> </p> - <p><strong>CSV file format:</strong>The first row should be a list - of fields, starting with '#'. The fields 'name' and - 'request_email' are required; additionally, translated values are + <p><strong>CSV file format:</strong> The first row should be a list + of fields, starting with <code>#</code>. The fields <code>name</code> and + <code>request_email</code> are required; additionally, translated values are supported by adding the locale name to the field name, - e.g. 'name.es', 'name.de'... Example: + e.g. <code>name.es</code>, <code>name.de</code>…<br /> + <strong>Example:</strong> </p> - <blockquote> - <p> - #id,name,request_email,name.es,tag_string<br/> - 1,An Authority,a@example.com,Un organismo,a_tag another_tag<br/> - 2,Another One,another@example.com,Otro organismo,a_tag<br/> - <p> - </blockquote> + <pre> +#name,request_email,name.es,tag_string +An Authority,a@example.com,Un organismo,a_tag another_tag +Another One,another@example.com,Otro organismo,a_tag + </pre> - <p>Supported fields: name (i18n), short_name (i18n), request_email (i18n), notes (i18n), - publication_scheme (i18n), disclosure_log (i18n), home_page, tag_string (tags separated by spaces).</p> + <p><strong>Supported fields:</strong> + <ul> + <li> + <code>name</code> (i18n) + <strong>Existing records cannot be renamed</strong> + </li> + <li><code>short_name</code> (i18n)</li> + <li><code>request_email</code> (i18n)</li> + <li><code>notes</code> (i18n)</li> + <li><code>publication_scheme</code> (i18n)</li> + <li><code>disclosure_log</code> (i18n)</li> + <li><code>home_page</code></li> + <li><code>tag_string</code> (tags separated by spaces)</li> + </ul> + </p> <p><strong>Note:</strong> Choose <strong>dry run</strong> to test, without actually altering the database. Choose <strong>upload</strong> to actually diff --git a/app/views/admin_request/_incoming_message_actions.html.erb b/app/views/admin_request/_incoming_message_actions.html.erb index 4cf099b53..dd50eb047 100644 --- a/app/views/admin_request/_incoming_message_actions.html.erb +++ b/app/views/admin_request/_incoming_message_actions.html.erb @@ -22,6 +22,13 @@ </div> </div> + <div class="control-group"> + <label class="control-label">Mark <code>To:</code> address as spam</label> + <div class="controls"> + <%= link_to 'Spam Addresses', spam_addresses_path %> + </div> + </div> + <%= form_tag admin_incoming_destroy_path, :class => "form form-inline" do %> <div class="control-group"> <label class="control-label" for="destroy_message_<%= incoming_message.id %>">Destroy message</label> diff --git a/app/views/admin_request/_some_annotations.html.erb b/app/views/admin_request/_some_annotations.html.erb index dfd46f828..7adcdc5bb 100644 --- a/app/views/admin_request/_some_annotations.html.erb +++ b/app/views/admin_request/_some_annotations.html.erb @@ -1,48 +1,61 @@ -<% if comments.size > 0 %> - <div class="accordion" id="comments"> - <% for comment in comments %> - <div class="accordion-group"> - <div class="accordion-heading"> - <a href="#comment_<%=comment.id%>" data-toggle="collapse" data-parent="#comments"><%= chevron_right %></a> - <%= link_to admin_request_edit_comment_path(comment) do %> - #<%=comment.id%> - -- - <%=h(comment.user.name)%> - <%=admin_value(comment.created_at)%> +<% if comments.any? %> + <%= form_tag admin_user_modify_comment_visibility_path do %> + <div class="accordion" id="comments"> + <% comments.each do |comment| %> + <div class="accordion-group"> + <div class="accordion-heading"> + <%= check_box_tag 'comment_ids[]', comment.id %> + + <a href="#comment_<%= comment.id %>" data-toggle="collapse" data-parent="#comments"><%= chevron_right %></a> + + <%= link_to admin_request_edit_comment_path(comment) do %> + #<%= comment.id %> + -- + <%= h(comment.user.name) %> + <%= admin_value(comment.created_at) %> <% end %> - <blockquote class="incoming-message"> - <%= truncate(comment.body, :length => 400) %> - </blockquote> - </div> - <div id="comment_<%=comment.id%>" class="accordion-body collapse"> - <table class="table table-striped table-condensed"> - <tbody> - <tr> - <td colspan="2"> - By <%= user_both_links(comment.user) %> - </td> - </tr> - <% comment.for_admin_column do |name, value, type, column_name |%> + + <%= comment_visibility(comment) %> + + <blockquote class="incoming-message"> + <%= truncate(comment.body, :length => 400) %> + </blockquote> + </div> + + <div id="comment_<%= comment.id %>" class="accordion-body collapse"> + <table class="table table-striped table-condensed"> + <tbody> <tr> - <td> - <b><%=name%></b> - </td> - <td> - <% if column_name == 'body' && !comment.visible %> - <s><%=h comment.send(column_name) %></s> - <% else %> - <%=h comment.send(column_name) %> - <% end %> + <td colspan="2"> + By <%= user_both_links(comment.user) %> </td> </tr> - <% end %> - </tbody> - </table> + <% comment.for_admin_column do |name, value, type, column_name |%> + <tr> + <td> + <b><%= name %></b> + </td> + <td> + <% if column_name == 'body' && !comment.visible %> + <s><%= h comment.send(column_name) %></s> + <% else %> + <%= h comment.send(column_name) %> + <% end %> + </td> + </tr> + <% end %> + </tbody> + </table> + </div> + </div> - </div> - <% end %> - </div> + <% end %> + </div> + + <%= submit_tag 'Hide selected', :name => 'hide_selected' %> + <%= submit_tag 'Unhide selected', :name => 'unhide_selected' %> + + <% end %> <% else %> <p>None yet.</p> -<% end %> - +<% end %> diff --git a/app/views/admin_request/show.html.erb b/app/views/admin_request/show.html.erb index 2589e52b4..9c04badeb 100644 --- a/app/views/admin_request/show.html.erb +++ b/app/views/admin_request/show.html.erb @@ -118,7 +118,7 @@ </label> <div class="controls"> <%= link_to 'Generate URL', admin_request_generate_upload_url_path(@info_request), :class => "btn" %> - <p class="help-block">(see also option to general URLs for individual incoming messages below)</p> + <p class="help-block">(see also option to generate URLs for individual incoming messages below)</p> </div> </div> <%= form_tag admin_request_hide_path(@info_request), :class => "form form-inline", :id => "hide_request_form", 'data-info-request-id' => @info_request.id.to_s do %> diff --git a/app/views/admin_spam_addresses/index.html.erb b/app/views/admin_spam_addresses/index.html.erb new file mode 100644 index 000000000..9846bc017 --- /dev/null +++ b/app/views/admin_spam_addresses/index.html.erb @@ -0,0 +1,51 @@ +<% @title = 'Spam Addresses' %> + +<h1><%= @title %></h1> + +<div class="row"> + <div class="span12"> + <p> + Incoming mail that gets redirected to the holding pen will be + rejected if it is sent <code>To:</code> an address on this + list. + </p> + </div> +</div> + +<hr /> + +<div class="row"> + <div class="span12"> + <%= form_for(@spam_address, :html => { :class => 'form-inline' }) do |f| -%> + <%= error_messages_for @spam_address %> + <%= f.text_field :email, :class => 'input-xxlarge', :placeholder => 'Enter email' %> + <%= f.submit 'Add Spam Address', :class => 'btn btn-warning' %> + <% end -%> + </div> +</div> + +<hr /> + +<% if @spam_addresses.any? %> + <div class="row"> + <table class="table table-hover span12"> + <thead> + <tr> + <th>Email</th> + <th></th> + </tr> + </thead> + <tbody> + <% @spam_addresses.each do |spam| %> + <tr> + <td><%= spam.email %></td> + <td><%= link_to 'Remove', spam, + :method => :delete, + :confirm => 'This is permanent! Are you sure?', + :class => 'btn btn-mini btn-danger' %></td> + </tr> + <% end %> + </tbody> + </table> + </div> +<% end %> diff --git a/app/views/comment/_single_comment.html.erb b/app/views/comment/_single_comment.html.erb index a6d234b34..cdcb3b85f 100644 --- a/app/views/comment/_single_comment.html.erb +++ b/app/views/comment/_single_comment.html.erb @@ -9,9 +9,8 @@ <%# When not logged in, but mid-comment-leaving, there'll be no comment.user %> <%= comment.user ? user_link(comment.user) : _("You") %> <%= _("left an annotation") %> (<%= simple_date(comment.created_at || Time.now) %>) </h2> - <div class="comment_in_request_text"> + <div class="comment_in_request_text"> <p> - <%= image_tag "quote-marks.png", :class => "comment_quote" %> <%= comment.get_body_for_html_display %> </p> </div> diff --git a/app/views/comment/_single_comment.text.erb b/app/views/comment/_single_comment.text.erb index 925e8b688..4932a7e4a 100644 --- a/app/views/comment/_single_comment.text.erb +++ b/app/views/comment/_single_comment.text.erb @@ -1,2 +1,2 @@ -<%= _("{{username}} left an annotation:", :username =>comment.user.name) %> (<%= simple_date(comment.created_at || Time.now) %>) +<%= _("{{username}} left an annotation:", :username =>comment.user.name) %> (<%= simple_date((comment.created_at || Time.now), :format => :text) %>) <%= comment.body.strip %> diff --git a/app/views/general/_responsive_credits.html.erb b/app/views/general/_responsive_credits.html.erb new file mode 100644 index 000000000..01a5df13a --- /dev/null +++ b/app/views/general/_responsive_credits.html.erb @@ -0,0 +1,2 @@ +<li><%= _('Powered by <a href="http://www.alaveteli.org/">Alaveteli</a>') %> +</li> diff --git a/app/views/general/_responsive_footer.html.erb b/app/views/general/_responsive_footer.html.erb new file mode 100644 index 000000000..2967872f1 --- /dev/null +++ b/app/views/general/_responsive_footer.html.erb @@ -0,0 +1,15 @@ +<div class="footer" id="footer"> + <div id="footer-nav"> + <ul> + <li><%= link_to image_tag('logo.png'), frontpage_path, :id => 'logo' %></li> + <li><%= link_to _("Contact {{site_name}}", :site_name => site_name), help_contact_path %></li> + <% unless AlaveteliConfiguration::twitter_username.blank? %> + <li><a href="https://twitter.com/<%= AlaveteliConfiguration::twitter_username %>"><%= _("Follow us on twitter") %></a></li> + <% end %> + + <%= render :partial => 'general/responsive_credits' %> + + </ul> + + </div> +</div> diff --git a/app/views/general/_responsive_header.html.erb b/app/views/general/_responsive_header.html.erb new file mode 100644 index 000000000..3a2994b4d --- /dev/null +++ b/app/views/general/_responsive_header.html.erb @@ -0,0 +1,31 @@ +<div id="banner"> + <div id="banner_inner"> + <div id="banner_content"> + <div id="logo_wrapper"> + <%= link_to image_tag('logo.png'), frontpage_path, :id => 'logo' %> + </div> + <div class="rsp_menu_button"> + <a href="#banner" class="open"> <i class="icon-menu"></i> Menu </a> + <a href="#" class="close"> <i class="icon-menu"></i> Close </a> + </div> + <%= render :partial => 'general/locale_switcher' %> + <% if ! (controller.action_name == 'signin' or controller.action_name == 'signup') %> + <div id="logged_in_bar"> + <div id="logged_in_links"> + <% if @user %> + <span class="greeting"><%= _('Hello, {{username}}!', :username => @user.name) %></span> + <%=link_to _("My requests"), show_user_requests_path(:url_name => @user.url_name) %> + <%=link_to _("My profile"), show_user_profile_path(:url_name => @user.url_name) %> + <%=link_to _("My wall"), show_user_wall_path(:url_name => @user.url_name) %> + <%= link_to _("Sign out"), signout_path(:r => request.fullpath) %> + <% else %> + <%= link_to _("Sign in or sign up"), signin_path(:r => request.fullpath) %> + <% end %> + </div> + </div> + <% end %> + </div> + <%= render :partial => 'general/responsive_topnav' %> + </div> +</div> + diff --git a/app/views/general/_responsive_stylesheets.html.erb b/app/views/general/_responsive_stylesheets.html.erb new file mode 100644 index 000000000..e3c3660c4 --- /dev/null +++ b/app/views/general/_responsive_stylesheets.html.erb @@ -0,0 +1,11 @@ +<!--[if LTE IE 7]> +<%= stylesheet_link_tag 'responsive/application-lte-ie7', :title => "Main", :rel => "stylesheet", :media => "all" %> +<![endif]--> + +<!--[if IE 8]> +<%= stylesheet_link_tag 'responsive/application-ie8', :title => "Main", :rel => "stylesheet", :media => "all" %> +<![endif]--> + +<!--[if GT IE 8]><!--> +<%= stylesheet_link_tag 'responsive/application', :title => "Main", :rel => "stylesheet", :media => "all" %> +<!--<![endif]--> diff --git a/app/views/general/_responsive_topnav.html.erb b/app/views/general/_responsive_topnav.html.erb new file mode 100644 index 000000000..e726c17f4 --- /dev/null +++ b/app/views/general/_responsive_topnav.html.erb @@ -0,0 +1,32 @@ +<div id="topnav"> + <ul id="navigation"> + + <li class="<%= 'selected' if params[:controller] == 'request' and ['new', 'select_authority'].include?(params[:action]) %>"> + <%= link_to _("Make a request"), select_authority_path, :id => 'make-request-link' %> + </li> + + <li class="<%= 'selected' if params[:controller] == 'request' and !['new', 'select_authority'].include?(params[:action]) %>"> + <%= link_to _("View requests"), request_list_successful_path %> + </li> + + <li class="<%= 'selected' if params[:controller] == 'public_body' %>"> + <%= link_to _("View authorities"), list_public_bodies_default_path %> + </li> + + <% unless AlaveteliConfiguration::blog_feed.empty? %> + <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] == 'blog' %>"><%= link_to _("Read blog"), blog_path %></li> + <% end %> + <li class="<%= 'selected' if params[:controller] == 'help' %>"> + <%= link_to _("Help"), help_about_path %> + </li> + + <li id="navigation_search"> + <form id="navigation_search_form" method="post" action="<%= search_redirect_path %>"> + <label for="navigation_search_button"> + <img src="/assets/search.png" alt="Search:"> + </label> + <%= text_field_tag 'query', params[:query], { :id => "navigation_search_button", :title => "type your search term here" } %> + </form> + </li> + </ul> +</div> diff --git a/app/views/general/_stylesheet_includes.html.erb b/app/views/general/_stylesheet_includes.html.erb index 7a1648efd..ac7c37217 100644 --- a/app/views/general/_stylesheet_includes.html.erb +++ b/app/views/general/_stylesheet_includes.html.erb @@ -1,22 +1,40 @@ -<%- if @render_to_file %> - <style> - <%= Rails.application.assets["main.css"].to_s %> - <%= Rails.application.assets["print.css"].to_s %> - </style> -<%- else %> - <%= stylesheet_link_tag 'application', :title => "Main", :rel => "stylesheet", :media => "all" %> - <%= stylesheet_link_tag 'fonts', :rel => "stylesheet", :media => "all" %> - <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "print" %> - <% if !params[:print_stylesheet].nil? %> - <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "all" %> +<% if AlaveteliConfiguration::responsive_styling || params[:responsive] %> + <%- if @render_to_file %> + <style> + <%= Rails.application.assets["responsive/application.css"].to_s %> + <%= Rails.application.assets["responsive/print.css"].to_s %> + </style> + <%- else %> + <%= render :partial => 'general/responsive_stylesheets' %> + <%= stylesheet_link_tag 'responsive/print', :rel => "stylesheet", :media => "print" %> + <% if !params[:print_stylesheet].nil? %> + <%= stylesheet_link_tag 'responsive/print', :rel => "stylesheet", :media => "all" %> + <% end %> + <% if AlaveteliConfiguration::force_registration_on_new_request %> + <%= stylesheet_link_tag 'fancybox.css', :rel => "stylesheet" %> + <% end %> <% end %> - <!--[if LT IE 7]> - <%= stylesheet_link_tag 'ie6.css' %> - <![endif]--> - <!--[if LT IE 8]> - <%= stylesheet_link_tag 'ie7.css' %> - <![endif]--> - <% if AlaveteliConfiguration::force_registration_on_new_request %> - <%= stylesheet_link_tag 'jquery.fancybox-1.3.4.css', :rel => "stylesheet" %> +<% else %> + <%- if @render_to_file %> + <style> + <%= Rails.application.assets["main.css"].to_s %> + <%= Rails.application.assets["print.css"].to_s %> + </style> + <%- else %> + <%= stylesheet_link_tag 'application', :title => "Main", :rel => "stylesheet", :media => "all" %> + <%= stylesheet_link_tag 'fonts', :rel => "stylesheet", :media => "all" %> + <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "print" %> + <% if !params[:print_stylesheet].nil? %> + <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "all" %> + <% end %> + <!--[if LT IE 7]> + <%= stylesheet_link_tag 'ie6.css' %> + <![endif]--> + <!--[if LT IE 8]> + <%= stylesheet_link_tag 'ie7.css' %> + <![endif]--> + <% if AlaveteliConfiguration::force_registration_on_new_request %> + <%= stylesheet_link_tag 'fancybox.css', :rel => "stylesheet" %> + <% end %> <% end %> <% end %> diff --git a/app/views/general/blog.html.erb b/app/views/general/blog.html.erb index b81989ca8..5dda7ab74 100644 --- a/app/views/general/blog.html.erb +++ b/app/views/general/blog.html.erb @@ -1,21 +1,5 @@ <% @title = _("{{site_name}} blog and tweets", :site_name => site_name) %> -<% if !@twitter_user.empty? %> -<div id="right_column"> - <div class="act_link"> - <h2><%= _("Stay up to date") %></h2> - <%= image_tag "twitter-16.png", :alt => "twitter icon", :class => "twitter-icon" %> <a href="https://twitter.com/<%= @twitter_user %>"><%= _("Follow us on twitter") %></a><br/><br/> - <%= image_tag "feed-16.png", :alt => "RSS icon" %> <a href="<%= @feed_url %>"><%= _("Subscribe to blog") %></a> - </div> - <% if AlaveteliConfiguration::twitter_widget_id %> - <div id="twitter"> - <a class="twitter-timeline" data-dnt=true href="https://twitter.com/<%= AlaveteliConfiguration::twitter_username %>" data-widget-id="<%= AlaveteliConfiguration::twitter_widget_id %>">Tweets by @<%= AlaveteliConfiguration::twitter_username %></a> - <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> - </div> - <% end %> -</div> -<% end %> - <div id="left_column"> <h1><%=@title %></h1> @@ -42,3 +26,18 @@ </div> </div> +<% if !@twitter_user.empty? %> +<div id="right_column"> + <div class="act_link"> + <h2><%= _("Stay up to date") %></h2> + <%= image_tag "twitter-16.png", :alt => "twitter icon", :class => "twitter-icon" %> <a href="https://twitter.com/<%= @twitter_user %>"><%= _("Follow us on twitter") %></a><br/><br/> + <%= image_tag "feed-16.png", :alt => "RSS icon" %> <a href="<%= @feed_url %>"><%= _("Subscribe to blog") %></a> + </div> + <% if AlaveteliConfiguration::twitter_widget_id %> + <div id="twitter"> + <a class="twitter-timeline" data-dnt=true href="https://twitter.com/<%= AlaveteliConfiguration::twitter_username %>" data-widget-id="<%= AlaveteliConfiguration::twitter_widget_id %>">Tweets by @<%= AlaveteliConfiguration::twitter_username %></a> + <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> + </div> + <% end %> +</div> +<% end %> diff --git a/app/views/general/search.html.erb b/app/views/general/search.html.erb index 18f258444..3914a2f30 100644 --- a/app/views/general/search.html.erb +++ b/app/views/general/search.html.erb @@ -136,15 +136,18 @@ <div style="clear:both;"></div> <% if @total_hits == 0 %> + <div class="results_section"> <h2><%=@title %></h2> <% if @spelling_correction %> <p id="did_you_mean"><%= _('Did you mean: {{correction}}', :correction => search_link(@spelling_correction)) %></p> <% end %> + </div> <% end %> <% if not @query.nil? %> - <div class="results_section"> - <% if @xapian_bodies_hits > 0 %> + + <% if @xapian_bodies_hits > 0 %> + <div class="results_section"> <% if @xapian_bodies_hits == 1 && @page == 1 %> <h2 class="publicbody_results"><%= _('One public authority found') %></h2> <% else %> @@ -158,13 +161,13 @@ </div> <%= will_paginate WillPaginate::Collection.new(@page, @bodies_per_page, @xapian_bodies.matches_estimated) %> - <% elsif @variety_postfix == 'bodies' %> - <p><%= raw(_('<a href="{{browse_url}}">Browse all</a> or <a href="{{add_url}}">ask us to add one</a>.', :browse_url => list_public_bodies_default_path.html_safe, :add_url => (help_requesting_path + '#missing_body').html_safe)) %></p> - <% end %> - </div> + </div> + <% elsif @variety_postfix == 'bodies' %> + <p><%= raw(_('<a href="{{browse_url}}">Browse all</a> or <a href="{{add_url}}">ask us to add one</a>.', :browse_url => list_public_bodies_default_path.html_safe, :add_url => (help_requesting_path + '#missing_body').html_safe)) %></p> + <% end %> - <div class="results_section"> - <% if @xapian_users_hits > 0 %> + <% if @xapian_users_hits > 0 %> + <div class="results_section"> <% if @xapian_users_hits == 1 && @page == 1 %> <h2 class="person_results"><%= _("One person found") %></h2> <% else %> @@ -178,11 +181,12 @@ </div> <%= will_paginate WillPaginate::Collection.new(@page, @users_per_page, @xapian_users.matches_estimated) %> - <% end %> - </div> + </div> + <% end %> - <div class="results_section"> - <% if @xapian_requests_hits > 0 %> + + <% if @xapian_requests_hits > 0 %> + <div class="results_section"> <% if @xapian_requests_hits == 1 && @page == 1 %> <h2 class="foi_results"><%= _("One FOI request found") %></h2> <% else %> @@ -191,13 +195,13 @@ <div class="results_block"> <% for result in @xapian_requests.results %> - <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> + <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model] } %> <% end %> </div> <%= will_paginate WillPaginate::Collection.new(@page, @requests_per_page, @xapian_requests.matches_estimated) %> - <% end %> - </div> + </div> + <% end %> <% end %> <% if @advanced %> diff --git a/app/views/help/contact.html.erb b/app/views/help/contact.html.erb index ad89db9ec..d228aa3a5 100644 --- a/app/views/help/contact.html.erb +++ b/app/views/help/contact.html.erb @@ -65,6 +65,11 @@ <%= f.text_area :message, :rows => 10, :cols => 60 %> </p> + <p style="display:none;"> + <%= f.label :comment, 'Do not fill in this field' %> + <%= f.text_field :comment %> + </p> + <% if !@last_request.nil? %> <p> <label class="form_label" for="contact_message">Include link to request:</label> @@ -88,7 +93,7 @@ <div class="form_button"> <%= hidden_field_tag(:submitted_contact_form, 1) %> - <%= submit_tag "Send message to the charity" %> + <%= submit_tag "Send message to the charity", :disable_with => "Sending..." %> <-- we run this site, not the Government! </div> diff --git a/app/views/info_request_batch/show.html.erb b/app/views/info_request_batch/show.html.erb index aaecdd45d..8bb834b3c 100644 --- a/app/views/info_request_batch/show.html.erb +++ b/app/views/info_request_batch/show.html.erb @@ -1,25 +1,29 @@ <% @title = _("{{title}} - a batch request", :title => @info_request_batch.title) %> -<h1><%= @title %></h1> -<% if @info_request_batch.sent_at %> - <%= n_('Sent to one authority by {{info_request_user}} on {{date}}.', 'Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}.', @info_request_batch.info_requests.size, :authority_count=> @info_request_batch.info_requests.size, :info_request_user => user_link(@info_request_batch.user), :date => simple_date(@info_request_batch.sent_at)) %> - <div class="results_section"> - <div class="results_block"> - <% @info_requests.each do |info_request| %> - <%= render :partial => 'request/request_listing_via_event', :locals => { :event => info_request.last_event_forming_initial_request, :info_request => info_request } %> - <% end %> - </div> - <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @info_request_batch.info_requests.visible.count) %> +<div class="info_request_batch_intro"> + <h1><%= @title %></h1> + <% if @info_request_batch.sent_at %> + <%= n_('Sent to one authority by {{info_request_user}} on {{date}}.', 'Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}.', @info_request_batch.info_requests.size, :authority_count=> @info_request_batch.info_requests.size, :info_request_user => user_link(@info_request_batch.user), :date => simple_date(@info_request_batch.sent_at)) %> + + </div> + <div class="results_section"> + <div class="results_block"> + <% @info_requests.each do |info_request| %> + <%= render :partial => 'request/request_listing_via_event', :locals => { :event => info_request.last_event_forming_initial_request } %> + <% end %> + </div> + <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @info_request_batch.info_requests.visible.count) %> </div> <% else %> <%= _('Created by {{info_request_user}} on {{date}}.', :info_request_user => user_link(@info_request_batch.user), :date => simple_date(@info_request_batch.created_at)) %> - <%= _('Requests will be sent to the following bodies:') %> - <div class="results_section"> - <div class="results_block"> - <%= render :partial => 'public_body/body_listing', :locals => { :public_bodies => @public_bodies } %> - </div> - <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @info_request_batch.public_bodies.count) %> - </div> + <%= _('Requests will be sent to the following bodies:') %> + </div> + <div class="results_section"> + <div class="results_block"> +<%= render :partial => 'public_body/body_listing', :locals => { :public_bodies => @public_bodies } %> + </div> + <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @info_request_batch.public_bodies.count) %> + </div> <% end %> diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index c1f9335b1..2147f22e1 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -2,6 +2,8 @@ <html lang="en-gb"> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8" > + <%= csrf_meta_tags %> + <title><%= site_name %> admin<%= @title ? ":" : "" %> <%=@title%></title> <%= javascript_include_tag "admin" %> diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 52b718be8..50abc59c3 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -2,6 +2,8 @@ <html lang="<%= I18n.locale %>"> <head> <meta charset="utf-8"> + <%= csrf_meta_tags %> + <title> <% if @title %> <%=@title%> - <%= site_name %> @@ -38,17 +40,19 @@ <% if @no_crawl %> <meta name="robots" content="noindex, nofollow"> <% end %> - + <% if AlaveteliConfiguration::responsive_styling || params[:responsive] %> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <% end %> <%= render :partial => 'general/before_head_end' %> </head> <body class="<%= 'front' if params[:action] == 'frontpage' %>"> <% if AlaveteliConfiguration::force_registration_on_new_request && !@user %> - <%= javascript_include_tag 'jquery.fancybox-1.3.4.pack.js' %> + <%= javascript_include_tag 'fancybox.js' %> <script type="text/javascript"> $(document).ready(function() { $("#make-request-link").fancybox({ 'modal': false, - 'width': 920, + 'width': 950, 'height': 400, 'type': 'iframe', 'href': '/<%= FastGettext.locale %>/profile/sign_in?modal=1', @@ -82,7 +86,11 @@ </span> <span class="popup-close"><a href="#top" ><%= _('Close') %></a></span> </div> - <%= render :partial => 'general/header' %> + <% if AlaveteliConfiguration::responsive_styling || params[:responsive] %> + <%= render :partial => 'general/responsive_header' %> + <% else %> + <%= render :partial => 'general/header' %> + <% end %> <div id="wrapper"> <div id="content"> <% if flash[:notice] %> @@ -98,8 +106,11 @@ <div style="clear:both"></div> </div> </div> - - <%= render :partial => 'general/footer' %> + <% if AlaveteliConfiguration::responsive_styling || params[:responsive] %> + <%= render :partial => 'general/responsive_footer' %> + <% else %> + <%= render :partial => 'general/footer' %> + <% end %> </div> <div id="link_box"><span class="close-button">X</span> diff --git a/app/views/layouts/no_chrome.html.erb b/app/views/layouts/no_chrome.html.erb index e613b8ca2..f3ca9ef9e 100644 --- a/app/views/layouts/no_chrome.html.erb +++ b/app/views/layouts/no_chrome.html.erb @@ -2,6 +2,8 @@ <html lang="<%= I18n.locale %>"> <head> <meta charset="utf-8"> + <%= csrf_meta_tags %> + <title> <% if @title %> <%=@title%> - <%= site_name %> @@ -12,11 +14,15 @@ <%= javascript_include_tag "application" %> - <%= stylesheet_link_tag 'application', :title => "Main", :rel => "stylesheet" %> - <%= stylesheet_link_tag 'fonts', :rel => "stylesheet" %> - <!--[if LT IE 7]> - <%= stylesheet_link_tag 'ie6', :rel => "stylesheet" %> - <![endif]--> + <% if AlaveteliConfiguration::responsive_styling || params[:responsive] %> + <%= render :partial => 'general/responsive_stylesheets' %> + <% else %> + <%= stylesheet_link_tag 'application', :title => "Main", :rel => "stylesheet" %> + <%= stylesheet_link_tag 'fonts', :rel => "stylesheet" %> + <!--[if LT IE 7]> + <%= stylesheet_link_tag 'ie6', :rel => "stylesheet" %> + <![endif]--> + <% end %> </head> <body> <div class="entirebody"> diff --git a/app/views/public_body/show.html.erb b/app/views/public_body/show.html.erb index c36396149..a9c50e657 100644 --- a/app/views/public_body/show.html.erb +++ b/app/views/public_body/show.html.erb @@ -119,7 +119,7 @@ <% if !@xapian_requests.nil? %> <% for result in @xapian_requests.results %> - <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> + <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model] } %> <% end %> <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @xapian_requests.matches_estimated) %> diff --git a/app/views/request/_list_results.html.erb b/app/views/request/_list_results.html.erb index 4da042816..9e6b07c79 100644 --- a/app/views/request/_list_results.html.erb +++ b/app/views/request/_list_results.html.erb @@ -5,7 +5,7 @@ <h2 class="foi_results"><%= _('{{count}} FOI requests found', :count => @results[:matches_estimated]) %></h2> <div class="results_block"> <% @results[:results].each do |result| %> - <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result, :info_request => result.info_request } %> + <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result } %> <% end %> </div> <% end %> diff --git a/app/views/request/_outgoing_correspondence.text.erb b/app/views/request/_outgoing_correspondence.text.erb index 5375ef81b..221e359e2 100644 --- a/app/views/request/_outgoing_correspondence.text.erb +++ b/app/views/request/_outgoing_correspondence.text.erb @@ -3,6 +3,6 @@ <%- else %> <%= _('From:') %> <% if @info_request.user_name %><%= @info_request.user_name %><% else %><%= "[#{_('An anonymous user')}]"%><% end %> <%= _('To:') %> <%= @info_request.public_body.name %> - <%= _('Date:') %> <%= simple_date(info_request_event.created_at) %> + <%= _('Date:') %> <%= simple_date(info_request_event.created_at, :format => :text) %> <%= outgoing_message.get_body_for_text_display %> <%- end %> diff --git a/app/views/request/_request_listing_via_event.html.erb b/app/views/request/_request_listing_via_event.html.erb index cc8bae8a9..20bc5b2c8 100644 --- a/app/views/request/_request_listing_via_event.html.erb +++ b/app/views/request/_request_listing_via_event.html.erb @@ -6,36 +6,21 @@ end %> <div class="request_left"> <span class="head"> <% if event.is_incoming_message? %> - <%= link_to highlight_words(info_request.title, @highlight_words), incoming_message_path(event.incoming_message_selective_columns("incoming_messages.id")) %> + <%= link_to highlight_words(event.info_request.title, @highlight_words), incoming_message_path(event.incoming_message_selective_columns("incoming_messages.id")) %> <% elsif event.is_outgoing_message? and event.event_type == 'followup_sent' %> - <%= link_to highlight_words(info_request.title, @highlight_words), outgoing_message_path(event.outgoing_message) %> + <%= link_to highlight_words(event.info_request.title, @highlight_words), outgoing_message_path(event.outgoing_message) %> <% elsif event.is_comment? %> - <%= link_to highlight_words(info_request.title, @highlight_words), comment_path(event.comment) %> + <%= link_to highlight_words(event.info_request.title, @highlight_words), comment_path(event.comment) %> <% else %> - <%= link_to highlight_words(info_request.title, @highlight_words), request_path(info_request) %> + <%= link_to highlight_words(event.info_request.title, @highlight_words), request_path(event.info_request) %> <% end %> </span> <div class="requester"> - <% if event.event_type == 'sent' %> - <%= _('Request sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at )) %> - <% elsif event.event_type == 'followup_sent' %> - <%=event.display_status %> - <%= _('sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at )) %> - <% elsif event.event_type == 'response' %> - <%=event.display_status %> - <%= _('by {{public_body_name}} to {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at )) %> - <% elsif event.event_type == 'comment' %> - <%= _('Request to {{public_body_name}} by {{info_request_user}}. Annotated by {{event_comment_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:event_comment_user=>user_link_absolute(event.comment.user),:date=>simple_date(event.created_at)) %> - <% else %> - <%# Events of other types will not be indexed: see InfoRequestEvent#indexed_by_search? - However, it can happen that we see other types of event transiently here in the period - between a change being made and the update-xapian-index job being run. %> - <!-- Event of type '<%= event.event_type %>', id=<%= event.id %> --> - <% end %> + <%= event_description(event) %> </div> - <span class="bottomline icon_<%= info_request.calculate_status %>"> + <span class="bottomline icon_<%= event.info_request.calculate_status %>"> <strong> - <%= info_request.display_status(cached_value_ok=true) %> + <%= event.info_request.display_status(cached_value_ok=true) %> </strong><br> </span> </div> diff --git a/app/views/request/_resent_outgoing_correspondence.text.erb b/app/views/request/_resent_outgoing_correspondence.text.erb index d645e9488..d39f8395b 100644 --- a/app/views/request/_resent_outgoing_correspondence.text.erb +++ b/app/views/request/_resent_outgoing_correspondence.text.erb @@ -1,2 +1,2 @@ -<%= _('Date:') %> <%= simple_date(info_request_event.created_at) %> +<%= _('Date:') %> <%= simple_date(info_request_event.created_at, :format => :text) %> Sent <% if outgoing_message.message_type == 'initial_request' %> request <% elsif outgoing_message.message_type == 'followup' %> a follow up <% else %> <% raise "unknown message_type" %><% end %> to <%= public_body_link(@info_request.public_body) %> again<% if not info_request_event.same_email_as_previous_send? %>, using a new contact address<% end %>. diff --git a/app/views/request/_summary_suggestion.html.erb b/app/views/request/_summary_suggestion.html.erb index a5da09cda..74d9c46c5 100644 --- a/app/views/request/_summary_suggestion.html.erb +++ b/app/views/request/_summary_suggestion.html.erb @@ -1,5 +1,5 @@ <% if @info_request.law_used == 'eir' %> - <%= _("'Pollution levels over time for the River Tyne'") %> + <%= _("'Pollution levels over time for the River Tyne'") -%> <% else %> - <%= _("'Crime statistics by ward level for Wales'") %> + <%= _("'Crime statistics by ward level for Wales'") -%> <% end %> diff --git a/app/views/request/_view_html_prefix.html.erb b/app/views/request/_view_html_prefix.html.erb index 63fac7c6d..d21f234b9 100644 --- a/app/views/request/_view_html_prefix.html.erb +++ b/app/views/request/_view_html_prefix.html.erb @@ -6,7 +6,7 @@ <%=link_to _("Download original attachment"), @attachment_url %> <br>(<%=h @attachment.name_of_content_type %>) </div> - <%= _('This is an HTML version of an attachment to the Freedom of Information request')%> - '<%=link_to h(@info_request.title), incoming_message_path(@incoming_message)%>'. + <p class="view_html_description"><%= _('This is an HTML version of an attachment to the Freedom of Information request')%> + '<%=link_to h(@info_request.title), incoming_message_path(@incoming_message)%>'.</p> </div> diff --git a/app/views/request/_view_html_stylesheet.html.erb b/app/views/request/_view_html_stylesheet.html.erb index 125ce66ec..6746cf71b 100644 --- a/app/views/request/_view_html_stylesheet.html.erb +++ b/app/views/request/_view_html_stylesheet.html.erb @@ -1 +1,6 @@ -<link type="text/css" title="Main" rel="stylesheet" media="screen" href="/assets/application.css"> +<% if AlaveteliConfiguration::responsive_styling || params[:responsive] %> + <%= render :partial => 'general/responsive_stylesheets' %> +<% else %> + <link type="text/css" title="Main" rel="stylesheet" media="screen" href="/assets/application.css"> + +<% end %> diff --git a/app/views/request/select_authority.html.erb b/app/views/request/select_authority.html.erb index 83abdb184..ed072cf64 100644 --- a/app/views/request/select_authority.html.erb +++ b/app/views/request/select_authority.html.erb @@ -18,6 +18,7 @@ $("#authority_preview").show(); $(window).scrollTop($("#banner").height()); $("#authority_preview #header_right").hide(); + location.hash = '#header_left'; }); return false; }); diff --git a/app/views/request/similar.html.erb b/app/views/request/similar.html.erb index 5bdefc494..4ce4bf9ba 100644 --- a/app/views/request/similar.html.erb +++ b/app/views/request/similar.html.erb @@ -22,7 +22,7 @@ --> <% for result in @xapian_object.results %> <% if result[:model].class.to_s == 'InfoRequestEvent' %> - <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> + <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model] } %> <% else %> <p><strong><%= _('Unexpected search result type ')%><%=result[:model].class.to_s%></strong></p> <% end %> diff --git a/app/views/request_game/play.html.erb b/app/views/request_game/play.html.erb index d5aa0d00e..544274e93 100644 --- a/app/views/request_game/play.html.erb +++ b/app/views/request_game/play.html.erb @@ -27,20 +27,21 @@ <% end %> </table> </div> -<h2><%= _("Play the request categorisation game!")%></h2> -<p><%= _("Some people who've made requests haven't let us know whether they were +<div id="game"> + <h2><%= _("Play the request categorisation game!")%></h2> + <p><%= _("Some people who've made requests haven't let us know whether they were successful or not. We need <strong>your</strong> help – choose one of these requests, read it, and let everyone know whether or not the information has been provided. Everyone'll be exceedingly grateful.")%></p> -<% for info_request in @requests %> - <%= render :partial => 'request/request_listing_single', :locals => { :info_request => info_request } %> -<% end %> -<p id="game_buttons"> -<%= button_to _('I don\'t like these ones — give me some more!'), categorise_play_url %> -<%= button_to _('I don\'t want to do any more tidying now!'), categorise_stop_url %> -</p> -<p><%= _('Thanks for helping - your work will make it easier for everyone to find successful + <% for info_request in @requests %> + <%= render :partial => 'request/request_listing_single', :locals => { :info_request => info_request } %> + <% end %> + <p id="game_buttons"> + <%= button_to _('I don\'t like these ones — give me some more!'), categorise_play_url %> + <%= button_to _('I don\'t want to do any more tidying now!'), categorise_stop_url %> + </p> + <p><%= _('Thanks for helping - your work will make it easier for everyone to find successful responses, and maybe even let us make league tables...')%></p> - +</div> diff --git a/app/views/track/_track_set.erb b/app/views/track/_track_set.erb new file mode 100644 index 000000000..c7665312d --- /dev/null +++ b/app/views/track/_track_set.erb @@ -0,0 +1,6 @@ +<% if @user.receive_email_alerts %> + <%= subscribe_email_notice(@track_thing) %> + <%= link_to(_('Prefer not to receive emails?'), show_user_wall_path(:url_name => @user.url_name)) %> +<% else %> + <%= subscribe_follow_notice(@track_thing) %> +<% end %> diff --git a/app/views/track/atom_feed.atom.erb b/app/views/track/atom_feed.atom.erb index be9c39e72..892727aef 100644 --- a/app/views/track/atom_feed.atom.erb +++ b/app/views/track/atom_feed.atom.erb @@ -9,7 +9,7 @@ # Get the HTML content from the same partial template as website search does content = '' if result[:model].class.to_s == 'InfoRequestEvent' - content += render :partial => 'request/request_listing_via_event', :formats => ['html'], :locals => { :event => result[:model], :info_request => result[:model].info_request } + content += render :partial => 'request/request_listing_via_event', :formats => ['html'], :locals => { :event => result[:model] } else content = "<p><strong>Unknown search result type " + result[:model].class.to_s + "</strong></p>" end diff --git a/app/views/track_mailer/event_digest.text.erb b/app/views/track_mailer/event_digest.text.erb index 8dbc7fe06..b83c184f0 100644 --- a/app/views/track_mailer/event_digest.text.erb +++ b/app/views/track_mailer/event_digest.text.erb @@ -32,7 +32,7 @@ else raise "unknown type in event_digest " + event.event_type end - main_text += " (" + simple_date(event.created_at) + ")\n" + main_text += " (" + simple_date(event.created_at, :format => :text) + ")\n" # Main text, wrapped, words highlighted with * and indented. if event.is_outgoing_message? diff --git a/app/views/user/river.html.erb b/app/views/user/river.html.erb index 9618e0aa8..7277e5ee5 100644 --- a/app/views/user/river.html.erb +++ b/app/views/user/river.html.erb @@ -4,8 +4,7 @@ <h1><%=@title%></h1> <% for result in @results %> - <%= render :partial => 'request/request_listing_via_event', :locals => { - :event => result[:model], :info_request => result[:model].info_request } %> + <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model] } %> <% end %> </div> diff --git a/app/views/user/show.html.erb b/app/views/user/show.html.erb index 76ecdeda0..ce328b46f 100644 --- a/app/views/user/show.html.erb +++ b/app/views/user/show.html.erb @@ -42,7 +42,7 @@ <% end %> </div> - <div class="header_left"> + <div id="header_left"> <p id="user_photo_on_profile"> <% if @display_user.profile_photo %> <% if @is_you %> @@ -147,7 +147,7 @@ <% for result in @xapian_requests.results %> - <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> + <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model] } %> <% end %> <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @display_user.info_requests.size) %> @@ -175,7 +175,7 @@ </h2> <% for result in @xapian_comments.results %> - <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> + <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model] } %> <% end %> <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @display_user.visible_comments.size) %> @@ -224,7 +224,7 @@ <li> <%= form_tag({:controller => 'track', :action => 'update', :track_id => track_thing.id}, :class => "feed_form") do %> <div> - <%= track_thing.params[:list_description] %> + <%= track_description(track_thing) %> <%= hidden_field_tag 'track_medium', "delete", { :id => 'track_medium_' + track_thing.id.to_s } %> <%= hidden_field_tag 'r', request.fullpath, { :id => 'r_' + track_thing.id.to_s } %> <%= submit_tag _('unsubscribe') %> |