Merge pull request #453 from AyuntamientoMadrid/ie8

Ie8
This commit is contained in:
Raimond Garcia
2015-09-09 23:51:31 +02:00
17 changed files with 85 additions and 44 deletions

7
app/assets/javascripts/rem.min.js vendored Executable file
View File

@@ -0,0 +1,7 @@
/**
* Module: rem - v1.3.2
* Description: A polyfill to parse CSS links and rewrite pixel equivalents into head for non supporting browsers
* Date Built: 2014-07-02
* Copyright (c) 2014 | Chuck Carpenter <chuck.carpenter@me.com>,Lucas Serven <lserven@gmail.com>;
**/
!function(e){"use strict";var t=function(){var e=document.createElement("div");return e.style.cssText="font-size: 1rem;",/rem/.test(e.style.fontSize)},n=function(){for(var e=document.getElementsByTagName("link"),t=[],n=0;n<e.length;n++)"stylesheet"===e[n].rel.toLowerCase()&&null===e[n].getAttribute("data-norem")&&t.push(e[n].href);return t},r=function(){for(var e=0;e<h.length;e++)l(h[e],o)},o=function(e,t){if(p.push(e.responseText),v.push(t),v.length===h.length){for(var n=0;n<v.length;n++)a(p[n],v[n]);(h=m.slice(0)).length>0?(v=[],p=[],m=[],r()):i()}},a=function(e,t){for(var n,r=d(e).replace(/\/\*[\s\S]*?\*\//g,""),o=/[\w\d\s\-\/\\\[\]:,.'"*()<>+~%#^$_=|@]+\{[\w\d\s\-\/\\%#:!;,.'"*()]+\d*\.?\d+rem[\w\d\s\-\/\\%#:!;,.'"*()]*\}/g,a=r.match(o),i=/\d*\.?\d+rem/g,s=r.match(i),c=/(.*\/)/,l=c.exec(t)[0],u=/@import (?:url\()?['"]?([^'\)"]*)['"]?\)?[^;]*/gm;null!==(n=u.exec(e));)m.push(0===n[1].indexOf("/")?n[1]:l+n[1]);null!==a&&0!==a.length&&(f=f.concat(a),g=g.concat(s))},i=function(){for(var e=/[\w\d\s\-\/\\%#:,.'"*()]+\d*\.?\d+rem[\w\d\s\-\/\\%#:!,.'"*()]*[;}]/g,t=0;t<f.length;t++){u+=f[t].substr(0,f[t].indexOf("{")+1);for(var n=f[t].match(e),r=0;r<n.length;r++)u+=n[r],r===n.length-1&&"}"!==u[u.length-1]&&(u+="\n}")}s()},s=function(){for(var e=0;e<g.length;e++)y[e]=Math.round(parseFloat(g[e].substr(0,g[e].length-3)*w))+"px";c()},c=function(){for(var e=0;e<y.length;e++)y[e]&&(u=u.replace(g[e],y[e]));var t=document.createElement("style");t.setAttribute("type","text/css"),t.id="remReplace",document.getElementsByTagName("head")[0].appendChild(t),t.styleSheet?t.styleSheet.cssText=u:t.appendChild(document.createTextNode(u))},l=function(t,n){try{var r=e.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP")||new ActiveXObject("Msxml2.XMLHTTP"):new XMLHttpRequest;r.open("GET",t,!0),r.onreadystatechange=function(){4===r.readyState&&n(r,t)},r.send(null)}catch(o){if(e.XDomainRequest){var a=new XDomainRequest;a.open("get",t),a.onload=function(){n(a,t)},a.onerror=function(){return!1},a.send()}}},d=function(t){return e.matchMedia||e.msMatchMedia||(t=t.replace(/@media[\s\S]*?\}\s*\}/g,"")),t};if(!t()){var u="",h=n(),m=[],f=[],g=[],p=[],v=[],y=[],w="";w=function(){var e,t=document,n=t.documentElement,r=t.body||t.createElement("body"),o=!t.body,a=t.createElement("div"),i=r.style.fontSize;return o&&n.appendChild(r),a.style.cssText="width:1em; position:absolute; visibility:hidden; padding: 0;",r.style.fontSize="1em",r.appendChild(a),e=a.offsetWidth,o?n.removeChild(r):(r.removeChild(a),r.style.fontSize=i),e}(),r()}}(window);

6
app/assets/javascripts/respond.min.js vendored Executable file
View File

@@ -0,0 +1,6 @@
/*! Respond.js v1.4.2: min/max-width media query polyfill
* Copyright 2014 Scott Jehl
* Licensed under MIT
* http://j.mp/respondjs */
!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='&shy;<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){v(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))},g=function(a){return a.replace(c.regex.minmaxwh,"").match(c.regex.other)};if(c.ajax=f,c.queue=d,c.unsupportedmq=g,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var h,i,j,k=a.document,l=k.documentElement,m=[],n=[],o=[],p={},q=30,r=k.getElementsByTagName("head")[0]||l,s=k.getElementsByTagName("base")[0],t=r.getElementsByTagName("link"),u=function(){var a,b=k.createElement("div"),c=k.body,d=l.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=k.createElement("body"),c.style.background="none"),l.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&l.insertBefore(c,l.firstChild),a=b.offsetWidth,f?l.removeChild(c):c.removeChild(b),l.style.fontSize=d,e&&(c.style.fontSize=e),a=j=parseFloat(a)},v=function(b){var c="clientWidth",d=l[c],e="CSS1Compat"===k.compatMode&&d||k.body[c]||d,f={},g=t[t.length-1],p=(new Date).getTime();if(b&&h&&q>p-h)return a.clearTimeout(i),i=a.setTimeout(v,q),void 0;h=p;for(var s in m)if(m.hasOwnProperty(s)){var w=m[s],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?j||u():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?j||u():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(n[w.rules]))}for(var C in o)o.hasOwnProperty(C)&&o[C]&&o[C].parentNode===r&&r.removeChild(o[C]);o.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=k.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,r.insertBefore(E,g.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(k.createTextNode(F)),o.push(E)}},w=function(a,b,d){var e=a.replace(c.regex.comments,"").replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var h=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},i=!f&&d;b.length&&(b+="/"),i&&(f=1);for(var j=0;f>j;j++){var k,l,o,p;i?(k=d,n.push(h(a))):(k=e[j].match(c.regex.findStyles)&&RegExp.$1,n.push(RegExp.$2&&h(RegExp.$2))),o=k.split(","),p=o.length;for(var q=0;p>q;q++)l=o[q],g(l)||m.push({media:l.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:n.length-1,hasquery:l.indexOf("(")>-1,minw:l.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:l.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}v()},x=function(){if(d.length){var b=d.shift();f(b.href,function(c){w(c,b.href,b.media),p[b.href]=!0,a.setTimeout(function(){x()},0)})}},y=function(){for(var b=0;b<t.length;b++){var c=t[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!p[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(w(c.styleSheet.rawCssText,e,f),p[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!s||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}x()};y(),c.update=y,c.getEmValue=u,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);

View File

@@ -128,6 +128,7 @@
text-align: center;
top: 0;
width: 100%;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#222222', endColorstr='#222222'); /* IE */
a {
color: white;
@@ -209,6 +210,11 @@
display: block;
font-size: rem-calc(16);
line-height: $line-height;
text-transform: lowercase;
&:first-letter {
text-transform: uppercase;
}
}
}
@@ -305,7 +311,7 @@
.debate-content {
margin: 0;
min-height: 0;
min-height: rem-calc(180);
.tags {
display: block;
@@ -417,6 +423,11 @@
font-size: rem-calc(24);
font-weight: bold;
margin: 0;
text-transform: lowercase;
&:first-letter {
text-transform: uppercase;
}
}
.edit-debate {

View File

@@ -271,9 +271,12 @@ h6 {
header {
background: image-url('header_bg.jpg');
background-position: 50% 50%;
background-repeat: no-repeat;
background-size: cover;
color: $text;
min-height: rem-calc(696);
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='assets/header_bg.jpg', sizingMethod='scale');
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='assets/header_bg.jpg',sizingMethod='scale')";
&.results {
border-bottom: rem-calc(1) solid $border;
@@ -306,6 +309,7 @@ header {
.home-page {
background-color: rgba(255,255,255,.85);
clear: both;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#ffffff', endColorstr='#ffffff'); /* IE */
@media (min-width: $small-breakpoint) {
margin-top: rem-calc(66);
@@ -389,9 +393,11 @@ header {
padding-left: 0;
span {
*display: inline; /* IE */
opacity: .5;
&.logo-site {
*display: inline; /* IE */
font-size: rem-calc(14);
opacity: 1;
}
@@ -433,6 +439,12 @@ header {
background: none;
}
@media screen\0 {
.title-area {
min-width: rem-calc(475);
}
}
.toggle-topbar {
a {
@@ -599,7 +611,6 @@ header {
footer {
color: white;
padding: rem-calc(24) 0 rem-calc(48) 0;
text-align: justify;
.logo {
@include logo;

View File

@@ -1,5 +1,5 @@
<span><%= moderator.name %></span>
<span class="bullet">&nbsp;&bullet;&nbsp;</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span><%= moderator.email %></span>
<% if moderator.persisted? %>
<%= link_to t('admin.moderators.moderator.delete'),

View File

@@ -17,9 +17,9 @@
<% @officials.each do |official| %>
<li>
<%= link_to official.name, edit_admin_official_path(official) %>
<span class="bullet">&nbsp;&bullet;&nbsp;</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="level"><%= t("admin.officials.level_#{official.official_level}") %></span>
<span class="bullet">&nbsp;&bullet;&nbsp;</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="label round level-<%= official.official_level %>">
<%= official.official_position %>
</span>

View File

@@ -17,11 +17,11 @@
<% @users.each do |user| %>
<li>
<%= link_to user.name, edit_admin_official_path(user) %>
<span class="bullet">&nbsp;&bullet;&nbsp;</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="label round level-<%= user.official_level %>">
<%= user.official_position %>
</span>
<span class="bullet">&nbsp;&bullet;&nbsp;</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="level"><%= t("admin.officials.level_#{user.official_level}") %></span>
<%= link_to user.official? ? t("admin.officials.search.edit_official") : t("admin.officials.search.make_official"), edit_admin_official_path(user), class: "button radius tiny right" %>

View File

@@ -4,13 +4,13 @@
<span class='js-moderation-actions'>
<% if can? :hide, comment %>
<span class="divider">&nbsp;&bullet;&nbsp;</span>
<span class="divider">&nbsp;&bull;&nbsp;</span>
<%= link_to t("admin.actions.hide").capitalize, hide_moderation_comment_path(comment),
method: :put, remote: true, data: { confirm: t('admin.actions.confirm') } %>
<% end %>
<% if can? :hide, comment.user %>
<span class="divider">&nbsp;&bullet;&nbsp;</span>
<span class="divider">&nbsp;&bull;&nbsp;</span>
<%= link_to t("admin.actions.hide_author").capitalize, hide_moderation_user_path(comment.user_id, debate_id: @debate.id),
method: :put, data: { confirm: t('admin.actions.confirm') } %>
<% end %>

View File

@@ -38,20 +38,20 @@
<% else %>
<span class="user-name"><%= comment.user.name %></span>
<% if comment.user.official? %>
&nbsp;&bullet;&nbsp;
&nbsp;&bull;&nbsp;
<span class="label round level-<%= comment.user.official_level %>">
<%= comment.user.official_position %>
</span>
<% end %>
<% end %>
<% if comment.user.verified_organization? %>
&nbsp;&bullet;&nbsp;
&nbsp;&bull;&nbsp;
<span class="label round is-association">
<%= t("shared.collective") %>
</span>
<% end %>
<% if comment.user_id == @commentable.author_id %>
&nbsp;&bullet;&nbsp;
&nbsp;&bull;&nbsp;
<span class="label round is-author">
<%= t("debates.comment.author") %>
</span>
@@ -59,7 +59,7 @@
<% end %>
&nbsp;&bullet;&nbsp;<time><%= l comment.created_at.to_datetime, format: :datetime %></time>
&nbsp;&bull;&nbsp;<time><%= l comment.created_at.to_datetime, format: :datetime %></time>
</div>
<% if comment.as_administrator? %>

View File

@@ -11,7 +11,7 @@
<p class="debate-info">
<i class="icon-comments"></i>&nbsp;
<%= link_to t("debates.debate.comments", count: debate.comments_count), debate_path(debate, anchor: "comments") %>
<span class="bullet">&nbsp;&bullet;&nbsp;</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= l debate.created_at.to_date %>
</p>
<div class="debate-description">

View File

@@ -32,7 +32,7 @@
<%= @debate.author.name %>
</span>
<% if @debate.author.official? %>
&nbsp;&bullet;&nbsp;
&nbsp;&bull;&nbsp;
<span class="label round level-<%= @debate.author.official_level %>">
<%= @debate.author.official_position %>
</span>
@@ -40,18 +40,18 @@
<% end %>
<% if @debate.author.verified_organization? %>
&nbsp;&bullet;&nbsp;
&nbsp;&bull;&nbsp;
<span class="label round is-association">
<%= t("shared.collective") %>
</span>
<% end %>
<span class="bullet">&nbsp;&bullet;&nbsp;</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= l @debate.created_at.to_date %>
<span class="bullet">&nbsp;&bullet;&nbsp;</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<i class="icon-comments"></i>&nbsp;
<%= link_to t("debates.show.comments", count: @debate.comments_count), "#comments" %>
<span class="bullet">&nbsp;&bullet;&nbsp;</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="js-flag-actions">
<%= render 'debates/flag_actions', debate: @debate %>
</span>

View File

@@ -13,7 +13,6 @@
open_source: link_to(t("layouts.footer.open_source"), t("layouts.footer.open_source_url"), target: "blank"),
github: link_to(t("layouts.footer.github"), t("layouts.footer.github_url"), target: "blank")).html_safe
%>
<br>
<%= t("layouts.footer.contact_us") %>
<%= mail_to "web.gobiernoabierto@madrid.es" %>
</p>

View File

@@ -14,7 +14,10 @@
rel: "apple-touch-icon",
sizes: "200x200",
type: "image/png" %>
</head>
<!--[if lt IE 9]>
<%= javascript_include_tag "respond" %>
<![endif]-->
</head>
<body class="<%= "bg-white" if current_page?(root_path) %>">
<div class="wrapper">
<%= render 'layouts/header' %>
@@ -48,4 +51,7 @@
<%= render 'layouts/footer' %>
</div>
</body>
<!--[if lt IE 9]>
<%= javascript_include_tag "rem" %>
<![endif]-->
</html>

View File

@@ -24,9 +24,9 @@
<tr id="debate_<%= debate.id %>">
<td>
<%= link_to debate.title, debate, target: "_blank" %>
<span class="bullet">&nbsp;&bullet;&nbsp;</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= debate.author.username %>
<span class="bullet">&nbsp;&bullet;&nbsp;</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="date"><%= l debate.updated_at.to_date %></span>
<br>
<%= debate.description %>

View File

@@ -19,7 +19,7 @@
<% @users.each do |user| %>
<li>
<%= user.name %>
<span class="bullet">&nbsp;&bullet;&nbsp;</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<% if user.hidden? %>
<%= t("moderation.users.index.hidden") %>
<% else %>

View File

@@ -10,3 +10,4 @@ Rails.application.config.assets.version = '1.0'
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w( ckeditor/* )
Rails.application.config.assets.precompile += %w( rem.min.js, respond.min.js )

View File

@@ -360,59 +360,59 @@ feature 'Debates' do
feature 'Debate index order filters' do
scenario 'Default order is confidence_score', :js do
create(:debate, title: 'best').update_column(:confidence_score, 10)
create(:debate, title: 'worst').update_column(:confidence_score, 2)
create(:debate, title: 'medium').update_column(:confidence_score, 5)
create(:debate, title: 'Best').update_column(:confidence_score, 10)
create(:debate, title: 'Worst').update_column(:confidence_score, 2)
create(:debate, title: 'Medium').update_column(:confidence_score, 5)
visit debates_path
expect('best').to appear_before('medium')
expect('medium').to appear_before('worst')
expect('Best').to appear_before('Medium')
expect('Medium').to appear_before('Worst')
end
scenario 'Debates are ordered by hot_score', :js do
create(:debate, title: 'best').update_column(:hot_score, 10)
create(:debate, title: 'worst').update_column(:hot_score, 2)
create(:debate, title: 'medium').update_column(:hot_score, 5)
create(:debate, title: 'Best').update_column(:hot_score, 10)
create(:debate, title: 'Worst').update_column(:hot_score, 2)
create(:debate, title: 'Medium').update_column(:hot_score, 5)
visit debates_path
select 'most active', from: 'order-selector'
within '#debates.js-order-hot-score' do
expect('best').to appear_before('medium')
expect('medium').to appear_before('worst')
expect('Best').to appear_before('Medium')
expect('Medium').to appear_before('Worst')
end
expect(current_url).to include('order=hot_score')
end
scenario 'Debates are ordered by most commented', :js do
create(:debate, title: 'best', comments_count: 10)
create(:debate, title: 'medium', comments_count: 5)
create(:debate, title: 'worst', comments_count: 2)
create(:debate, title: 'Best', comments_count: 10)
create(:debate, title: 'Medium', comments_count: 5)
create(:debate, title: 'Worst', comments_count: 2)
visit debates_path
select 'most commented', from: 'order-selector'
within '#debates.js-order-most-commented' do
expect('best').to appear_before('medium')
expect('medium').to appear_before('worst')
expect('Best').to appear_before('Medium')
expect('Medium').to appear_before('Worst')
end
expect(current_url).to include('order=most_commented')
end
scenario 'Debates are ordered by newest', :js do
create(:debate, title: 'best', created_at: Time.now)
create(:debate, title: 'medium', created_at: Time.now - 1.hour)
create(:debate, title: 'worst', created_at: Time.now - 1.day)
create(:debate, title: 'Best', created_at: Time.now)
create(:debate, title: 'Medium', created_at: Time.now - 1.hour)
create(:debate, title: 'Worst', created_at: Time.now - 1.day)
visit debates_path
select 'newest', from: 'order-selector'
within '#debates.js-order-created-at' do
expect('best').to appear_before('medium')
expect('medium').to appear_before('worst')
expect('Best').to appear_before('Medium')
expect('Medium').to appear_before('Worst')
end
expect(current_url).to include('order=created_at')