Merge branch 'master' into amiedes-api-dev-PRs-2

This commit is contained in:
kikito
2017-06-14 09:58:17 +02:00
39 changed files with 207 additions and 115 deletions

View File

@@ -236,7 +236,7 @@ GEM
railties (>= 3.2) railties (>= 3.2)
loofah (2.0.3) loofah (2.0.3)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.6.6.rc1) mail (2.6.6)
mime-types (>= 1.16, < 4) mime-types (>= 1.16, < 4)
mime-types (3.1) mime-types (3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
@@ -555,4 +555,4 @@ DEPENDENCIES
whenever whenever
BUNDLED WITH BUNDLED WITH
1.15.0 1.15.1

View File

@@ -4,4 +4,4 @@ App.SocialShare =
$(".social-share-button a").each -> $(".social-share-button a").each ->
element = $(this) element = $(this)
site = element.data('site') site = element.data('site')
element.append("<span class='sr-only'>#{site}</span>") element.append("<span class='show-for-sr'>#{site}</span>")

View File

@@ -183,17 +183,6 @@ a {
} }
} }
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
.menu.simple { .menu.simple {
border-bottom: 1px solid $border; border-bottom: 1px solid $border;
margin: $line-height 0; margin: $line-height 0;

View File

@@ -13,11 +13,11 @@ class Admin::StatsController < Admin::BaseController
@comment_votes = Vote.where(votable_type: 'Comment').count @comment_votes = Vote.where(votable_type: 'Comment').count
@votes = Vote.count @votes = Vote.count
@user_level_two = User.with_hidden.level_two_verified.count @user_level_two = User.active.level_two_verified.count
@user_level_three = User.with_hidden.level_three_verified.count @user_level_three = User.active.level_three_verified.count
@verified_users = User.with_hidden.level_two_or_three_verified.count @verified_users = User.active.level_two_or_three_verified.count
@unverified_users = User.with_hidden.unverified.count @unverified_users = User.active.unverified.count
@users = User.with_hidden.count @users = User.active.count
@user_ids_who_voted_proposals = ActsAsVotable::Vote.where(votable_type: 'Proposal').distinct.count(:voter_id) @user_ids_who_voted_proposals = ActsAsVotable::Vote.where(votable_type: 'Proposal').distinct.count(:voter_id)
@user_ids_who_didnt_vote_proposals = @verified_users - @user_ids_who_voted_proposals @user_ids_who_didnt_vote_proposals = @verified_users - @user_ids_who_voted_proposals
@spending_proposals = SpendingProposal.count @spending_proposals = SpendingProposal.count

View File

@@ -2,7 +2,7 @@ module LayoutsHelper
def layout_menu_link_to(text, path, is_active, options) def layout_menu_link_to(text, path, is_active, options)
if is_active if is_active
content_tag(:span, t('shared.you_are_in'), class: 'sr-only') + ' ' + content_tag(:span, t('shared.you_are_in'), class: 'show-for-sr') + ' ' +
link_to(text, path, options.merge(class: "active")) link_to(text, path, options.merge(class: "active"))
else else
link_to(text, path, options) link_to(text, path, options)

View File

@@ -3,7 +3,8 @@ class User < ActiveRecord::Base
include Verification include Verification
devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable,
:trackable, :validatable, :omniauthable, :async, :password_expirable, :secure_validatable :trackable, :validatable, :omniauthable, :async, :password_expirable, :secure_validatable,
authentication_keys: [:login]
acts_as_voter acts_as_voter
acts_as_paranoid column: :hidden_at acts_as_paranoid column: :hidden_at
@@ -50,6 +51,7 @@ class User < ActiveRecord::Base
attr_accessor :skip_password_validation attr_accessor :skip_password_validation
attr_accessor :use_redeemable_code attr_accessor :use_redeemable_code
attr_accessor :login
scope :administrators, -> { joins(:administrators) } scope :administrators, -> { joins(:administrators) }
scope :moderators, -> { joins(:moderator) } scope :moderators, -> { joins(:moderator) }
@@ -301,6 +303,14 @@ class User < ActiveRecord::Base
public_activity? ? comments : User.none public_activity? ? comments : User.none
end end
# overwritting of Devise method to allow login using email OR username
def self.find_for_database_authentication(warden_conditions)
conditions = warden_conditions.dup
login = conditions.delete(:login)
where(conditions.to_hash).where(["lower(email) = ?", login.downcase]).first ||
where(conditions.to_hash).where(["username = ?", login]).first
end
private private
def clean_document_number def clean_document_number

View File

@@ -9,7 +9,7 @@
class: "remove-investment-project", class: "remove-investment-project",
method: :delete, method: :delete,
remote: true do %> remote: true do %>
<span class="sr-only"><%= t('budgets.ballots.show.remove') %></span> <span class="show-for-sr"><%= t('budgets.ballots.show.remove') %></span>
<span class="icon-x"></span> <span class="icon-x"></span>
<% end %> <% end %>
<% end %> <% end %>

View File

@@ -40,13 +40,13 @@
<td> <td>
<% if investment.winner? %> <% if investment.winner? %>
<span class="icon-check"> <span class="icon-check">
<span class="sr-only"> <span class="show-for-sr">
<%= t("budgets.results.accepted") %> <%= t("budgets.results.accepted") %>
</span> </span>
</span> </span>
<% else %> <% else %>
<span class="icon-x delete"> <span class="icon-x delete">
<span class="sr-only"> <span class="show-for-sr">
<%= t("budgets.results.discarded") %> <%= t("budgets.results.discarded") %>
</span> </span>
</span> </span>

View File

@@ -73,8 +73,8 @@
<% if comment.children.size > 0 %> <% if comment.children.size > 0 %>
<%= link_to "#{dom_id(comment)}", class: "js-toggle-children relative", data: {'id': "#{dom_id(comment)}"} do %> <%= link_to "#{dom_id(comment)}", class: "js-toggle-children relative", data: {'id': "#{dom_id(comment)}"} do %>
<span class="sr-only js-child-toggle" style="display: none;"><%= t("shared.show") %></span> <span class="show-for-sr js-child-toggle" style="display: none;"><%= t("shared.show") %></span>
<span class="sr-only js-child-toggle"><%= t("shared.hide") %></span> <span class="show-for-sr js-child-toggle"><%= t("shared.hide") %></span>
<span id="<%= dom_id(comment) %>_children_arrow" class="icon-arrow-down"></span> <%= t("comments.comment.responses", count: comment.children.size) %> <span id="<%= dom_id(comment) %>_children_arrow" class="icon-arrow-down"></span> <%= t("comments.comment.responses", count: comment.children.size) %>
<% end %> <% end %>
<% else %> <% else %>

View File

@@ -8,13 +8,13 @@
<%= link_to vote_comment_path(comment, value: 'yes'), <%= link_to vote_comment_path(comment, value: 'yes'),
method: "post", remote: true, title: t('votes.agree') do %> method: "post", remote: true, title: t('votes.agree') do %>
<span class="icon-like"> <span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span> <span class="show-for-sr"><%= t('votes.agree') %></span>
</span> </span>
<% end %> <% end %>
<% else %> <% else %>
<%= link_to new_user_session_path do %> <%= link_to new_user_session_path do %>
<span class="icon-like"> <span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span> <span class="show-for-sr"><%= t('votes.agree') %></span>
</span> </span>
<% end %> <% end %>
<% end %> <% end %>
@@ -26,12 +26,12 @@
<%= link_to vote_comment_path(comment, value: 'no'), <%= link_to vote_comment_path(comment, value: 'no'),
method: "post", remote: true, title: t('votes.disagree') do %> method: "post", remote: true, title: t('votes.disagree') do %>
<span class="icon-unlike"> <span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span> <span class="show-for-sr"><%= t('votes.disagree') %></span>
</span> </span>
<% end %> <% end %>
<% else %> <% else %>
<span class="icon-unlike"> <span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span> <span class="show-for-sr"><%= t('votes.disagree') %></span>
</span> </span>
<% end %> <% end %>
<%= comment.total_dislikes %> <%= comment.total_dislikes %>
@@ -48,13 +48,13 @@
<%= link_to vote_comment_path(comment, value: 'yes'), <%= link_to vote_comment_path(comment, value: 'yes'),
method: "post", remote: true, title: t('votes.agree') do %> method: "post", remote: true, title: t('votes.agree') do %>
<span class="icon-like"> <span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span> <span class="show-for-sr"><%= t('votes.agree') %></span>
</span> </span>
<% end %> <% end %>
<% else %> <% else %>
<%= link_to new_user_session_path do %> <%= link_to new_user_session_path do %>
<span class="icon-like"> <span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span> <span class="show-for-sr"><%= t('votes.agree') %></span>
</span> </span>
<% end %> <% end %>
<% end %> <% end %>
@@ -66,13 +66,13 @@
<%= link_to vote_comment_path(comment, value: 'no'), <%= link_to vote_comment_path(comment, value: 'no'),
method: "post", remote: true, title: t('votes.disagree') do %> method: "post", remote: true, title: t('votes.disagree') do %>
<span class="icon-unlike"> <span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span> <span class="show-for-sr"><%= t('votes.disagree') %></span>
</span> </span>
<% end %> <% end %>
<% else %> <% else %>
<%= link_to new_user_session_path do %> <%= link_to new_user_session_path do %>
<span class="icon-unlike"> <span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span> <span class="show-for-sr"><%= t('votes.disagree') %></span>
</span> </span>
<% end %> <% end %>
<% end %> <% end %>

View File

@@ -5,14 +5,14 @@
<%= link_to vote_debate_path(debate, value: 'yes'), <%= link_to vote_debate_path(debate, value: 'yes'),
class: "like #{voted_classes[:in_favor]}", title: t('votes.agree'), method: "post", remote: true do %> class: "like #{voted_classes[:in_favor]}", title: t('votes.agree'), method: "post", remote: true do %>
<span class="icon-like"> <span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span> <span class="show-for-sr"><%= t('votes.agree') %></span>
</span> </span>
<span class="percentage"><%= votes_percentage('likes', debate) %></span> <span class="percentage"><%= votes_percentage('likes', debate) %></span>
<% end %> <% end %>
<% else %> <% else %>
<div class="like"> <div class="like">
<span class="icon-like"> <span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span> <span class="show-for-sr"><%= t('votes.agree') %></span>
</span> </span>
<span class="percentage"><%= votes_percentage('likes', debate) %></span> <span class="percentage"><%= votes_percentage('likes', debate) %></span>
</div> </div>
@@ -25,14 +25,14 @@
<% if user_signed_in? %> <% if user_signed_in? %>
<%= link_to vote_debate_path(debate, value: 'no'), class: "unlike #{voted_classes[:against]}", title: t('votes.disagree'), method: "post", remote: true do %> <%= link_to vote_debate_path(debate, value: 'no'), class: "unlike #{voted_classes[:against]}", title: t('votes.disagree'), method: "post", remote: true do %>
<span class="icon-unlike"> <span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span> <span class="show-for-sr"><%= t('votes.disagree') %></span>
</span> </span>
<span class="percentage"><%= votes_percentage('dislikes', debate) %></span> <span class="percentage"><%= votes_percentage('dislikes', debate) %></span>
<% end %> <% end %>
<% else %> <% else %>
<div class="unlike"> <div class="unlike">
<span class="icon-unlike"> <span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span> <span class="show-for-sr"><%= t('votes.disagree') %></span>
</span> </span>
<span class="percentage"><%= votes_percentage('dislikes', debate) %></span> <span class="percentage"><%= votes_percentage('dislikes', debate) %></span>
</div> </div>

View File

@@ -9,7 +9,7 @@
<% end %> <% end %>
<main> <main>
<h1 class="sr-only"><%= t("shared.outline.debates") %></h1> <h1 class="show-for-sr"><%= t("shared.outline.debates") %></h1>
<% if @search_terms || @advanced_search_terms || @tag_filter %> <% if @search_terms || @advanced_search_terms || @tag_filter %>
<div class="highlight no-margin-top padding margin-bottom"> <div class="highlight no-margin-top padding margin-bottom">

View File

@@ -1,7 +1,7 @@
<% if user_signed_in? %> <% if user_signed_in? %>
<li> <li>
<%= link_to notifications_path, rel: "nofollow", class: "notifications" do %> <%= link_to notifications_path, rel: "nofollow", class: "notifications" do %>
<span class="sr-only"><%= t("layouts.header.notifications") %></span> <span class="show-for-sr"><%= t("layouts.header.notifications") %></span>
<% if current_user.notifications_count > 0 %> <% if current_user.notifications_count > 0 %>
<span class="icon-circle" aria-hidden="true"></span> <span class="icon-circle" aria-hidden="true"></span>
<span class="icon-notification" aria-hidden="true" title="<%= t('layouts.header.new_notifications', count: current_user.notifications_count).html_safe %>"> <span class="icon-notification" aria-hidden="true" title="<%= t('layouts.header.new_notifications', count: current_user.notifications_count).html_safe %>">

View File

@@ -11,7 +11,7 @@
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="row"> <div class="row">
<div class="small-12 column"> <div class="small-12 column">
<%= f.email_field :email, autofocus: true, placeholder: t("devise_views.sessions.new.email_label") %> <%= f.text_field :login, autofocus: true, placeholder: t("devise_views.sessions.new.login_label") %>
</div> </div>
<div class="small-12 column"> <div class="small-12 column">

View File

@@ -50,7 +50,7 @@
<li class="inline-block"> <li class="inline-block">
<%= link_to "https://twitter.com/#{setting['twitter_handle']}", target: "_blank", <%= link_to "https://twitter.com/#{setting['twitter_handle']}", target: "_blank",
title: t("shared.go_to_page") + t("social.twitter", org: setting['org_name']) + t('shared.target_blank_html') do %> title: t("shared.go_to_page") + t("social.twitter", org: setting['org_name']) + t('shared.target_blank_html') do %>
<span class="sr-only"><%= t("social.twitter", org: setting['org_name']) %></span> <span class="show-for-sr"><%= t("social.twitter", org: setting['org_name']) %></span>
<span class="icon-twitter" aria-hidden="true"></span> <span class="icon-twitter" aria-hidden="true"></span>
<% end %> <% end %>
</li> </li>
@@ -59,7 +59,7 @@
<li class="inline-block"> <li class="inline-block">
<%= link_to "https://www.facebook.com/#{setting['facebook_handle']}/", target: "_blank", <%= link_to "https://www.facebook.com/#{setting['facebook_handle']}/", target: "_blank",
title: t("shared.go_to_page") + t("social.facebook", org: setting['org_name']) + t('shared.target_blank_html') do %> title: t("shared.go_to_page") + t("social.facebook", org: setting['org_name']) + t('shared.target_blank_html') do %>
<span class="sr-only"><%= t("social.facebook", org: setting['org_name']) %></span> <span class="show-for-sr"><%= t("social.facebook", org: setting['org_name']) %></span>
<span class="icon-facebook" aria-hidden="true"></span> <span class="icon-facebook" aria-hidden="true"></span>
<% end %> <% end %>
</li> </li>
@@ -68,7 +68,7 @@
<li class="inline-block"> <li class="inline-block">
<%= link_to setting['blog_url'], target: "_blank", <%= link_to setting['blog_url'], target: "_blank",
title: t("shared.go_to_page") + t("social.blog", org: setting['org_name']) + t('shared.target_blank_html') do %> title: t("shared.go_to_page") + t("social.blog", org: setting['org_name']) + t('shared.target_blank_html') do %>
<span class="sr-only"><%= t("social.blog", org: setting['org_name']) %></span> <span class="show-for-sr"><%= t("social.blog", org: setting['org_name']) %></span>
<span class="icon-blog" aria-hidden="true"></span> <span class="icon-blog" aria-hidden="true"></span>
<% end %> <% end %>
</li> </li>
@@ -77,7 +77,7 @@
<li class="inline-block"> <li class="inline-block">
<%= link_to "https://www.youtube.com/#{setting['youtube_handle']}", target: "_blank", <%= link_to "https://www.youtube.com/#{setting['youtube_handle']}", target: "_blank",
title: t("shared.go_to_page") + t("social.youtube", org: setting['org_name']) + t('shared.target_blank_html') do %> title: t("shared.go_to_page") + t("social.youtube", org: setting['org_name']) + t('shared.target_blank_html') do %>
<span class="sr-only"><%= t("social.youtube", org: setting['org_name']) %></span> <span class="show-for-sr"><%= t("social.youtube", org: setting['org_name']) %></span>
<span class="icon-youtube" aria-hidden="true"></span> <span class="icon-youtube" aria-hidden="true"></span>
<% end %> <% end %>
</li> </li>
@@ -86,7 +86,7 @@
<li class="inline-block"> <li class="inline-block">
<%= link_to "https://www.telegram.me/#{setting['telegram_handle']}", target: "_blank", <%= link_to "https://www.telegram.me/#{setting['telegram_handle']}", target: "_blank",
title: t("shared.go_to_page") + t("social.telegram", org: setting['org_name']) + t('shared.target_blank_html') do %> title: t("shared.go_to_page") + t("social.telegram", org: setting['org_name']) + t('shared.target_blank_html') do %>
<span class="sr-only"><%= t("social.telegram", org: setting['org_name']) %></span> <span class="show-for-sr"><%= t("social.telegram", org: setting['org_name']) %></span>
<span class="icon-telegram" aria-hidden="true"></span> <span class="icon-telegram" aria-hidden="true"></span>
<% end %> <% end %>
</li> </li>
@@ -95,7 +95,7 @@
<li class="inline-block"> <li class="inline-block">
<%= link_to "https://www.instagram.com/#{setting['instagram_handle']}", target: "_blank", <%= link_to "https://www.instagram.com/#{setting['instagram_handle']}", target: "_blank",
title: t("shared.go_to_page") + t("social.instagram", org: setting['org_name']) + t('shared.target_blank_html') do %> title: t("shared.go_to_page") + t("social.instagram", org: setting['org_name']) + t('shared.target_blank_html') do %>
<span class="sr-only"><%= t("social.instagram", org: setting['org_name']) %></span> <span class="show-for-sr"><%= t("social.instagram", org: setting['org_name']) %></span>
<span class="icon-instagram" aria-hidden="true"></span> <span class="icon-instagram" aria-hidden="true"></span>
<% end %> <% end %>
</li> </li>

View File

@@ -26,7 +26,7 @@
<body> <body>
<%= setting['per_page_code_body'].try(:html_safe) %> <%= setting['per_page_code_body'].try(:html_safe) %>
<h1 class="sr-only"><%= setting['org_name'] %></h1> <h1 class="show-for-sr"><%= setting['org_name'] %></h1>
<div class="wrapper <%= yield (:wrapper_class) %>"> <div class="wrapper <%= yield (:wrapper_class) %>">
<%= render 'layouts/header' %> <%= render 'layouts/header' %>

View File

@@ -3,7 +3,7 @@
<% if browser.device.mobile? %> <% if browser.device.mobile? %>
<a href="whatsapp://send?text=<%= title %> <%= url %>" data-action="share/whatsapp/share"> <a href="whatsapp://send?text=<%= title %> <%= url %>" data-action="share/whatsapp/share">
<span class="icon-whatsapp whatsapp"></span> <span class="icon-whatsapp whatsapp"></span>
<span class="sr-only"><%= t("social.whatsapp") %></span> <span class="show-for-sr"><%= t("social.whatsapp") %></span>
</a> </a>
<% end %> <% end %>
</div> </div>

View File

@@ -23,7 +23,7 @@
<div class="small-12 medium-6"> <div class="small-12 medium-6">
<table> <table>
<caption class="sr-only">Atajos de teclado para el menú de navegación</caption> <caption class="show-for-sr">Atajos de teclado para el menú de navegación</caption>
<thead> <thead>
<tr> <tr>
<th scope="col" class="text-center">Tecla</th> <th scope="col" class="text-center">Tecla</th>
@@ -63,7 +63,7 @@
<div class="small-12 medium-6"> <div class="small-12 medium-6">
<table> <table>
<caption class="sr-only">Combinación de teclas dependiendo del sistema operativo y navegador</caption> <caption class="show-for-sr">Combinación de teclas dependiendo del sistema operativo y navegador</caption>
<thead> <thead>
<tr> <tr>
<th scope="col">Navegador</th> <th scope="col">Navegador</th>

View File

@@ -4,7 +4,7 @@
<%= link_to poll, <%= link_to poll,
class: "icon-poll-answer can-answer", class: "icon-poll-answer can-answer",
title: t("polls.index.can_answer") do %> title: t("polls.index.can_answer") do %>
<span class="sr-only"> <span class="show-for-sr">
<%= t("polls.index.can_answer") %> <%= t("polls.index.can_answer") %>
</span> </span>
<% end %> <% end %>
@@ -12,7 +12,7 @@
<%= link_to new_user_session_path, <%= link_to new_user_session_path,
class: "icon-poll-answer not-logged-in", class: "icon-poll-answer not-logged-in",
title: t("polls.index.cant_answer_not_logged_in") do %> title: t("polls.index.cant_answer_not_logged_in") do %>
<span class="sr-only"> <span class="show-for-sr">
<%= t("polls.index.cant_answer_not_logged_in") %> <%= t("polls.index.cant_answer_not_logged_in") %>
</span> </span>
<% end %> <% end %>
@@ -20,17 +20,17 @@
<%= link_to verification_path, <%= link_to verification_path,
class: "icon-poll-answer unverified", class: "icon-poll-answer unverified",
title: t("polls.index.cant_answer_verify") do %> title: t("polls.index.cant_answer_verify") do %>
<span class="sr-only"> <span class="show-for-sr">
<%= t("polls.index.cant_answer_verify") %> <%= t("polls.index.cant_answer_verify") %>
</span> </span>
<% end %> <% end %>
<% elsif !poll.votable_by?(current_user) %> <% elsif !poll.votable_by?(current_user) %>
<div class="icon-poll-answer already-answer" title="<%= t("polls.index.already_answer") %>"> <div class="icon-poll-answer already-answer" title="<%= t("polls.index.already_answer") %>">
<span class="sr-only"><%= t("polls.index.already_answer") %></span> <span class="show-for-sr"><%= t("polls.index.already_answer") %></span>
</div> </div>
<% else %> <% else %>
<div class="icon-poll-answer cant-answer" title="<%= t("polls.index.cant_answer") %>"> <div class="icon-poll-answer cant-answer" title="<%= t("polls.index.cant_answer") %>">
<span class="sr-only"><%= t("polls.index.cant_answer") %></span> <span class="show-for-sr"><%= t("polls.index.cant_answer") %></span>
</div> </div>
<% end %> <% end %>
<div class="row"> <div class="row">

View File

@@ -9,7 +9,7 @@
<% end %> <% end %>
<main> <main>
<h1 class="sr-only"><%= t("shared.outline.proposals") %></h1> <h1 class="show-for-sr"><%= t("shared.outline.proposals") %></h1>
<% if @search_terms || @advanced_search_terms || @tag_filter || params[:retired].present? %> <% if @search_terms || @advanced_search_terms || @tag_filter || params[:retired].present? %>
<div class="highlight no-margin-top padding margin-bottom"> <div class="highlight no-margin-top padding margin-bottom">

View File

@@ -9,7 +9,7 @@
</div> </div>
<ul class="menu simple clear"> <ul class="menu simple clear">
<li class="sr-only"><span class="translation_missing" title="translation missing: es.admin.legislation.processes.index.filter">Filter</span>: </li> <li class="show-for-sr"><span class="translation_missing" title="translation missing: es.admin.legislation.processes.index.filter">Filter</span>: </li>
<li class="active">Abiertos</li> <li class="active">Abiertos</li>
<li><a href="/admin/legislation/processes?filter=next&amp;page=1">Próximamente</a></li> <li><a href="/admin/legislation/processes?filter=next&amp;page=1">Próximamente</a></li>
<li><a href="/admin/legislation/processes?filter=past&amp;page=1">Pasados</a></li> <li><a href="/admin/legislation/processes?filter=past&amp;page=1">Pasados</a></li>

View File

@@ -14,7 +14,7 @@
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<h3 class="quiz-question">¿Considera necesario realizar una nueva regulación para facilitar y simplificar las obras en viviendas, o la modificación y apertura de locales comerciales o empresariales?</h3> <h3 class="quiz-question">¿Considera necesario realizar una nueva regulación para facilitar y simplificar las obras en viviendas, o la modificación y apertura de locales comerciales o empresariales?</h3>
<div class="debate-questions"> <div class="debate-questions">
<form class="controls-stacked"> <form class="controls-stacked">
<label class="active control radio"> <label class="active control radio">
<input id="quiz-1" name="radio" type="radio"> <input id="quiz-1" name="radio" type="radio">
<span class="control-indicator"></span> <span class="control-indicator"></span>
@@ -33,15 +33,15 @@
</form> </form>
</div> </div>
</div> </div>
<aside class="small-12 medium-3 column"> <aside class="small-12 medium-3 column">
<div id="social-share" class="sidebar-divider"></div> <div id="social-share" class="sidebar-divider"></div>
<h3>Compartir</h3> <h3>Compartir</h3>
<div class="social-share-full"> <div class="social-share-full">
<div class="social-share-button" data-title="Soluta sed sapiente dolores. #consul_dev" data-img="" data-url="" data-desc="" data-via=""> <div class="social-share-button" data-title="Soluta sed sapiente dolores. #consul_dev" data-img="" data-url="" data-desc="" data-via="">
<a rel="nofollow " data-site="twitter" class="ssb-icon ssb-twitter" onclick="return SocialShareButton.share(this);" title="Compartir en Twitter" href="#"><span class="sr-only">twitter</span></a> <a rel="nofollow " data-site="twitter" class="ssb-icon ssb-twitter" onclick="return SocialShareButton.share(this);" title="Compartir en Twitter" href="#"><span class="show-for-sr">twitter</span></a>
<a rel="nofollow " data-site="facebook" class="ssb-icon ssb-facebook" onclick="return SocialShareButton.share(this);" title="Compartir en Facebook" href="#"><span class="sr-only">facebook</span></a> <a rel="nofollow " data-site="facebook" class="ssb-icon ssb-facebook" onclick="return SocialShareButton.share(this);" title="Compartir en Facebook" href="#"><span class="show-for-sr">facebook</span></a>
<a rel="nofollow " data-site="google_plus" class="ssb-icon ssb-google_plus" onclick="return SocialShareButton.share(this);" title="Compartir en Google+" href="#"><span class="sr-only">google_plus</span></a> <a rel="nofollow " data-site="google_plus" class="ssb-icon ssb-google_plus" onclick="return SocialShareButton.share(this);" title="Compartir en Google+" href="#"><span class="show-for-sr">google_plus</span></a>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,5 +1,5 @@
<ul class="menu simple clear" id="filter-subnav"> <ul class="menu simple clear" id="filter-subnav">
<li class="sr-only"><%= t("#{i18n_namespace}.filter") %>: </li> <li class="show-for-sr"><%= t("#{i18n_namespace}.filter") %>: </li>
<% @valid_filters.each do |filter| %> <% @valid_filters.each do |filter| %>
<% if @current_filter == filter %> <% if @current_filter == filter %>

View File

@@ -1,5 +1,5 @@
<ul class="menu vertical clear"> <ul class="menu vertical clear">
<li class="sr-only"><%= t("#{i18n_namespace}.filter") %>: </li> <li class="show-for-sr"><%= t("#{i18n_namespace}.filter") %>: </li>
<% @valid_filters.each do |filter| %> <% @valid_filters.each do |filter| %>
<% if @current_filter == filter %> <% if @current_filter == filter %>

View File

@@ -1,5 +1,5 @@
<form class="inline-block"> <form class="inline-block">
<label for="order-selector-participation" class="sr-only"><%= t("#{i18n_namespace}.select_order") %></label> <label for="order-selector-participation" class="show-for-sr"><%= t("#{i18n_namespace}.select_order") %></label>
<select class="js-location-changer js-order-selector select-order" <select class="js-location-changer js-order-selector select-order"
data-order="<%= @current_order %>" data-order="<%= @current_order %>"
name="order-selector" name="order-selector"

View File

@@ -1,12 +1,12 @@
<div id="search_form" class="search-form-header"> <div id="search_form" class="search-form-header">
<h1 class="sr-only"><%= t("shared.outline.searcher") %></h1> <h1 class="show-for-sr"><%= t("shared.outline.searcher") %></h1>
<%= form_tag search_path, method: :get do %> <%= form_tag search_path, method: :get do %>
<div class="input-group"> <div class="input-group">
<label for="search_text" class="sr-only"><%= t("#{i18n_namespace}.title") %></label> <label for="search_text" class="show-for-sr"><%= t("#{i18n_namespace}.title") %></label>
<input type="text" name="search" placeholder='<%= t("#{i18n_namespace}.placeholder") %>' class="input-group-field" value="<%= params[:search] %>" id="search_text"> <input type="text" name="search" placeholder='<%= t("#{i18n_namespace}.placeholder") %>' class="input-group-field" value="<%= params[:search] %>" id="search_text">
<div class="input-group-button"> <div class="input-group-button">
<button type="submit" class="button" title="<%= t("#{i18n_namespace}.button") %>"> <button type="submit" class="button" title="<%= t("#{i18n_namespace}.button") %>">
<span class="sr-only"><%= t("#{i18n_namespace}.button") %></span> <span class="show-for-sr"><%= t("#{i18n_namespace}.button") %></span>
<span class="icon-search"></span> <span class="icon-search"></span>
</button> </button>
</div> </div>

View File

@@ -7,6 +7,6 @@
<a href="whatsapp://send?text=<%= title.gsub(/\s/, '%20') %>&nbsp;<%= url %>" <a href="whatsapp://send?text=<%= title.gsub(/\s/, '%20') %>&nbsp;<%= url %>"
class="show-for-small-only" data-action="share/whatsapp/share"> class="show-for-small-only" data-action="share/whatsapp/share">
<span class="icon-whatsapp whatsapp"></span> <span class="icon-whatsapp whatsapp"></span>
<span class="sr-only"><%= t("social.whatsapp") %></span> <span class="show-for-sr"><%= t("social.whatsapp") %></span>
</a> </a>
</div> </div>

View File

@@ -6,7 +6,7 @@
<% end %> <% end %>
<main> <main>
<h1 class="sr-only"><%= t("shared.outline.budget") %></h1> <h1 class="show-for-sr"><%= t("shared.outline.budget") %></h1>
<div class="row"> <div class="row">
<div id="investment-projects" class="investment-projects-list small-12 medium-9 column"> <div id="investment-projects" class="investment-projects-list small-12 medium-9 column">

View File

@@ -53,7 +53,7 @@
<div class="inline-block" data-toggle="info-document-number"> <div class="inline-block" data-toggle="info-document-number">
<span class="icon-help"></span> <span class="icon-help"></span>
<span class="sr-only"><%= t("verification.residence.new.document_number_help_title") %></span> <span class="show-for-sr"><%= t("verification.residence.new.document_number_help_title") %></span>
</div> </div>
<div class="dropdown-pane" id="info-document-number" data-dropdown <div class="dropdown-pane" id="info-document-number" data-dropdown

View File

@@ -113,6 +113,7 @@ en:
description: "Description" description: "Description"
terms_of_service: "Terms of service" terms_of_service: "Terms of service"
user: user:
login: "Email or username"
email: "Email" email: "Email"
username: "Username" username: "Username"
password_confirmation: "Password confirmation" password_confirmation: "Password confirmation"

View File

@@ -108,6 +108,7 @@ es:
description: "Descripción" description: "Descripción"
terms_of_service: "Términos de servicio" terms_of_service: "Términos de servicio"
user: user:
login: Email o nombre de usuario
email: "Correo electrónico" email: "Correo electrónico"
username: "Nombre de usuario" username: "Nombre de usuario"
password_confirmation: "Confirmación de contraseña" password_confirmation: "Confirmación de contraseña"

View File

@@ -68,7 +68,7 @@ en:
title: Forgotten password? title: Forgotten password?
sessions: sessions:
new: new:
email_label: Email login_label: Email or username
password_label: Password password_label: Password
remember_me: Remember me remember_me: Remember me
submit: Enter submit: Enter

View File

@@ -68,7 +68,7 @@ es:
title: "¿Has olvidado tu contraseña?" title: "¿Has olvidado tu contraseña?"
sessions: sessions:
new: new:
email_label: Email login_label: Email o nombre de usuario
password_label: Contraseña password_label: Contraseña
remember_me: Recordarme remember_me: Recordarme
submit: Entrar submit: Entrar

View File

@@ -138,6 +138,6 @@ feature 'Account' do
login_through_form_as(@user) login_through_form_as(@user)
expect(page).to have_content "Invalid email or password" expect(page).to have_content "Invalid login or password"
end end
end end

View File

@@ -42,7 +42,11 @@ feature 'Stats' do
expect(page).to have_content "Total votes 6" expect(page).to have_content "Total votes 6"
end end
scenario 'Users' do end
context "Users" do
scenario 'Summary' do
1.times { create(:user, :level_three) } 1.times { create(:user, :level_three) }
2.times { create(:user, :level_two) } 2.times { create(:user, :level_two) }
3.times { create(:user) } 3.times { create(:user) }
@@ -56,18 +60,46 @@ feature 'Stats' do
expect(page).to have_content "Total users 7" expect(page).to have_content "Total users 7"
end end
end scenario "Do not count erased users" do
1.times { create(:user, :level_three, erased_at: Time.current) }
2.times { create(:user, :level_two, erased_at: Time.current) }
3.times { create(:user, erased_at: Time.current) }
scenario 'Level 2 user' do visit admin_stats_path
create(:geozone)
visit account_path
click_link 'Verify my account'
verify_residence
confirm_phone
visit admin_stats_path expect(page).to have_content "Level three users 0"
expect(page).to have_content "Level two users 0"
expect(page).to have_content "Verified users 0"
expect(page).to have_content "Unverified users 1"
expect(page).to have_content "Total users 1"
end
scenario "Do not count hidden users" do
1.times { create(:user, :level_three, hidden_at: Time.current) }
2.times { create(:user, :level_two, hidden_at: Time.current) }
3.times { create(:user, hidden_at: Time.current) }
visit admin_stats_path
expect(page).to have_content "Level three users 0"
expect(page).to have_content "Level two users 0"
expect(page).to have_content "Verified users 0"
expect(page).to have_content "Unverified users 1"
expect(page).to have_content "Total users 1"
end
scenario 'Level 2 user Graph' do
create(:geozone)
visit account_path
click_link 'Verify my account'
verify_residence
confirm_phone
visit admin_stats_path
expect(page).to have_content "Level 2 User (1)"
end
expect(page).to have_content "Level 2 User (1)"
end end
context "Proposal notifications" do context "Proposal notifications" do

View File

@@ -42,11 +42,11 @@ feature 'Moderate users' do
visit root_path visit root_path
click_link 'Sign in' click_link 'Sign in'
fill_in 'user_email', with: citizen.email fill_in 'user_login', with: citizen.email
fill_in 'user_password', with: citizen.password fill_in 'user_password', with: citizen.password
click_button 'Enter' click_button 'Enter'
expect(page).to have_content 'Invalid email or password' expect(page).to have_content 'Invalid login or password'
expect(current_path).to eq(new_user_session_path) expect(current_path).to eq(new_user_session_path)
end end

View File

@@ -3,43 +3,102 @@ require 'rails_helper'
feature 'Users' do feature 'Users' do
context 'Regular authentication' do context 'Regular authentication' do
scenario 'Sign up' do context 'Sign up' do
visit '/'
click_link 'Register'
fill_in 'user_username', with: 'Manuela Carmena' scenario 'Success' do
fill_in 'user_email', with: 'manuela@consul.dev' visit '/'
fill_in 'user_password', with: 'judgementday' click_link 'Register'
fill_in 'user_password_confirmation', with: 'judgementday'
check 'user_terms_of_service'
click_button 'Register' fill_in 'user_username', with: 'Manuela Carmena'
fill_in 'user_email', with: 'manuela@consul.dev'
fill_in 'user_password', with: 'judgementday'
fill_in 'user_password_confirmation', with: 'judgementday'
check 'user_terms_of_service'
expect(page).to have_content "You have been sent a message containing a verification link. Please click on this link to activate your account." click_button 'Register'
confirm_email expect(page).to have_content "You have been sent a message containing a verification link. Please click on this link to activate your account."
confirm_email
expect(page).to have_content "Your account has been confirmed."
end
scenario 'Errors on sign up' do
visit '/'
click_link 'Register'
click_button 'Register'
expect(page).to have_content error_message
end
expect(page).to have_content "Your account has been confirmed."
end end
scenario 'Errors on sign up' do context 'Sign in' do
visit '/'
click_link 'Register'
click_button 'Register'
expect(page).to have_content error_message scenario 'sign in with email' do
end create(:user, email: 'manuela@consul.dev', password: 'judgementday')
scenario 'Sign in' do visit '/'
create(:user, email: 'manuela@consul.dev', password: 'judgementday') click_link 'Sign in'
fill_in 'user_login', with: 'manuela@consul.dev'
fill_in 'user_password', with: 'judgementday'
click_button 'Enter'
visit '/' expect(page).to have_content 'You have been signed in successfully.'
click_link 'Sign in' end
fill_in 'user_email', with: 'manuela@consul.dev'
fill_in 'user_password', with: 'judgementday'
click_button 'Enter'
expect(page).to have_content 'You have been signed in successfully.' scenario 'Sign in with username' do
create(:user, username: '👻👽👾🤖', email: 'ash@nostromo.dev', password: 'xenomorph')
visit '/'
click_link 'Sign in'
fill_in 'user_login', with: '👻👽👾🤖'
fill_in 'user_password', with: 'xenomorph'
click_button 'Enter'
expect(page).to have_content 'You have been signed in successfully.'
end
scenario 'Avoid username-email collisions' do
u1 = create(:user, username: 'Spidey', email: 'peter@nyc.dev', password: 'greatpower')
u2 = create(:user, username: 'peter@nyc.dev', email: 'venom@nyc.dev', password: 'symbiote')
visit '/'
click_link 'Sign in'
fill_in 'user_login', with: 'peter@nyc.dev'
fill_in 'user_password', with: 'greatpower'
click_button 'Enter'
expect(page).to have_content 'You have been signed in successfully.'
visit account_path
expect(page).to have_link 'My activity', href: user_path(u1)
visit '/'
click_link 'Sign out'
expect(page).to have_content 'You have been signed out successfully.'
click_link 'Sign in'
fill_in 'user_login', with: 'peter@nyc.dev'
fill_in 'user_password', with: 'symbiote'
click_button 'Enter'
expect(page).to_not have_content 'You have been signed in successfully.'
expect(page).to have_content 'Invalid login or password.'
fill_in 'user_login', with: 'venom@nyc.dev'
fill_in 'user_password', with: 'symbiote'
click_button 'Enter'
expect(page).to have_content 'You have been signed in successfully.'
visit account_path
expect(page).to have_link 'My activity', href: user_path(u2)
end
end end
end end

View File

@@ -18,7 +18,7 @@ feature "Welcome screen" do
visit email_path(email_verification_token: encrypted) visit email_path(email_verification_token: encrypted)
fill_in 'user_email', with: user.email fill_in 'user_login', with: user.email
fill_in 'user_password', with: user.password fill_in 'user_password', with: user.password
click_button 'Enter' click_button 'Enter'

View File

@@ -18,7 +18,7 @@ module CommonActions
visit root_path visit root_path
click_link 'Sign in' click_link 'Sign in'
fill_in 'user_email', with: user.email fill_in 'user_login', with: user.email
fill_in 'user_password', with: user.password fill_in 'user_password', with: user.password
click_button 'Enter' click_button 'Enter'