merges master and fixes conflicts
This commit is contained in:
@@ -36,6 +36,8 @@ var initialize_modules = function() {
|
||||
};
|
||||
|
||||
$(function(){
|
||||
Turbolinks.enableProgressBar()
|
||||
|
||||
$(document).ready(initialize_modules);
|
||||
$(document).on('page:load', initialize_modules);
|
||||
$(document).on('ajax:complete', initialize_modules);
|
||||
|
||||
7
app/assets/javascripts/rem.min.js
vendored
Executable file
7
app/assets/javascripts/rem.min.js
vendored
Executable 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
6
app/assets/javascripts/respond.min.js
vendored
Executable 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='­<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);
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -3,7 +3,7 @@ class StatsController < ApplicationController
|
||||
skip_authorization_check
|
||||
|
||||
def show
|
||||
@event_types = Ahoy::Event.select(:name).uniq.pluck(:name)
|
||||
@event_types = Ahoy::Event.group(:name).count
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -2,6 +2,7 @@ class Verification::LetterController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
before_action :verify_resident!
|
||||
before_action :verify_phone!
|
||||
before_action :verify_attemps_left!
|
||||
skip_authorization_check
|
||||
|
||||
def new
|
||||
@@ -28,6 +29,7 @@ class Verification::LetterController < ApplicationController
|
||||
current_user.update(verified_at: Time.now)
|
||||
redirect_to account_path, notice: t('verification.letter.update.flash.success')
|
||||
else
|
||||
@letter.increase_letter_verification_tries
|
||||
@error = t('verification.letter.update.error')
|
||||
render :edit
|
||||
end
|
||||
@@ -44,4 +46,10 @@ class Verification::LetterController < ApplicationController
|
||||
redirect_to verified_user_path, alert: t('verification.letter.alert.unconfirmed_code')
|
||||
end
|
||||
end
|
||||
|
||||
def verify_attemps_left!
|
||||
if current_user.letter_verification_tries >= 2
|
||||
redirect_to account_path, alert: t('verification.letter.alert.verify_attemps_left')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -27,6 +27,7 @@ class Verification::SmsController < ApplicationController
|
||||
@sms = Verification::Sms.new(sms_params.merge(user: current_user))
|
||||
if @sms.verify?
|
||||
current_user.update(confirmed_phone: current_user.unconfirmed_phone)
|
||||
ahoy.track :level_2_user, user_id: current_user.id
|
||||
|
||||
if VerifiedUser.phone?(current_user)
|
||||
current_user.update(verified_at: Time.now)
|
||||
|
||||
@@ -18,13 +18,17 @@ class Verification::Letter
|
||||
end
|
||||
|
||||
def letter_requested!
|
||||
user.update(letter_requested_at: Time.now, letter_verification_code: four_digit_code)
|
||||
user.update(letter_requested_at: Time.now, letter_verification_code: generate_verification_code)
|
||||
end
|
||||
|
||||
def verify?
|
||||
user.letter_verification_code == verification_code
|
||||
end
|
||||
|
||||
def increase_letter_verification_tries
|
||||
user.update(letter_verification_tries: user.letter_verification_tries += 1)
|
||||
end
|
||||
|
||||
def update_user_address
|
||||
user.address = Address.new(parsed_address)
|
||||
user.save
|
||||
@@ -50,8 +54,10 @@ class Verification::Letter
|
||||
district: address[:nombre_distrito] }
|
||||
end
|
||||
|
||||
def four_digit_code
|
||||
rand.to_s[2..5]
|
||||
private
|
||||
|
||||
def generate_verification_code
|
||||
rand.to_s[2..7]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ class Verification::Sms
|
||||
end
|
||||
|
||||
def update_user_phone_information
|
||||
user.update(unconfirmed_phone: phone, sms_confirmation_code: four_digit_code)
|
||||
user.update(unconfirmed_phone: phone, sms_confirmation_code: generate_confirmation_code)
|
||||
end
|
||||
|
||||
def send_sms
|
||||
@@ -41,7 +41,7 @@ class Verification::Sms
|
||||
|
||||
private
|
||||
|
||||
def four_digit_code
|
||||
def generate_confirmation_code
|
||||
rand.to_s[2..5]
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
<span><%= moderator.name %></span>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="bullet"> • </span>
|
||||
<span><%= moderator.email %></span>
|
||||
<% if moderator.persisted? %>
|
||||
<%= link_to t('admin.moderators.moderator.delete'),
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<% @officials.each do |official| %>
|
||||
<li>
|
||||
<%= link_to official.name, edit_admin_official_path(official) %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="level"><%= t("admin.officials.level_#{official.official_level}") %></span>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="label round level-<%= official.official_level %>">
|
||||
<%= official.official_position %>
|
||||
</span>
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
<% @users.each do |user| %>
|
||||
<li>
|
||||
<%= link_to user.name, edit_admin_official_path(user) %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="label round level-<%= user.official_level %>">
|
||||
<%= user.official_position %>
|
||||
</span>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="bullet"> • </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" %>
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
|
||||
<span class='js-moderation-actions'>
|
||||
<% if can? :hide, comment %>
|
||||
<span class="divider"> • </span>
|
||||
<span class="divider"> • </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"> • </span>
|
||||
<span class="divider"> • </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 %>
|
||||
|
||||
@@ -38,20 +38,20 @@
|
||||
<% else %>
|
||||
<span class="user-name"><%= comment.user.name %></span>
|
||||
<% if comment.user.official? %>
|
||||
•
|
||||
•
|
||||
<span class="label round level-<%= comment.user.official_level %>">
|
||||
<%= comment.user.official_position %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if comment.user.verified_organization? %>
|
||||
•
|
||||
•
|
||||
<span class="label round is-association">
|
||||
<%= t("shared.collective") %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% if comment.user_id == @commentable.author_id %>
|
||||
•
|
||||
•
|
||||
<span class="label round is-author">
|
||||
<%= t("debates.comment.author") %>
|
||||
</span>
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
<% end %>
|
||||
|
||||
• <time><%= l comment.created_at.to_datetime, format: :datetime %></time>
|
||||
• <time><%= l comment.created_at.to_datetime, format: :datetime %></time>
|
||||
</div>
|
||||
|
||||
<% if comment.as_administrator? %>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<p class="debate-info">
|
||||
<i class="icon-comments"></i>
|
||||
<%= link_to t("debates.debate.comments", count: debate.comments_count), debate_path(debate, anchor: "comments") %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="bullet"> • </span>
|
||||
<%= l debate.created_at.to_date %>
|
||||
</p>
|
||||
<div class="debate-description">
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<%= @debate.author.name %>
|
||||
</span>
|
||||
<% if @debate.author.official? %>
|
||||
•
|
||||
•
|
||||
<span class="label round level-<%= @debate.author.official_level %>">
|
||||
<%= @debate.author.official_position %>
|
||||
</span>
|
||||
@@ -40,18 +40,18 @@
|
||||
<% end %>
|
||||
|
||||
<% if @debate.author.verified_organization? %>
|
||||
•
|
||||
•
|
||||
<span class="label round is-association">
|
||||
<%= t("shared.collective") %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
||||
<span class="bullet"> • </span>
|
||||
<span class="bullet"> • </span>
|
||||
<%= l @debate.created_at.to_date %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="bullet"> • </span>
|
||||
<i class="icon-comments"></i>
|
||||
<%= link_to t("debates.show.comments", count: @debate.comments_count), "#comments" %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="js-flag-actions">
|
||||
<%= render 'debates/flag_actions', debate: @debate %>
|
||||
</span>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
rel: "apple-touch-icon",
|
||||
sizes: "200x200",
|
||||
type: "image/png" %>
|
||||
<!--[if lt IE 9]>
|
||||
<%= javascript_include_tag "respond" %>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body class="<%= "bg-white" if current_page?(root_path) %>">
|
||||
<div class="wrapper">
|
||||
@@ -48,4 +51,7 @@
|
||||
<%= render 'layouts/footer' %>
|
||||
</div>
|
||||
</body>
|
||||
<!--[if lt IE 9]>
|
||||
<%= javascript_include_tag "rem" %>
|
||||
<![endif]-->
|
||||
</html>
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
<tr id="debate_<%= debate.id %>">
|
||||
<td>
|
||||
<%= link_to debate.title, debate, target: "_blank" %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="bullet"> • </span>
|
||||
<%= debate.author.username %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="date"><%= l debate.updated_at.to_date %></span>
|
||||
<br>
|
||||
<%= debate.description %>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<% @users.each do |user| %>
|
||||
<li>
|
||||
<%= user.name %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="bullet"> • </span>
|
||||
<% if user.hidden? %>
|
||||
<%= t("moderation.users.index.hidden") %>
|
||||
<% else %>
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
<div class="small-12 medium-6 column">
|
||||
<h3>Combined</h3>
|
||||
<%= events_chart_tag @event_types, id: 'combined' %>
|
||||
<%= events_chart_tag @event_types.keys, id: 'combined' %>
|
||||
</div>
|
||||
|
||||
<div class="small-12">
|
||||
<% @event_types.each do |event_type| %>
|
||||
<h3><%= event_type.titleize %></h3>
|
||||
<%= events_chart_tag event_type %>
|
||||
<% @event_types.each do |event, count| %>
|
||||
<h3><%= event.titleize %> (<%= count %>)</h3>
|
||||
<%= events_chart_tag event %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
set :deploy_to, deploysecret(:deploy_to)
|
||||
set :server_name, deploysecret(:server_name)
|
||||
set :db_server, deploysecret(:db_server)
|
||||
set :branch, :master
|
||||
set :branch, ENV['branch'] || :master
|
||||
set :ssh_options, port: deploysecret(:ssh_port)
|
||||
set :stage, :staging
|
||||
set :rails_env, :staging
|
||||
|
||||
@@ -2,7 +2,7 @@ ActsAsTaggableOn::Tagging.class_eval do
|
||||
after_destroy :touch_taggable
|
||||
|
||||
def touch_taggable
|
||||
taggable.touch
|
||||
taggable.touch if taggable.present?
|
||||
end
|
||||
|
||||
end
|
||||
@@ -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 )
|
||||
@@ -83,6 +83,7 @@ en:
|
||||
success: "Correct code. Your account is verified"
|
||||
alert:
|
||||
unconfirmed_code: "You have not yet enter the confirmation code"
|
||||
verify_attemps_left: "You have reached the maximum number of letter verification tries"
|
||||
verified_user:
|
||||
show:
|
||||
title: "Available information"
|
||||
|
||||
@@ -83,6 +83,7 @@ es:
|
||||
success: "Código correcto. Tu cuenta ya está verificada"
|
||||
alert:
|
||||
unconfirmed_code: "Todavía no has introducido el código de confirmación"
|
||||
verify_attemps_left: "Has llegado al máximo número de intentos de verificar tu carta."
|
||||
verified_user:
|
||||
show:
|
||||
title: "Información disponible"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddLetterVerificationTriesToUsers < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :letter_verification_tries, :integer, default: 0
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150909153455) do
|
||||
ActiveRecord::Schema.define(version: 20150910092713) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -238,6 +238,7 @@ ActiveRecord::Schema.define(version: 20150909153455) do
|
||||
t.datetime "letter_requested_at"
|
||||
t.datetime "confirmed_hide_at"
|
||||
t.string "letter_verification_code"
|
||||
t.integer "letter_verification_tries", default: 0
|
||||
end
|
||||
|
||||
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
|
||||
|
||||
84
spec/features/admin/tags_spec.rb
Normal file
84
spec/features/admin/tags_spec.rb
Normal file
@@ -0,0 +1,84 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Admin tags' do
|
||||
|
||||
background do
|
||||
@tag1 = create(:tag)
|
||||
login_as(create(:administrator).user)
|
||||
end
|
||||
|
||||
scenario 'Index' do
|
||||
create(:debate, tag_list: 'supertag')
|
||||
visit admin_tags_path
|
||||
|
||||
expect(page).to have_content @tag1.name
|
||||
expect(page).to have_content 'supertag'
|
||||
end
|
||||
|
||||
scenario 'Create' do
|
||||
visit admin_tags_path
|
||||
|
||||
expect(page).to_not have_content 'important issues'
|
||||
|
||||
within("form.new_tag") do
|
||||
fill_in "tag_name", with: 'important issues'
|
||||
click_button 'Create Topic'
|
||||
end
|
||||
|
||||
visit admin_tags_path
|
||||
|
||||
expect(page).to have_content 'important issues'
|
||||
end
|
||||
|
||||
scenario 'Update' do
|
||||
visit admin_tags_path
|
||||
featured_checkbox = find("#tag_featured_#{@tag1.id}")
|
||||
expect(featured_checkbox.checked?).to be_nil
|
||||
|
||||
within("#edit_tag_#{@tag1.id}") do
|
||||
check "tag_featured_#{@tag1.id}"
|
||||
click_button 'Update Topic'
|
||||
end
|
||||
|
||||
visit admin_tags_path
|
||||
featured_checkbox = find("#tag_featured_#{@tag1.id}")
|
||||
expect(featured_checkbox.checked?).to eq('checked')
|
||||
end
|
||||
|
||||
scenario 'Delete' do
|
||||
tag2 = create(:tag, name: 'bad tag')
|
||||
create(:debate, tag_list: tag2.name)
|
||||
visit admin_tags_path
|
||||
|
||||
expect(page).to have_content @tag1.name
|
||||
expect(page).to have_content tag2.name
|
||||
|
||||
within("#edit_tag_#{tag2.id}") do
|
||||
click_link 'Delete Topic'
|
||||
end
|
||||
|
||||
visit admin_tags_path
|
||||
expect(page).to have_content @tag1.name
|
||||
expect(page).to_not have_content tag2.name
|
||||
end
|
||||
|
||||
scenario 'Delete tag with hidden taggables' do
|
||||
tag2 = create(:tag, name: 'bad tag')
|
||||
debate = create(:debate, tag_list: tag2.name)
|
||||
debate.hide
|
||||
|
||||
visit admin_tags_path
|
||||
|
||||
expect(page).to have_content @tag1.name
|
||||
expect(page).to have_content tag2.name
|
||||
|
||||
within("#edit_tag_#{tag2.id}") do
|
||||
click_link 'Delete Topic'
|
||||
end
|
||||
|
||||
visit admin_tags_path
|
||||
expect(page).to have_content @tag1.name
|
||||
expect(page).to_not have_content tag2.name
|
||||
end
|
||||
|
||||
end
|
||||
@@ -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')
|
||||
|
||||
21
spec/features/stats_spec.rb
Normal file
21
spec/features/stats_spec.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Stats' do
|
||||
|
||||
scenario 'Level 2 user' do
|
||||
admin = create(:administrator)
|
||||
user = create(:user)
|
||||
login_as(user)
|
||||
|
||||
visit account_path
|
||||
click_link 'Verify my account'
|
||||
verify_residence
|
||||
confirm_phone
|
||||
|
||||
login_as(admin.user)
|
||||
visit stats_path
|
||||
|
||||
expect(page).to have_content "Level 2 User (1)"
|
||||
end
|
||||
|
||||
end
|
||||
@@ -76,4 +76,24 @@ feature 'Verify Letter' do
|
||||
expect(URI.parse(current_url).path).to eq(new_sms_path)
|
||||
end
|
||||
|
||||
scenario '3 tries allowed' do
|
||||
user = create(:user, residence_verified_at: Time.now, confirmed_phone: "611111111")
|
||||
login_as(user)
|
||||
|
||||
visit new_letter_path
|
||||
click_button 'Send me a letter with the code'
|
||||
|
||||
3.times do
|
||||
fill_in 'letter_verification_code', with: "999999"
|
||||
click_button 'Send'
|
||||
end
|
||||
|
||||
expect(page).to have_content 'You have reached the maximum number of letter verification tries'
|
||||
expect(URI.parse(current_url).path).to eq(account_path)
|
||||
|
||||
visit new_letter_path
|
||||
expect(page).to have_content 'You have reached the maximum number of letter verification tries'
|
||||
expect(URI.parse(current_url).path).to eq(account_path)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -110,4 +110,17 @@ module CommonActions
|
||||
click_button 'Verify residence'
|
||||
expect(page).to have_content 'Residence verified'
|
||||
end
|
||||
|
||||
def confirm_phone
|
||||
fill_in 'sms_phone', with: "611111111"
|
||||
click_button 'Send'
|
||||
|
||||
expect(page).to have_content 'Security code confirmation'
|
||||
|
||||
user = User.last.reload
|
||||
fill_in 'sms_confirmation_code', with: user.sms_confirmation_code
|
||||
click_button 'Send'
|
||||
|
||||
expect(page).to have_content 'Correct code'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user