diff --git a/app/assets/stylesheets/participacion.scss b/app/assets/stylesheets/participacion.scss index e405fb023..bd8759c98 100644 --- a/app/assets/stylesheets/participacion.scss +++ b/app/assets/stylesheets/participacion.scss @@ -16,6 +16,7 @@ // 14. Tables // 15. Social // 16. Pages +// 17. Verification // // 01. Variables @@ -126,6 +127,7 @@ h6 { } .button { + font-size: rem-calc(13); padding: rem-calc(15) rem-calc(32); } @@ -221,6 +223,11 @@ h6 { } } +.progress { + background-color: rgba(0,0,0,.06); + border: 0; +} + // 04. Header // - - - - - - - - - - - - - - - - - - - - - - - - - @@ -866,22 +873,8 @@ form { margin-right: rem-calc(12); } - .date { - - select { - float: left; - width: 25%; - } - } - .verify-account { padding-right: rem-calc(12); - - .verified { - color: $check; - font-weight: bold; - line-height: rem-calc(42); - } } } @@ -1180,3 +1173,92 @@ table { } } } + +// 17. Verification +// - - - - - - - - - - - - - - - - - - - - - - - - - + +.verification { + min-height: 60%; + + @media (min-width: $small-breakpoint) { + .left + .left { + margin-left: rem-calc(12); + } + } + + .verify-account { + padding-right: rem-calc(12); + + .verified { + color: $check; + font-weight: bold; + line-height: rem-calc(42); + } + } + + .date { + + select { + float: left; + width: 30%; + + @media (min-width: $small-breakpoint) { + width: 25%; + } + } + } + + .progress { + height: rem-calc(48); + + @media (min-width: $small-breakpoint) { + height: rem-calc(24); + } + + .meter { + background: #63D1C4; + } + } + + .verification-step { + font-size: rem-calc(11); + padding-top: rem-calc(10); + + @media (min-width: $small-breakpoint) { + line-height: $line-height; + padding-top: 0; + } + + &.active { + color: white; + } + + &.completed { + color: rgba(255,255,255,.5); + } + } + + .send-letter { + background: none; + color: $link; + + &:hover { + color: $link-hover; + } + } + + .button + form { + display: inline-block; + margin-left: rem-calc(12); + } + + .verification-list { + font-size: rem-calc(13); + list-style-type: none; + margin-left: 0; + + span { + display: inline-block; + } + } +} diff --git a/app/controllers/admin/comments_controller.rb b/app/controllers/admin/comments_controller.rb index 40f9b31dc..0399ccd63 100644 --- a/app/controllers/admin/comments_controller.rb +++ b/app/controllers/admin/comments_controller.rb @@ -1,11 +1,11 @@ class Admin::CommentsController < Admin::BaseController - before_filter :set_valid_filters, only: :index - before_filter :parse_filter, only: :index + + has_filters %w{all with_confirmed_hide} before_filter :load_comment, only: [:confirm_hide, :restore] def index - @comments = Comment.only_hidden.send(@filter).page(params[:page]) + @comments = Comment.only_hidden.send(@current_filter).page(params[:page]) end def confirm_hide @@ -23,13 +23,4 @@ class Admin::CommentsController < Admin::BaseController @comment = Comment.with_hidden.find(params[:id]) end - def set_valid_filters - @valid_filters = %w{all with_confirmed_hide} - end - - def parse_filter - @filter = params[:filter] - @filter = 'all' unless @valid_filters.include?(@filter) - end - end diff --git a/app/controllers/admin/debates_controller.rb b/app/controllers/admin/debates_controller.rb index 4487fcf81..23edb01f5 100644 --- a/app/controllers/admin/debates_controller.rb +++ b/app/controllers/admin/debates_controller.rb @@ -1,11 +1,10 @@ class Admin::DebatesController < Admin::BaseController - before_filter :set_valid_filters, only: :index - before_filter :parse_filter, only: :index + has_filters %w{all with_confirmed_hide}, only: :index before_filter :load_debate, only: [:confirm_hide, :restore] def index - @debates = Debate.only_hidden.send(@filter).page(params[:page]) + @debates = Debate.only_hidden.send(@current_filter).page(params[:page]) end def confirm_hide @@ -24,13 +23,4 @@ class Admin::DebatesController < Admin::BaseController @debate = Debate.with_hidden.find(params[:id]) end - def set_valid_filters - @valid_filters = %w{all with_confirmed_hide} - end - - def parse_filter - @filter = params[:filter] - @filter = 'all' unless @valid_filters.include?(@filter) - end - end diff --git a/app/controllers/admin/organizations_controller.rb b/app/controllers/admin/organizations_controller.rb index bb623702a..0e704e9a1 100644 --- a/app/controllers/admin/organizations_controller.rb +++ b/app/controllers/admin/organizations_controller.rb @@ -1,11 +1,11 @@ class Admin::OrganizationsController < Admin::BaseController - before_filter :set_valid_filters, only: :index - before_filter :parse_filter, only: :index + + has_filters %w{all pending verified rejected}, only: :index load_and_authorize_resource except: :search def index - @organizations = @organizations.send(@filter) + @organizations = @organizations.send(@current_filter) @organizations = @organizations.includes(:user).order(:name, 'users.email').page(params[:page]) end @@ -23,14 +23,4 @@ class Admin::OrganizationsController < Admin::BaseController redirect_to request.query_parameters.merge(action: :index) end - private - def set_valid_filters - @valid_filters = %w{all pending verified rejected} - end - - def parse_filter - @filter = params[:filter] - @filter = 'all' unless @valid_filters.include?(@filter) - end - end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 61c0f5650..ecf7f206a 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,11 +1,11 @@ class Admin::UsersController < Admin::BaseController - before_filter :set_valid_filters, only: :index - before_filter :parse_filter, only: :index + + has_filters %w{all with_confirmed_hide}, only: :index before_filter :load_user, only: [:confirm_hide, :restore] def index - @users = User.only_hidden.send(@filter).page(params[:page]) + @users = User.only_hidden.send(@current_filter).page(params[:page]) end def show @@ -30,13 +30,4 @@ class Admin::UsersController < Admin::BaseController @user = User.with_hidden.find(params[:id]) end - def set_valid_filters - @valid_filters = %w{all with_confirmed_hide} - end - - def parse_filter - @filter = params[:filter] - @filter = 'all' unless @valid_filters.include?(@filter) - end - end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5d207e463..86219f0ad 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,8 @@ require "application_responder" class ApplicationController < ActionController::Base + include HasFilters + before_filter :authenticate_http_basic before_filter :authenticate_user!, unless: :devise_controller?, if: :beta_site? diff --git a/app/controllers/concerns/has_filters.rb b/app/controllers/concerns/has_filters.rb new file mode 100644 index 000000000..3dd3cc295 --- /dev/null +++ b/app/controllers/concerns/has_filters.rb @@ -0,0 +1,13 @@ +module HasFilters + extend ActiveSupport::Concern + + class_methods do + def has_filters(valid_filters, *args) + before_filter(*args) do + @valid_filters = valid_filters + @current_filter = params[:filter] + @current_filter = @valid_filters.first unless @valid_filters.include?(@current_filter) + end + end + end +end diff --git a/app/controllers/moderation/comments_controller.rb b/app/controllers/moderation/comments_controller.rb index 3622d02ac..065516531 100644 --- a/app/controllers/moderation/comments_controller.rb +++ b/app/controllers/moderation/comments_controller.rb @@ -1,12 +1,12 @@ class Moderation::CommentsController < Moderation::BaseController - before_filter :set_valid_filters, only: :index - before_filter :parse_filter, only: :index + + has_filters %w{all pending_flag_review with_ignored_flag}, only: :index before_filter :load_comments, only: :index load_and_authorize_resource def index - @comments = @comments.send(@filter) + @comments = @comments.send(@current_filter) @comments = @comments.page(params[:page]) end @@ -30,13 +30,4 @@ class Moderation::CommentsController < Moderation::BaseController @comments = Comment.accessible_by(current_ability, :hide).flagged.sorted_for_moderation.includes(:commentable) end - def set_valid_filters - @valid_filters = %w{all pending_flag_review with_ignored_flag} - end - - def parse_filter - @filter = params[:filter] - @filter = 'all' unless @valid_filters.include?(@filter) - end - end diff --git a/app/controllers/moderation/debates_controller.rb b/app/controllers/moderation/debates_controller.rb index abb8e964b..5fdd19049 100644 --- a/app/controllers/moderation/debates_controller.rb +++ b/app/controllers/moderation/debates_controller.rb @@ -1,13 +1,13 @@ class Moderation::DebatesController < Moderation::BaseController - before_filter :set_valid_filters, only: :index - before_filter :parse_filter, only: :index + + has_filters %w{all pending_flag_review with_ignored_flag}, only: :index + before_filter :load_debates, only: :index load_and_authorize_resource def index - @debates = @debates.send(@filter) - @debates = @debates.page(params[:page]) + @debates = @debates.send(@current_filter).page(params[:page]) end def hide @@ -30,13 +30,4 @@ class Moderation::DebatesController < Moderation::BaseController @debates = Debate.accessible_by(current_ability, :hide).flagged.sorted_for_moderation end - def set_valid_filters - @valid_filters = %w{all pending_flag_review with_ignored_flag} - end - - def parse_filter - @filter = params[:filter] - @filter = 'all' unless @valid_filters.include?(@filter) - end - end diff --git a/app/controllers/verification/letter_controller.rb b/app/controllers/verification/letter_controller.rb index 401ae0ed2..152590b20 100644 --- a/app/controllers/verification/letter_controller.rb +++ b/app/controllers/verification/letter_controller.rb @@ -26,7 +26,7 @@ class Verification::LetterController < ApplicationController def verify_phone_or_email! unless current_user.confirmed_phone? - redirect_to verified_user_path, alert: t('verification.letter.alert.unconfirmed_personal_data') + redirect_to verified_user_path, alert: t('verification.letter.alert.unconfirmed_code') end end end \ No newline at end of file diff --git a/app/models/debate.rb b/app/models/debate.rb index e088d8141..9c96c812c 100644 --- a/app/models/debate.rb +++ b/app/models/debate.rb @@ -75,7 +75,9 @@ class Debate < ActiveRecord::Base end def votable_by?(user) - !user.unverified? || + total_votes <= 100 || + !user.unverified? || + Setting.value_for('max_ratio_anon_votes_on_debates').to_i == 100 || anonymous_votes_ratio < Setting.value_for('max_ratio_anon_votes_on_debates').to_i || user.voted_for?(self) end diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb index bf749bbd2..41ae068c0 100644 --- a/app/views/account/show.html.erb +++ b/app/views/account/show.html.erb @@ -1,21 +1,26 @@
- <%= link_to t("account.show.change_credentials_link"), edit_user_registration_path, class: 'button radius small secondary right' %> + <%= link_to t("account.show.change_credentials_link"), edit_user_registration_path, class: "button radius small secondary right" %> - +
+ +

<%= t("account.show.title") %>

<%= form_for @account, as: :account, url: account_path do |f| %> - <%= render 'shared/errors', resource: @account %> + <%= render "shared/errors", resource: @account %>
diff --git a/app/views/admin/comments/index.html.erb b/app/views/admin/comments/index.html.erb index 87178c66b..f0639047f 100644 --- a/app/views/admin/comments/index.html.erb +++ b/app/views/admin/comments/index.html.erb @@ -1,17 +1,6 @@

<%= t("admin.comments.index.title") %>

- +<%= render 'shared/filter_subnav', i18n_namespace: "admin.comments.index" %>

<%= page_entries_info @comments %>

diff --git a/app/views/admin/debates/index.html.erb b/app/views/admin/debates/index.html.erb index 9ac89b5e1..7caa8ecc3 100644 --- a/app/views/admin/debates/index.html.erb +++ b/app/views/admin/debates/index.html.erb @@ -1,17 +1,6 @@

<%= t("admin.debates.index.title") %>

- +<%= render 'shared/filter_subnav', i18n_namespace: "admin.debates.index" %>

<%= page_entries_info @debates %>

diff --git a/app/views/admin/organizations/index.html.erb b/app/views/admin/organizations/index.html.erb index 524d65a68..464168746 100644 --- a/app/views/admin/organizations/index.html.erb +++ b/app/views/admin/organizations/index.html.erb @@ -13,18 +13,7 @@ <% end %> - +<%= render 'shared/filter_subnav', i18n_namespace: "admin.organizations.index" %>

<%= page_entries_info @organizations %>

diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb index b6f3f1cfe..0d18c8b61 100644 --- a/app/views/admin/users/index.html.erb +++ b/app/views/admin/users/index.html.erb @@ -1,17 +1,6 @@

<%= t("admin.users.index.title") %>

- +<%= render 'shared/filter_subnav', i18n_namespace: "admin.users.index" %>

<%= page_entries_info @users %>

diff --git a/app/views/moderation/comments/index.html.erb b/app/views/moderation/comments/index.html.erb index da2bb8251..ec642077b 100644 --- a/app/views/moderation/comments/index.html.erb +++ b/app/views/moderation/comments/index.html.erb @@ -1,17 +1,6 @@

<%= t("moderation.comments.index.title") %>

- +<%= render 'shared/filter_subnav', i18n_namespace: "moderation.comments.index" %>

<%= page_entries_info @comments %>

diff --git a/app/views/moderation/debates/index.html.erb b/app/views/moderation/debates/index.html.erb index 8fb013605..3fc3f402b 100644 --- a/app/views/moderation/debates/index.html.erb +++ b/app/views/moderation/debates/index.html.erb @@ -1,17 +1,6 @@

<%= t("moderation.debates.index.title") %>

- +<%= render 'shared/filter_subnav', i18n_namespace: "moderation.debates.index" %>

<%= page_entries_info @debates %>

diff --git a/app/views/shared/_filter_subnav.html.erb b/app/views/shared/_filter_subnav.html.erb new file mode 100644 index 000000000..0f8975aa3 --- /dev/null +++ b/app/views/shared/_filter_subnav.html.erb @@ -0,0 +1,17 @@ +<% # Params: + # + # i18n_namespace: for example "moderation.debates.index" +%> + + diff --git a/app/views/verification/letter/new.html.erb b/app/views/verification/letter/new.html.erb index 31a82be63..850ec75bf 100644 --- a/app/views/verification/letter/new.html.erb +++ b/app/views/verification/letter/new.html.erb @@ -1,15 +1,49 @@ -