Merge branch 'master' into issue#1575-tag-administration

This commit is contained in:
Raimond Garcia
2017-06-29 19:09:54 +02:00
committed by GitHub
192 changed files with 1260 additions and 738 deletions

View File

@@ -102,27 +102,47 @@
.annotator-hl {
cursor: pointer;
background: rgba(255, 255, 10, 0.2);
}
background: rgba(255, 249, 218, 0.75);
.annotator-hl.weight-1 {
background: #fff9da;
}
&.weight-1 {
background: hsla(50, 100, 93, 0.5);
.annotator-hl.weight-2 {
background: #fff5bc;
}
.weight-1 {
background: hsla(50, 100, 93, 0.75);
}
}
.annotator-hl.weight-3 {
background: #fff1a2;
}
&.weight-2 {
background: hsla(63, 78, 86, 0.5);
.annotator-hl.weight-4 {
background: #ffef8c;
}
.weight-2 {
background: hsla(63, 78, 86, 0.75);
}
}
.annotator-hl.weight-5 {
background: #ffe95f;
&.weight-3 {
background: hsla(52, 100, 85, 0.5);
.weight-3 {
background: hsla(52, 100, 85, 0.75);
}
}
&.weight-4 {
background: hsla(51, 91, 75, 0.5);
.weight-4 {
background: hsla(51, 91, 75, 0.75);
}
}
&.weight-5 {
background: hsla(46, 83, 60, 0.5);
.weight-5 {
background: hsla(46, 83, 60, 0.5);
}
}
}
.current-annotation {

View File

@@ -806,7 +806,7 @@ form {
}
}
[type]:not([type=submit]):not([type=file]):not([type=checkbox]):not([type=radio]) {
[type]:not([type=submit]):not([type=file]):not([type=checkbox]):not([type=radio]):not(.close-button) {
background: #f8f8f8;
height: $line-height * 2;
margin-bottom: rem-calc(16);
@@ -825,23 +825,6 @@ form {
margin: $line-height / 2 0 $line-height / 2 $line-height / 4;
}
.note,
.note-marked {
display: block;
font-size: rem-calc(13);
margin-bottom: $line-height / 2;
}
.note-marked {
background: #ff0;
display: inline-block;
em {
background: #fff;
display: block;
}
}
.ckeditor {
min-height: $line-height * 13;
}
@@ -893,7 +876,7 @@ form {
.callout {
font-size: $small-font-size;
a {
a:not(.button) {
font-weight: bold;
text-decoration: underline;
}
@@ -945,6 +928,14 @@ form {
}
}
.callout {
&.highlight,
&.light {
border: 0;
}
}
// 08. User account
// ----------------

View File

@@ -494,6 +494,109 @@
}
}
.tab-milestones ul {
margin-top: rem-calc(40);
position: relative;
li {
margin: 0 auto;
position: relative;
width: 0;
}
li::before {
background: $budget;
border-radius: rem-calc(20);
content: '';
height: rem-calc(20);
position: absolute;
top: 5px;
transform: translateX(-50%);
width: rem-calc(20);
z-index: 2;
}
li::after {
background: $light-gray;
bottom: 100%;
content: '';
height: 100%;
position: absolute;
top: 25px;
width: 1px;
z-index: 1;
}
}
.tab-milestones ul .milestone-content {
padding: $line-height / 6 $line-height / 2;
position: relative;
h3 {
margin-bottom: 0;
}
.milestone-date {
color: $text-medium;
font-size: $small-font-size;
}
}
.tab-milestones .timeline ul li:nth-child(odd),
.tab-milestones .timeline ul li:nth-child(even) {
.milestone-content {
@include breakpoint(medium) {
width: rem-calc(300);
}
@include breakpoint(large) {
width: rem-calc(450);
}
}
}
.tab-milestones .timeline ul li:nth-child(odd) {
.milestone-content {
text-align: right;
@include breakpoint(medium) {
margin-left: rem-calc(-315);
}
@include breakpoint(large) {
margin-left: rem-calc(-465);
}
}
}
.tab-milestones .timeline ul li:nth-child(even) {
.milestone-content {
left: 15px;
}
}
.tab-milestones {
@include breakpoint(small only) {
.timeline ul li {
width: 100%;
&:nth-child(odd),
&:nth-child(even) {
.milestone-content {
left: 15px;
text-align: left;
}
}
}
}
}
// 04. List participation
// ----------------------

View File

@@ -12,7 +12,7 @@ class Admin::BudgetHeadingsController < Admin::BaseController
private
def budget_heading_params
params.require(:budget_heading).permit(:name, :price, :geozone_id)
params.require(:budget_heading).permit(:name, :price, :population)
end
end
end

View File

@@ -0,0 +1,55 @@
class Admin::BudgetInvestmentMilestonesController < Admin::BaseController
before_action :load_budget_investment, only: [:index, :new, :create, :edit, :update, :destroy]
before_action :load_budget_investment_milestone, only: [:edit, :update, :destroy]
def index
end
def new
@milestone = Budget::Investment::Milestone.new
end
def create
@milestone = Budget::Investment::Milestone.new(milestone_params)
@milestone.investment = @investment
if @milestone.save
redirect_to admin_budget_budget_investment_path(@investment.budget, @investment), notice: t('admin.milestones.create.notice')
else
render :new
end
end
def edit
end
def update
if @milestone.update(milestone_params)
redirect_to admin_budget_budget_investment_path(@investment.budget, @investment), notice: t('admin.milestones.update.notice')
else
render :edit
end
end
def destroy
@milestone.destroy
redirect_to admin_budget_budget_investment_path(@investment.budget, @investment), notice: t('admin.milestones.delete.notice')
end
private
def milestone_params
params.require(:budget_investment_milestone)
.permit(:title, :description, :budget_investment_id)
end
def load_budget_investment
@investment = Budget::Investment.find params[:budget_investment_id]
end
def load_budget_investment_milestone
@milestone = Budget::Investment::Milestone.find params[:id]
end
end

View File

@@ -14,10 +14,15 @@ class Admin::BudgetsController < Admin::BaseController
@budget = Budget.includes(groups: :headings).find(params[:id])
end
def new
end
def new; end
def edit
def edit; end
def calculate_winners
return unless @budget.balloting_process?
@budget.headings.each { |heading| Budget::Result.new(@budget, heading).calculate_winners }
redirect_to admin_budget_budget_investments_path(budget_id: @budget.id, filter: 'winners'),
notice: I18n.t("admin.budgets.winners.calculated")
end
def update

View File

@@ -60,13 +60,14 @@ class Admin::Poll::PollsController < Admin::BaseController
end
def search_questions
@questions = ::Poll::Question.where("poll_id IS ? OR poll_id != ?", nil, @poll.id).search({search: @search}).order(title: :asc)
@questions = ::Poll::Question.where("poll_id IS ? OR poll_id != ?", nil, @poll.id).search(search: @search).order(title: :asc)
respond_to do |format|
format.js
end
end
private
def load_geozones
@geozones = Geozone.all.order(:name)
end

View File

@@ -1,7 +1,7 @@
class Admin::SettingsController < Admin::BaseController
def index
all_settings = (Setting.all).group_by { |s| s.type }
all_settings = (Setting.all).group_by { |s| s.type }
@settings = all_settings['common']
@feature_flags = all_settings['feature']
@banner_styles = all_settings['banner-style']

View File

@@ -4,7 +4,7 @@ class Admin::UsersController < Admin::BaseController
def index
if params[:search]
s = params[:search]
@users = User.where("username ILIKE ? OR email ILIKE ? OR document_number ILIKE ?", "%#{s}%","%#{s}%","%#{s}%").page(params[:page])
@users = User.where("username ILIKE ? OR email ILIKE ? OR document_number ILIKE ?", "%#{s}%", "%#{s}%", "%#{s}%").page(params[:page])
else
@users = @users.page(params[:page])
end

View File

@@ -93,7 +93,7 @@ module Budgets
def set_random_seed
if params[:order] == 'random' || params[:order].blank?
params[:random_seed] ||= rand(99)/100.0
params[:random_seed] ||= rand(99) / 100.0
seed = Float(params[:random_seed]) rescue 0
Budget::Investment.connection.execute("select setseed(#{seed})")
else

View File

@@ -36,7 +36,7 @@ class GraphqlController < ApplicationController
def query_string
if request.headers["CONTENT_TYPE"] == 'application/graphql'
request.body.string # request.body.class => StringIO
request.body.string # request.body.class => StringIO
else
params[:query]
end

View File

@@ -19,13 +19,14 @@ class Legislation::AnswersController < Legislation::BaseController
end
else
respond_to do |format|
format.js { render json: {} , status: :not_found }
format.js { render json: {}, status: :not_found }
format.html { redirect_to legislation_process_question_path(@process, @question), alert: t('legislation.questions.participation.phase_not_open') }
end
end
end
private
def answer_params
params.require(:legislation_answer).permit(
:legislation_question_option_id,

View File

@@ -20,7 +20,7 @@ class Management::Budgets::InvestmentsController < Management::BaseController
@investment.author = managed_user
if @investment.save
notice= t('flash.actions.create.notice', resource_name: Budget::Investment.model_name.human, count: 1)
notice = t('flash.actions.create.notice', resource_name: Budget::Investment.model_name.human, count: 1)
redirect_to management_budget_investment_path(@budget, @investment), notice: notice
else
render :new

View File

@@ -28,6 +28,7 @@ class Officing::FinalRecountsController < Officing::BaseController
end
private
def load_poll
@poll = Poll.expired.find(params[:poll_id])
end

View File

@@ -27,6 +27,7 @@ class Officing::RecountsController < Officing::BaseController
end
private
def load_poll
@poll = Poll.find(params[:poll_id])
end

View File

@@ -14,10 +14,10 @@ class SandboxController < ApplicationController
def show
if params[:template].index('.') # CVE-2014-0130
render :action => "index"
render action: "index"
elsif lookup_context.exists?("sandbox/#{params[:template]}")
if params[:template] == "index"
render :action => "index"
render action: "index"
else
render "sandbox/#{params[:template]}"
end
@@ -25,7 +25,7 @@ class SandboxController < ApplicationController
elsif lookup_context.exists?("sandbox/#{params[:template]}/index")
render "sandbox/#{params[:template]}/index"
else
render :action => "index"
render action: "index"
end
end

View File

@@ -23,6 +23,6 @@ class StatsController < ApplicationController
private
def daily_cache(key, &block)
Rails.cache.fetch("public_stats/#{Time.current.strftime("%Y-%m-%d")}/#{key}", &block)
Rails.cache.fetch("public_stats/#{Time.current.strftime('%Y-%m-%d')}/#{key}", &block)
end
end

View File

@@ -30,7 +30,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
identity = Identity.first_or_create_from_oauth(auth)
@user = current_user || identity.user || User.first_or_initialize_for_oauth(auth)
if save_user(@user)
if save_user
identity.update(user: @user)
sign_in_and_redirect @user, event: :authentication
set_flash_message(:notice, :success, kind: "#{provider}".capitalize) if is_navigational_format?
@@ -40,8 +40,8 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
end
end
def save_user(user)
def save_user
@user.save || @user.save_requiring_finish_signup
end
end
end

View File

@@ -10,6 +10,7 @@ class UsersController < ApplicationController
end
private
def set_activity_counts
@activity_counts = HashWithIndifferentAccess.new(
proposals: Proposal.where(author_id: @user.id).count,
@@ -24,7 +25,7 @@ class UsersController < ApplicationController
when "proposals" then load_proposals
when "debates" then load_debates
when "budget_investments" then load_budget_investments
when "comments" then load_comments
when "comments" then load_comments
else load_available_activity
end
end

View File

@@ -58,7 +58,7 @@ class Valuation::SpendingProposalsController < Valuation::BaseController
end
def params_for_current_valuator
params.merge({valuator_id: current_user.valuator.id})
params.merge(valuator_id: current_user.valuator.id)
end
def restrict_access_to_assigned_items

View File

@@ -1,7 +1,7 @@
module BallotsHelper
def progress_bar_width(amount_available, amount_spent)
(amount_spent/amount_available.to_f * 100).to_s + "%"
(amount_spent / amount_available.to_f * 100).to_s + "%"
end
end

View File

@@ -1,11 +1,11 @@
module CacheKeysHelper
def locale_and_user_status(authorable=nil)
def locale_and_user_status(authorable = nil)
@cache_key_user ||= calculate_user_status(authorable)
"#{I18n.locale}/#{@cache_key_user}"
end
def calculate_user_status(authorable=nil)
def calculate_user_status(authorable = nil)
user_status = "user"
if user_signed_in?

View File

@@ -11,7 +11,7 @@ module EmbedVideosHelper
if server == "Vimeo"
reg_exp = /vimeo.*(staffpicks\/|channels\/|videos\/|video\/|\/)([^#\&\?]*).*/
src = "https://player.vimeo.com/video/"
src = "https://player.vimeo.com/video/"
elsif server == "YouTube"
reg_exp = /youtu.*(be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/
src = "https://www.youtube.com/embed/"

View File

@@ -13,7 +13,7 @@ module OfficingHelper
officer_assignments.each do |oa|
options << [oa.booth_assignment.booth.name.to_s, oa.id]
end
options.sort! {|x, y| x[0]<=>y[0]}
options.sort! {|x, y| x[0] <=> y[0]}
options_for_select(options, params[:oa])
end

View File

@@ -9,7 +9,7 @@ module PollRecountsHelper
end
def booth_assignment_sum_final_recounts(ba)
ba.final_recounts.any? ? ba.final_recounts.to_a.sum(&:count) :nil
ba.final_recounts.any? ? ba.final_recounts.to_a.sum(&:count) : nil
end
end

View File

@@ -18,7 +18,7 @@ module ProposalsHelper
end
end
def namespaced_proposal_path(proposal, options={})
def namespaced_proposal_path(proposal, options = {})
@namespace_proposal_path ||= namespace
case @namespace_proposal_path
when "management"

View File

@@ -4,7 +4,7 @@ module SpendingProposalsHelper
ActsAsTaggableOn::Tag.spending_proposal_tags.pluck(:name)
end
def namespaced_spending_proposal_path(spending_proposal, options={})
def namespaced_spending_proposal_path(spending_proposal, options = {})
@namespace_spending_proposal_path ||= namespace
case @namespace_spending_proposal_path
when "management"

View File

@@ -1,27 +1,27 @@
module StatsHelper
def events_chart_tag(events, opt={})
def events_chart_tag(events, opt = {})
events = events.join(',') if events.is_a? Array
opt[:data] ||= {}
opt[:data][:graph] = admin_api_stats_path(events: events)
content_tag :div, "", opt
end
def visits_chart_tag(opt={})
def visits_chart_tag(opt = {})
events = events.join(',') if events.is_a? Array
opt[:data] ||= {}
opt[:data][:graph] = admin_api_stats_path(visits: true)
content_tag :div, "", opt
end
def spending_proposals_chart_tag(opt={})
def spending_proposals_chart_tag(opt = {})
events = events.join(',') if events.is_a? Array
opt[:data] ||= {}
opt[:data][:graph] = admin_api_stats_path(spending_proposals: true)
content_tag :div, "", opt
end
def budget_investments_chart_tag(opt={})
def budget_investments_chart_tag(opt = {})
events = events.join(',') if events.is_a? Array
opt[:data] ||= {}
opt[:data][:graph] = admin_api_stats_path(budget_investments: true)

View File

@@ -1,6 +1,6 @@
module TracksHelper
def track_event(data={})
def track_event(data = {})
track_data = ""
prefix = " data-track-event-"
data.each do |key, value|

View File

@@ -1,6 +1,6 @@
module ValuationHelper
def valuator_select_options(valuator=nil)
def valuator_select_options(valuator = nil)
if valuator.present?
Valuator.where.not(id: valuator.id).order("description ASC").order("users.email ASC").includes(:user).collect { |v| [ v.description_or_email, v.id ] }.prepend([valuator.description_or_email, valuator.id])
else

View File

@@ -18,7 +18,7 @@ module VerificationHelper
data_to_mask = match[2]
email_provider = match[3]
data_to_display + "*"*data_to_mask.size + "@" + email_provider
data_to_display + "*" * data_to_mask.size + "@" + email_provider
end
end

View File

@@ -5,7 +5,7 @@ class DeviseMailer < Devise::Mailer
protected
def devise_mail(record, action, opts={})
def devise_mail(record, action, opts = {})
I18n.with_locale record.locale do
super(record, action, opts)
end

View File

@@ -44,7 +44,7 @@ module Abilities
can [:read, :update, :valuate, :destroy, :summary], SpendingProposal
can [:index, :read, :new, :create, :update, :destroy], Budget
can [:index, :read, :new, :create, :update, :destroy, :calculate_winners], Budget
can [:read, :create, :update, :destroy], Budget::Group
can [:read, :create, :update, :destroy], Budget::Heading
can [:hide, :update, :toggle_selection], Budget::Investment

View File

@@ -48,7 +48,7 @@ module Abilities
can :create, Budget::Investment, budget: { phase: "accepting" }
can :suggest, Budget::Investment, budget: { phase: "accepting" }
can :destroy, Budget::Investment, budget: { phase: ["accepting", "reviewing"] }, author_id: user.id
can :vote, Budget::Investment, budget: { phase: "selecting" }
can :vote, Budget::Investment, budget: { phase: "selecting" }
can [:show, :create], Budget::Ballot, budget: { phase: "balloting" }
can [:create, :destroy], Budget::Ballot::Line, budget: { phase: "balloting" }

View File

@@ -1,8 +1,8 @@
class Activity < ActiveRecord::Base
belongs_to :actionable, -> { with_hidden }, polymorphic: true
belongs_to :actionable, -> { with_hidden }, polymorphic: true
belongs_to :user, -> { with_hidden }
VALID_ACTIONS = %w( hide block restore valuate )
VALID_ACTIONS = %w(hide block restore valuate)
validates :action, inclusion: {in: VALID_ACTIONS}

View File

@@ -10,7 +10,7 @@ module Ahoy
# chart
def add(name, collection)
collections.push data: collection, name: name
collection.each{ |k,v| add_key k }
collection.each{ |k, v| add_key k }
end
def build

View File

@@ -5,16 +5,15 @@ class Banner < ActiveRecord::Base
validates :title, presence: true,
length: { minimum: 2 }
validates :description, presence: true
validates :description, presence: true
validates :target_url, presence: true
validates :style, presence: true
validates :image, presence: true
validates :post_started_at, presence: true
validates :post_ended_at, presence: true
scope :with_active, -> {where("post_started_at <= ?", Time.current).
where("post_ended_at >= ?", Time.current) }
scope :with_active, -> { where("post_started_at <= ?", Time.current).where("post_ended_at >= ?", Time.current) }
scope :with_inactive,-> {where("post_started_at > ? or post_ended_at < ?", Time.current, Time.current) }
scope :with_inactive, -> { where("post_started_at > ? or post_ended_at < ?", Time.current, Time.current) }
end

View File

@@ -67,8 +67,12 @@ class Budget < ActiveRecord::Base
phase == "finished"
end
def balloting_process?
balloting? || reviewing_ballots?
end
def balloting_or_later?
balloting? || reviewing_ballots? || finished?
balloting_process? || finished?
end
def on_hold?

View File

@@ -20,13 +20,14 @@ class Budget
has_many :valuator_assignments, dependent: :destroy
has_many :valuators, through: :valuator_assignments
has_many :comments, as: :commentable
has_many :milestones
validates :title, presence: true
validates :author, presence: true
validates :description, presence: true
validates :heading_id, presence: true
validates_presence_of :unfeasibility_explanation, if: :unfeasibility_explanation_required?
validates_presence_of :price, if: :price_required?
validates :unfeasibility_explanation, presence: { if: :unfeasibility_explanation_required? }
validates :price, presence: { if: :price_required? }
validates :title, length: { in: 4..Budget::Investment.title_max_length }
validates :description, length: { maximum: Budget::Investment.description_max_length }
@@ -59,7 +60,7 @@ class Budget
scope :by_tag, ->(tag_name) { tagged_with(tag_name) }
scope :by_valuator, ->(valuator_id) { where("budget_valuator_assignments.valuator_id = ?", valuator_id).joins(:valuator_assignments) }
scope :for_render, -> { includes(:heading) }
scope :for_render, -> { includes(:heading) }
before_save :calculate_confidence_score
before_validation :set_responsible_name
@@ -204,8 +205,8 @@ class Budget
end
def should_show_aside?
(budget.selecting? && !unfeasible?) ||
(budget.balloting? && feasible?) ||
(budget.selecting? && !unfeasible?) ||
(budget.balloting? && feasible?) ||
(budget.valuating? && !unfeasible?)
end

View File

@@ -0,0 +1,14 @@
class Budget
class Investment
class Milestone < ActiveRecord::Base
belongs_to :investment
validates :title, presence: true
validates :investment, presence: true
def self.title_max_length
80
end
end
end
end

View File

@@ -12,11 +12,10 @@ class Budget
reset_winners
investments.each do |investment|
@current_investment = investment
if inside_budget?
set_winner
end
set_winner if inside_budget?
end
end
handle_asynchronously :calculate_winners
def investments
heading.investments.selected.sort_by_ballots
@@ -52,4 +51,4 @@ class Budget
end
end
end
end

View File

@@ -13,7 +13,7 @@ class Comment < ActiveRecord::Base
validates :body, presence: true
validates :user, presence: true
validates_inclusion_of :commentable_type, in: ["Debate", "Proposal", "Budget::Investment", "Poll::Question", "Legislation::Question", "Legislation::Annotation"]
validates :commentable_type, inclusion: { in: ["Debate", "Proposal", "Budget::Investment", "Poll::Question", "Legislation::Question", "Legislation::Annotation"] }
validate :validate_body_length
@@ -44,7 +44,7 @@ class Comment < ActiveRecord::Base
after_create :call_after_commented
def self.build(commentable, user, body, p_id=nil)
def self.build(commentable, user, body, p_id = nil)
new commentable: commentable,
user_id: user.id,
body: body,
@@ -64,7 +64,7 @@ class Comment < ActiveRecord::Base
end
def author=(author)
self.user= author
self.user = author
end
def total_votes

View File

@@ -3,7 +3,7 @@ module Conflictable
def conflictive?
return false unless flags_count > 0 && cached_votes_up > 0
cached_votes_up/flags_count.to_f < 5
cached_votes_up / flags_count.to_f < 5
end
end

View File

@@ -2,8 +2,8 @@ module Filterable
extend ActiveSupport::Concern
included do
scope :by_official_level, -> (official_level) { where(users: { official_level: official_level }).joins(:author) }
scope :by_date_range, -> (date_range) { where(created_at: date_range) }
scope :by_official_level, ->(official_level) { where(users: { official_level: official_level }).joins(:author) }
scope :by_date_range, ->(date_range) { where(created_at: date_range) }
end
class_methods do

View File

@@ -14,7 +14,7 @@ module SearchCache
def searchable_values_sql
searchable_values
.select{ |k,_| k.present? }
.select{ |k, _| k.present? }
.collect{ |value, weight| set_tsvector(value, weight) }
.join(" || ")
end
@@ -31,5 +31,4 @@ module SearchCache
ActionController::Base.helpers.sanitize(value, tags: [])
end
end

View File

@@ -16,4 +16,4 @@ module Searchable
}
end
end
end

View File

@@ -9,7 +9,7 @@ module Taggable
def tag_list_with_limit(limit = nil)
return tags if limit.blank?
tags.sort{|a,b| b.taggings_count <=> a.taggings_count}[0, limit]
tags.sort{|a, b| b.taggings_count <=> a.taggings_count}[0, limit]
end
def tags_count_out_of_limit(limit = nil)

View File

@@ -7,7 +7,7 @@ module Verification
scope :level_two_verified, -> { where("users.level_two_verified_at IS NOT NULL OR (users.confirmed_phone IS NOT NULL AND users.residence_verified_at IS NOT NULL) AND verified_at IS NULL") }
scope :level_two_or_three_verified, -> { where("users.verified_at IS NOT NULL OR users.level_two_verified_at IS NOT NULL OR (users.confirmed_phone IS NOT NULL AND users.residence_verified_at IS NOT NULL)") }
scope :unverified, -> { where("users.verified_at IS NULL AND (users.level_two_verified_at IS NULL AND (users.residence_verified_at IS NULL OR users.confirmed_phone IS NULL))") }
scope :incomplete_verification, -> { where("(users.residence_verified_at IS NULL AND users.failed_census_calls_count > ?) OR (users.residence_verified_at IS NOT NULL AND (users.unconfirmed_phone IS NULL OR users.confirmed_phone IS NULL))", 0) }
scope :incomplete_verification, -> { where("(users.residence_verified_at IS NULL AND users.failed_census_calls_count > ?) OR (users.residence_verified_at IS NOT NULL AND (users.unconfirmed_phone IS NULL OR users.confirmed_phone IS NULL))", 0) }
end
def verification_email_sent?
@@ -47,7 +47,7 @@ module Verification
end
def failed_residence_verification?
!residence_verified? && failed_census_calls.size > 0
!residence_verified? && !failed_census_calls.empty?
end
def no_phone_available?

View File

@@ -23,7 +23,7 @@ class Flag < ActiveRecord::Base
def self.flagged?(user, flaggable)
return false unless user
!! by_user_and_flaggable(user, flaggable).try(:first)
!!by_user_and_flaggable(user, flaggable).try(:first)
end
end

View File

@@ -1,7 +1,7 @@
class Geozone < ActiveRecord::Base
include Graphqlable
has_many :proposals
has_many :spending_proposals
has_many :debates

View File

@@ -35,7 +35,7 @@ class Legislation::Annotation < ActiveRecord::Base
selector_end = "/html/body/#{range_end}"
el_end = doc.at_xpath(selector_end)
remainder_el_start = el_start.text[0 .. range_start_offset-1] unless range_start_offset.zero?
remainder_el_start = el_start.text[0 .. range_start_offset - 1] unless range_start_offset.zero?
remainder_el_end = el_end.text[range_end_offset .. -1]
self.context = "#{remainder_el_start}<span class=annotator-hl>#{quote}</span>#{remainder_el_end}"

View File

@@ -9,7 +9,7 @@ class Legislation::Question < ActiveRecord::Base
has_many :answers, class_name: 'Legislation::Answer', foreign_key: 'legislation_question_id', dependent: :destroy, inverse_of: :question
has_many :comments, as: :commentable, dependent: :destroy
accepts_nested_attributes_for :question_options, :reject_if => proc { |attributes| attributes[:value].blank? }, allow_destroy: true
accepts_nested_attributes_for :question_options, reject_if: proc { |attributes| attributes[:value].blank? }, allow_destroy: true
validates :process, presence: true
validates :title, presence: true

View File

@@ -7,7 +7,6 @@ class Notification < ActiveRecord::Base
scope :not_emailed, -> { where(emailed_at: nil) }
scope :for_render, -> { includes(:notifiable) }
def timestamp
notifiable.created_at
end

View File

@@ -6,14 +6,14 @@ class Officing::Residence
before_validation :call_census_api
validates_presence_of :document_number
validates_presence_of :document_type
validates_presence_of :year_of_birth
validates :document_number, presence: true
validates :document_type, presence: true
validates :year_of_birth, presence: true
validate :allowed_age
validate :residence_in_madrid
def initialize(attrs={})
def initialize(attrs = {})
super
clean_document_number
end
@@ -43,14 +43,13 @@ class Officing::Residence
end
def store_failed_census_call
FailedCensusCall.create({
FailedCensusCall.create(
user: user,
document_number: document_number,
document_type: document_type,
year_of_birth: year_of_birth,
poll_officer: officer
})
document_type: document_type,
year_of_birth: year_of_birth,
poll_officer: officer
)
end
def user_exists?

View File

@@ -1,7 +1,7 @@
class Organization < ActiveRecord::Base
include Graphqlable
belongs_to :user, touch: true
validates :name, presence: true

View File

@@ -18,7 +18,7 @@ class Poll < ActiveRecord::Base
scope :current, -> { where('starts_at <= ? and ? <= ends_at', Time.current, Time.current) }
scope :incoming, -> { where('? < starts_at', Time.current) }
scope :expired, -> { where('ends_at < ?', Time.current) }
scope :published, -> { where('published = ?', true) }
scope :published, -> { where('published = ?', true) }
scope :by_geozone_id, ->(geozone_id) { where(geozones: {id: geozone_id}.joins(:geozones)) }
scope :sort_for_list, -> { order(:geozone_restricted, :starts_at, :name) }

View File

@@ -2,7 +2,7 @@ class Poll::NullResult < ActiveRecord::Base
VALID_ORIGINS = %w{web booth}
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
belongs_to :booth_assignment
belongs_to :officer_assignment

View File

@@ -19,7 +19,7 @@ class Poll::Question < ActiveRecord::Base
validates :title, length: { minimum: 4 }
validates :description, length: { maximum: Poll::Question.description_max_length }
scope :by_poll_id, ->(poll_id) { where(poll_id: poll_id) }
scope :by_poll_id, ->(poll_id) { where(poll_id: poll_id) }
scope :sort_for_list, -> { order('poll_questions.proposal_id IS NULL', :created_at)}
scope :for_render, -> { includes(:author, :proposal) }

View File

@@ -2,7 +2,7 @@ class Poll::WhiteResult < ActiveRecord::Base
VALID_ORIGINS = %w{web booth}
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
belongs_to :booth_assignment
belongs_to :officer_assignment

View File

@@ -38,8 +38,8 @@ class Proposal < ActiveRecord::Base
before_save :calculate_hot_score, :calculate_confidence_score
scope :for_render, -> { includes(:tags) }
scope :sort_by_hot_score , -> { reorder(hot_score: :desc) }
scope :for_render, -> { includes(:tags) }
scope :sort_by_hot_score, -> { reorder(hot_score: :desc) }
scope :sort_by_confidence_score, -> { reorder(confidence_score: :desc) }
scope :sort_by_created_at, -> { reorder(created_at: :desc) }
scope :sort_by_most_commented, -> { reorder(comments_count: :desc) }
@@ -128,7 +128,7 @@ class Proposal < ActiveRecord::Base
end
def code
"#{Setting["proposal_code_prefix"]}-#{created_at.strftime('%Y-%m')}-#{id}"
"#{Setting['proposal_code_prefix']}-#{created_at.strftime('%Y-%m')}-#{id}"
end
def after_commented

View File

@@ -2,8 +2,8 @@ class Setting < ActiveRecord::Base
validates :key, presence: true, uniqueness: true
default_scope { order(id: :asc) }
scope :banner_style, -> { where("key ilike ?", "banner-style.%")}
scope :banner_img, -> { where("key ilike ?", "banner-img.%")}
scope :banner_style, -> { where("key ilike ?", "banner-style.%")}
scope :banner_img, -> { where("key ilike ?", "banner-img.%")}
def type
if feature_flag?

View File

@@ -15,7 +15,7 @@ class SpendingProposal < ActiveRecord::Base
validates :title, presence: true
validates :author, presence: true
validates :description, presence: true
validates_presence_of :feasible_explanation, if: :feasible_explanation_required?
validates :feasible_explanation, presence: { if: :feasible_explanation_required? }
validates :title, length: { in: 4..SpendingProposal.title_max_length }
validates :description, length: { maximum: SpendingProposal.description_max_length }
@@ -31,11 +31,11 @@ class SpendingProposal < ActiveRecord::Base
scope :not_unfeasible, -> { where("feasible IS ? OR feasible = ?", nil, true) }
scope :with_supports, -> { where('cached_votes_up > 0') }
scope :by_admin, -> (admin) { where(administrator_id: admin.presence) }
scope :by_tag, -> (tag_name) { tagged_with(tag_name) }
scope :by_valuator, -> (valuator) { where("valuation_assignments.valuator_id = ?", valuator.presence).joins(:valuation_assignments) }
scope :by_admin, ->(admin) { where(administrator_id: admin.presence) }
scope :by_tag, ->(tag_name) { tagged_with(tag_name) }
scope :by_valuator, ->(valuator) { where("valuation_assignments.valuator_id = ?", valuator.presence).joins(:valuation_assignments) }
scope :for_render, -> { includes(:geozone) }
scope :for_render, -> { includes(:geozone) }
before_validation :set_responsible_name
@@ -44,7 +44,7 @@ class SpendingProposal < ActiveRecord::Base
end
def self.filter_params(params)
params.select{|x,_| %w{geozone_id administrator_id tag_name valuator_id}.include? x.to_s }
params.select{|x, _| %w{geozone_id administrator_id tag_name valuator_id}.include? x.to_s }
end
def self.scoped_filter(params, current_filter)

View File

@@ -2,7 +2,7 @@ class TagCloud
attr_accessor :resource_model, :scope
def initialize(resource_model, scope=nil)
def initialize(resource_model, scope = nil)
@resource_model = resource_model
@scope = scope
end

View File

@@ -56,7 +56,7 @@ class User < ActiveRecord::Base
scope :officials, -> { where("official_level > 0") }
scope :newsletter, -> { where(newsletter: true) }
scope :for_render, -> { includes(:organization) }
scope :by_document, -> (document_type, document_number) { where(document_type: document_type, document_number: document_number) }
scope :by_document, ->(document_type, document_number) { where(document_type: document_type, document_number: document_number) }
scope :email_digest, -> { where(email_digest: true) }
scope :active, -> { where(erased_at: nil) }
scope :erased, -> { where.not(erased_at: nil) }
@@ -74,7 +74,7 @@ class User < ActiveRecord::Base
username: auth.info.name || auth.uid,
email: oauth_email,
oauth_email: oauth_email,
password: Devise.friendly_token[0,20],
password: Devise.friendly_token[0, 20],
terms_of_service: '1',
confirmed_at: oauth_email_confirmed ? DateTime.current : nil
)
@@ -156,7 +156,7 @@ class User < ActiveRecord::Base
def has_official_email?
domain = Setting['email_domain_for_officials']
email.present? && ( (email.end_with? "@#{domain}") || (email.end_with? ".#{domain}") )
email.present? && ((email.end_with? "@#{domain}") || (email.end_with? ".#{domain}"))
end
def display_official_position_badge?

View File

@@ -7,17 +7,17 @@ class Verification::Residence
before_validation :call_census_api
validates_presence_of :document_number
validates_presence_of :document_type
validates_presence_of :date_of_birth
validates_presence_of :postal_code
validates :document_number, presence: true
validates :document_type, presence: true
validates :date_of_birth, presence: true
validates :postal_code, presence: true
validates :terms_of_service, acceptance: { allow_nil: false }
validates :postal_code, length: { is: 5 }
validate :allowed_age
validate :document_number_uniqueness
def initialize(attrs={})
def initialize(attrs = {})
self.date_of_birth = parse_date('date_of_birth', attrs)
attrs = remove_date('date_of_birth', attrs)
super
@@ -47,13 +47,13 @@ class Verification::Residence
end
def store_failed_attempt
FailedCensusCall.create({
FailedCensusCall.create(
user: user,
document_number: document_number,
document_type: document_type,
date_of_birth: date_of_birth,
postal_code: postal_code
})
document_type: document_type,
date_of_birth: date_of_birth,
postal_code: postal_code
)
end
def geozone

View File

@@ -3,7 +3,7 @@ class Verification::Sms
attr_accessor :user, :phone, :confirmation_code
validates_presence_of :phone
validates :phone, presence: true
validates :phone, format: { with: /\A[\d \+]+\z/ }
validate :uniqness_phone

View File

@@ -1,8 +1,8 @@
class VerifiedUser < ActiveRecord::Base
scope :by_user, -> (user) { where(document_number: user.document_number) }
scope :by_user, ->(user) { where(document_number: user.document_number) }
scope :by_email, -> (email) { where(email: email) }
scope :by_phone, -> (phone) { where(phone: phone) }
scope :by_email, ->(email) { where(email: email) }
scope :by_phone, ->(phone) { where(phone: phone) }
def self.phone?(user)
by_user(user).by_phone(user.unconfirmed_phone).first.present?

View File

@@ -0,0 +1,7 @@
<%= form_for [:admin, @investment.budget, @investment, @milestone] do |f| %>
<%= f.text_field :title, maxlength: Budget::Investment::Milestone.title_max_length %>
<%= f.text_area :description, rows: 5 %>
<%= f.submit nil, class: "button success" %>
<% end %>

View File

@@ -0,0 +1,5 @@
<%= back_link_to admin_budget_budget_investment_path(@investment.budget, @investment) %>
<h2><%= t("admin.milestones.edit.title") %></h2>
<%= render '/admin/budget_investment_milestones/form' %>

View File

@@ -0,0 +1,10 @@
<div class="milestone-new row">
<div class="small-12 column">
<%= back_link_to admin_budget_budget_investment_path(@investment.budget, @investment) %>
<h1><%= t("admin.milestones.new.creating") %></h1>
<%= render "form" %>
</div>
</div>

View File

@@ -0,0 +1,36 @@
<% if @investment.milestones.any? %>
<table>
<thead>
<tr>
<th><%= t("admin.milestones.index.table_id") %></th>
<th><%= t("admin.milestones.index.table_title") %></th>
<th><%= t("admin.milestones.index.table_description") %></th>
<th><%= t("admin.milestones.index.table_actions") %></th>
</tr>
</thead>
<tbody>
<% @investment.milestones.each do |milestone| %>
<tr id="<%= dom_id(milestone) %>" class="milestone">
<td>
<%= milestone.id %>
</td>
<td>
<%= link_to milestone.title, edit_admin_budget_budget_investment_budget_investment_milestone_path(@investment.budget, @investment, milestone) %>
</td>
<td class="small">
<%= milestone.description %>
</td>
<td>
<%= link_to t("admin.milestones.index.delete"), admin_budget_budget_investment_budget_investment_milestone_path(@investment.budget, @investment, milestone),
method: :delete,
class: 'button hollow alert expanded' %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p>
<%= t('admin.milestones.index.no_milestones') %>
</p>
<% end %>

View File

@@ -47,3 +47,12 @@
<%= link_to t("admin.budget_investments.show.edit_dossier"), edit_valuation_budget_budget_investment_path(@budget, @investment) %>
</p>
<hr>
<h2><%= t("admin.budget_investments.show.milestone") %></h2>
<%= render 'admin/budget_investments/milestones' %>
<p>
<%= link_to t("admin.budget_investments.show.new_milestone"), new_admin_budget_budget_investment_budget_investment_milestone_path(@budget, @investment) %>
</p>

View File

@@ -16,5 +16,15 @@
<%= f.select :currency_symbol, budget_currency_symbol_select_options %>
</div>
</div>
<%= f.submit nil, class: "button success" %>
<div class="margin-top">
<%= f.submit nil, class: "button success" %>
<% if @budget.balloting_process? %>
<div class="float-right">
<%= link_to t("admin.budgets.winners.calculate"),
calculate_winners_admin_budget_path(@budget),
method: :put,
class: "button hollow" %>
</div>
<% end %>
</div>
<% end %>

View File

@@ -1,7 +1,7 @@
<table>
<thead>
<tr>
<th colspan="2" class="with-button">
<th colspan="3" class="with-button">
<%= group.name %>
<%= link_to t("admin.budgets.form.add_heading"), "#", class: "button float-right js-toggle-link", data: { "toggle-selector" => "#group-#{group.id}-new-heading-form" } %>
</th>
@@ -21,6 +21,7 @@
<tr>
<th><%= t("admin.budgets.form.table_heading") %></th>
<th><%= t("admin.budgets.form.table_amount") %></th>
<th><%= t("admin.budgets.form.table_population") %></th>
</tr>
</thead>
<tbody>
@@ -45,6 +46,15 @@
placeholder: t("admin.budgets.form.amount") %>
</div>
</div>
<div class="row">
<div class="small-12 medium-6 column">
<label><%= t("admin.budgets.form.population") %></label>
<%= f.text_field :population,
label: false,
maxlength: 8,
placeholder: t("admin.budgets.form.population") %>
</div>
</div>
<%= f.submit t("admin.budgets.form.save_heading"), class: "button success" %>
<% end %>
@@ -60,6 +70,9 @@
<td>
<%= heading.price %>
</td>
<td>
<%= heading.population %>
</td>
</tr>
<% end %>
<!-- /. headings list -->

View File

@@ -17,8 +17,8 @@
<%= f.text_field :title, maxlength: Poll::Question.title_max_length %>
<%= f.label :valid_answers %>
<p class="note"><%= t("admin.questions.new.valid_answers_note") %></p>
<%= f.text_field :valid_answers, label: false %>
<p class="help-text" id="valid-answers-help-text"><%= t("admin.questions.new.valid_answers_note") %></p>
<%= f.text_field :valid_answers, label: false, aria: {describedby: "valid-answers-help-text"} %>
<div class="ckeditor">
<%= f.cktext_area :description,

View File

@@ -15,8 +15,8 @@
</div>
<%= f.label :document_numbers %>
<p class="note"><%= t("admin.signature_sheets.new.document_numbers_note") %></p>
<%= f.text_area :document_numbers, rows: "6", label: false %>
<p class="help-text" id="document-numbers-help-text"><%= t("admin.signature_sheets.new.document_numbers_note") %></p>
<%= f.text_area :document_numbers, rows: "6", label: false, aria: {describedby: "document-numbers-help-text"} %>
<%= f.submit(class: "button", value: t("admin.signature_sheets.new.submit")) %>
<% end %>

View File

@@ -0,0 +1,22 @@
<div class="row">
<div class="small-12 column">
<ul class="tabs" data-tabs id="investments-tabs">
<li class="tabs-title is-active">
<%= link_to "#tab-comments" do %>
<h3>
<%= t("budgets.investments.show.comments_tab") %>
<span class="js-comments-count">(<%= @investment.comments_count %>)</span>
</h3>
<% end %>
</li>
<li class="tabs-title">
<%= link_to "#tab-milestones" do %>
<h3>
<%= t("budgets.investments.show.milestones_tab") %>
(<%= @investment.milestones.count %>)
</h3>
<% end %>
</li>
</ul>
</div>
</div>

View File

@@ -31,7 +31,7 @@
<div class="small-12 column">
<%= f.label :tag_list, t("budgets.investments.form.tags_label") %>
<p class="note"><%= t("budgets.investments.form.tags_instructions") %></p>
<p class="help-text" id="tags-list-help-text"><%= t("budgets.investments.form.tags_instructions") %></p>
<div id="category_tags" class="tags">
<%= f.label :category_tag_list, t("budgets.investments.form.tag_category_label") %>
@@ -44,6 +44,7 @@
<%= f.text_field :tag_list, value: @investment.tag_list.to_s,
label: false,
placeholder: t("budgets.investments.form.tags_placeholder"),
aria: {describedby: "tags-list-help-text"},
class: 'js-tag-list' %>
</div>

View File

@@ -0,0 +1,26 @@
<div class="tabs-panel tab-milestones" id="tab-milestones">
<div class="row">
<div class="small-12 column">
<% if @investment.milestones.blank? %>
<div class="callout primary text-center">
<%= t('budgets.investments.show.no_milestones') %>
</div>
<% end %>
<section class="timeline">
<ul class="no-bullet">
<% @investment.milestones.each do |milestone| %>
<li>
<div class="milestone-content">
<h3><%= milestone.title %></h3>
<span class="milestone-date">
<strong><%= t("budgets.investments.show.milestone_publish_date", publish_date: milestone.created_at.strftime("%d/%m/%Y")) %></strong>
</span>
<p><%= milestone.description %></p>
</div>
</li>
<% end %>
</ul>
</section>
</div>
</div>
</div>

View File

@@ -10,4 +10,13 @@
ballot: @ballot
} %>
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
<div class="tabs-content" data-tabs-content="investments-tabs" role="tablist">
<%= render "budgets/investments/filter_subnav" %>
<%= render "budgets/investments/milestones" %>
<div class="tabs-panel is-active" id="tab-comments">
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree,
comment_flags: @comment_flags,
display_comments_count: false } %>
</div>
</div>

View File

@@ -1,14 +1,15 @@
<% commentable = comment_tree.commentable %>
<% current_order = comment_tree.order %>
<% cache [locale_and_user_status, current_order, commentable_cache_key(commentable), comment_tree.comments, comment_tree.comment_authors, commentable.comments_count, comment_flags] do %>
<% cache [locale_and_user_status, comment_tree.order, commentable_cache_key(commentable), comment_tree.comments, comment_tree.comment_authors, commentable.comments_count, comment_flags] do %>
<section class="expanded comments">
<div class="row">
<div id="comments" class="small-12 column">
<h2>
<%= comment_tree_title_text(commentable) %>
<span class="js-comments-count">(<%= commentable.comments_count %>)</span>
</h2>
<% if display_comments_count %>
<h2>
<%= comment_tree_title_text(commentable) %>
<span class="js-comments-count">(<%= commentable.comments_count %>)</span>
</h2>
<% end %>
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>

View File

@@ -17,11 +17,12 @@
<div class="small-12 column">
<%= f.label :tag_list, t("debates.form.tags_label") %>
<p class="note"><%= t("debates.form.tags_instructions") %></p>
<p class="help-text" id="tag-list-help-text"><%= t("debates.form.tags_instructions") %></p>
<%= f.text_field :tag_list, value: @debate.tag_list.to_s,
label: false,
placeholder: t("debates.form.tags_placeholder") %>
placeholder: t("debates.form.tags_placeholder"),
aria: {describedby: "tag-list-help-text"} %>
</div>
<div class="small-12 column">
<% if @debate.new_record? %>

View File

@@ -16,9 +16,7 @@
<div class="comment-actions">
<a class="cancel-comment" href="#" data-cancel-annotation><%= t('legislation.annotations.comments.cancel') %></a>
<%= f.submit class: 'button publish-comment' do %>
<strong><%= t('legislation.annotations.comments.publish_comment') %></strong>
<% end %>
<%= f.submit value: t('legislation.annotations.comments.publish_comment'), class: 'button publish-comment' %>
</div>
<%= f.hidden_field :quote %>

View File

@@ -40,7 +40,9 @@
</aside>
</div>
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree,
comment_flags: @comment_flags,
display_comments_count: true } %>
</div>
</div>
</div>

View File

@@ -42,6 +42,7 @@
</aside>
</div>
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree,
comment_flags: @comment_flags,
display_comments_count: true } %>
</section>

View File

@@ -3,8 +3,10 @@
<%= form_tag management_user_invites_path do %>
<label><%= t('management.user_invites.new.label') %></label>
<p class="note"><%= t('management.user_invites.new.info') %></p>
<%= text_area_tag "emails", nil, rows: 5, placeholder: t('management.user_invites.new.info') %>
<p class="help-text" id="emails-help-text"><%= t('management.user_invites.new.info') %></p>
<%= text_area_tag "emails", nil, rows: 5,
placeholder: t('management.user_invites.new.info'),
aria: {describedby: "emails-help-text"} %>
<div class="small-12 medium-6">
<input type="submit" name="" value="<%= t('management.user_invites.new.submit') %>", class="button hollow expanded">
</div>

View File

@@ -9,8 +9,10 @@
<%= f.fields_for :organization do |fo| %>
<%= fo.text_field :name, autofocus: true, maxlength: Organization.name_max_length, placeholder: t("devise_views.organizations.registrations.new.organization_name_label") %>
<%= fo.label :responsible_name %>
<p class="note"><%= t("devise_views.organizations.registrations.new.responsible_name_note") %></p>
<%= fo.text_field :responsible_name, placeholder: t("devise_views.organizations.registrations.new.responsible_name_label"), maxlength: Organization.responsible_name_max_length, label: false %>
<p class="help-text" id="responsible-name-help-text"><%= t("devise_views.organizations.registrations.new.responsible_name_note") %></p>
<%= fo.text_field :responsible_name, placeholder: t("devise_views.organizations.registrations.new.responsible_name_label"),
maxlength: Organization.responsible_name_max_length, label: false,
aria: {describedby: "responsible-name-help-text"} %>
<% end %>
<%= f.email_field :email, placeholder: t("devise_views.organizations.registrations.new.email_label") %>

View File

@@ -12,17 +12,21 @@
<div class="small-12 column">
<%= f.label :question, t("proposals.form.proposal_question") %>
<span class="note-marked">
<p class="help-text" id="question-help-text">
<%= t("proposals.form.proposal_question_example_html") %>
</span>
<%= f.text_field :question, maxlength: Proposal.question_max_length, placeholder: t("proposals.form.proposal_question"), label: false %>
</p>
<%= f.text_field :question, maxlength: Proposal.question_max_length,
placeholder: t("proposals.form.proposal_question"),
label: false,
aria: {describedby: "question-help-text"} %>
</div>
<div class="small-12 column">
<%= f.label :summary, t("proposals.form.proposal_summary") %>
<p class="note"><%= t("proposals.form.proposal_summary_note") %></p>
<p class="help-text" id="summary-help-text"><%= t("proposals.form.proposal_summary_note") %></p>
<%= f.text_area :summary, rows: 4, maxlength: 200, label: false,
placeholder: t('proposals.form.proposal_summary') %>
placeholder: t('proposals.form.proposal_summary'),
aria: {describedby: "summary-help-text"} %>
</div>
<div class="ckeditor small-12 column">
@@ -33,8 +37,9 @@
<div class="small-12 column">
<%= f.label :video_url, t("proposals.form.proposal_video_url") %>
<p class="note"><%= t("proposals.form.proposal_video_url_note") %></p>
<%= f.text_field :video_url, placeholder: t("proposals.form.proposal_video_url"), label: false %>
<p class="help-text" id="video-url-help-text"><%= t("proposals.form.proposal_video_url_note") %></p>
<%= f.text_field :video_url, placeholder: t("proposals.form.proposal_video_url"), label: false,
aria: {describedby: "video-url-help-text"} %>
</div>
<div class="small-12 column">
@@ -49,7 +54,7 @@
<div class="small-12 column">
<%= f.label :tag_list, t("proposals.form.tags_label") %>
<p class="note"><%= t("proposals.form.tags_instructions") %></p>
<p class="help-text" id="tag-list-help-text"><%= t("proposals.form.tags_instructions") %></p>
<div id="category_tags" class="tags">
<%= f.label :category_tag_list, t("proposals.form.tag_category_label") %>
@@ -62,14 +67,16 @@
<%= f.text_field :tag_list, value: @proposal.tag_list.to_s,
label: false,
placeholder: t("proposals.form.tags_placeholder"),
class: 'js-tag-list' %>
class: 'js-tag-list',
aria: {describedby: "tag-list-help-text"} %>
</div>
<% if current_user.unverified? %>
<div class="small-12 column">
<%= f.label :responsible_name, t("proposals.form.proposal_responsible_name") %>
<p class="note"><%= t("proposals.form.proposal_responsible_name_note") %></p>
<%= f.text_field :responsible_name, placeholder: t("proposals.form.proposal_responsible_name"), label: false %>
<p class="help-text" id="responsible-name-help-text"><%= t("proposals.form.proposal_responsible_name_note") %></p>
<%= f.text_field :responsible_name, placeholder: t("proposals.form.proposal_responsible_name"), label: false,
aria: {describedby: "responsible-name-help-text"} %>
</div>
<% end %>

View File

@@ -12,35 +12,39 @@
<% cache [locale_and_user_status(@proposal), @proposal, @proposal.author, Flag.flagged?(current_user, @proposal), @proposal_votes] do %>
<div class="proposal-show">
<div id="<%= dom_id(@proposal) %>" class="row">
<div class="small-12 medium-9 column">
<div class="small-12 medium-8 column">
<h1><%= t("proposals.proposal.created") %></h1>
<h2><%= @proposal.title %></h2>
<p>
<%= t("proposals.show.code") %>
<strong><%= @proposal.code %></strong>
<span class="lead"><%= t("proposals.proposal.share.guide") %></span><br>
<%= t("proposals.proposal.share.edit") %>
</p>
<p><%= t("proposals.proposal.share.guide").html_safe %></p>
<%= render partial: 'shared/social_share', locals: {
title: @proposal.title,
url: proposal_url(@proposal)
} %>
<br/>
<% if @proposal_improvement_path.present? %>
<p><%= t('proposals.proposal.improve_info', improve_info_link: link_to(t('proposals.proposal.improve_info_link'), @proposal_improvement_path)).html_safe %></p>
<div class="callout highlight margin-top text-center">
<p class="lead"><strong><%= t("proposals.proposal.improve_info") %></strong></p>
<%= link_to t("proposals.proposal.improve_info_link"), @proposal_improvement_path, class: "button" %>
</div>
<% end %>
<p>
<%= link_to proposal_path(@proposal), class: 'proposal' do %>
<%= t("proposals.proposal.share.view_proposal") %>
<% end %>
</p>
<div class="small margin-bottom">
<%= link_to t("proposals.proposal.share.view_proposal"), proposal_path(@proposal) %>
</div>
</div>
<div class="small-12 medium-4 column">
<div class="callout light">
<p>
<strong><%= @proposal.title %></strong><br>
<%= t("proposals.show.code") %> <%= @proposal.code %>
</p>
</div>
</div>
</div>
</div>

View File

@@ -1,10 +1,12 @@
<div class="small-12 column" >
<% if @search_terms && @resources.any? %>
<div class="alert-box radius warning">
<p class="note-marked">
<%= t("shared.suggest.#{resource_name}.found",
count: @resources.count,
query: @search_terms)%>
<div class="callout warning">
<p>
<strong>
<%= t("shared.suggest.#{resource_name}.found",
count: @resources.count,
query: @search_terms)%>
</strong>
</p>
<ul>
@@ -14,11 +16,13 @@
</ul>
<% if @resources.count > @limit %>
<p class="note-marked">
<%= t("shared.suggest.#{resource_name}.message",
count: @resources.count,
query: @search_terms,
limit: @limit) %>
<p>
<strong>
<%= t("shared.suggest.#{resource_name}.message",
count: @resources.count,
query: @search_terms,
limit: @limit) %>
</strong>
<%= link_to t("shared.suggest.#{resource_name}.see_all"),
polymorphic_url(resource_model, search: @search_terms)%>
</p>
@@ -26,4 +30,4 @@
</div>
<% end %>
</div>
</div>

View File

@@ -18,8 +18,10 @@
<div class="small-12 column">
<%= f.label :password, t("devise_views.users.registrations.edit.password_label") %>
<p class="note"><%= t("devise_views.users.registrations.edit.leave_blank") %></p>
<%= f.password_field :password, autocomplete: "off", label: false, placeholder: t("devise_views.users.registrations.edit.password_label") %>
<p class="help-text" id="password-help-text"><%= t("devise_views.users.registrations.edit.leave_blank") %></p>
<%= f.password_field :password, autocomplete: "off", label: false,
placeholder: t("devise_views.users.registrations.edit.password_label"),
aria: {describedby: "password-help-text"} %>
</div>
<div class="small-12 column">
@@ -29,8 +31,10 @@
<div class="small-12 column">
<%= f.label :current_password, t("devise_views.users.registrations.edit.current_password_label") %>
<p class="note"><%= t("devise_views.users.registrations.edit.need_current") %></p>
<%= f.password_field :current_password, label: false, autocomplete: "off", placeholder: t("devise_views.users.registrations.edit.current_password_label") %>
<p class="help-text" id="current-password-help-text"><%= t("devise_views.users.registrations.edit.need_current") %></p>
<%= f.password_field :current_password, label: false, autocomplete: "off",
placeholder: t("devise_views.users.registrations.edit.current_password_label"),
aria: {describedby: "current-password-help-text"} %>
</div>
<div class="small-12 column">

View File

@@ -18,8 +18,11 @@
<%= f.hidden_field :locale, value: I18n.locale %>
<%= f.label :username %>
<p class="note"><%= t("devise_views.users.registrations.new.username_note") %></p>
<%= f.text_field :username, autofocus: true, maxlength: User.username_max_length, placeholder: t("devise_views.users.registrations.new.username_label"), label: false %>
<p class="help-text" id="username-help-text"><%= t("devise_views.users.registrations.new.username_note") %></p>
<%= f.text_field :username, autofocus: true, maxlength: User.username_max_length,
placeholder: t("devise_views.users.registrations.new.username_label"),
label: false,
aria: {describedby: "username-help-text"} %>
<%= f.invisible_captcha :family_name %>

View File

@@ -76,9 +76,9 @@
<div class="small-12 medium-5 clear">
<%= f.label t("verification.residence.new.postal_code") %>
<p class="note"><%= t("verification.residence.new.postal_code_note") %></p>
<p class="help-text" id="postal-code-help-text"><%= t("verification.residence.new.postal_code_note") %></p>
<div class="medium-6">
<%= f.text_field :postal_code, label: false %>
<%= f.text_field :postal_code, label: false, aria: {describedby: "postal-code-help-text"} %>
</div>
</div>

View File

@@ -31,8 +31,10 @@
<div class="small-12 medium-6">
<%= f.label :phone, t("verification.sms.new.phone"), class: "inline-block" %>
<span class="inline-block"><%= t("verification.sms.new.phone_format_html") %></span>
<p class="note"><%= t("verification.sms.new.phone_note") %></p>
<%= f.text_field :phone, label: false, placeholder: t("verification.sms.new.phone_placeholder") %>
<p class="help-text" id="phone-text-help"><%= t("verification.sms.new.phone_note") %></p>
<%= f.text_field :phone, label: false,
placeholder: t("verification.sms.new.phone_placeholder"),
aria: {describedby: "phone-help-text"} %>
</div>
<%= f.submit t("verification.sms.new.submit_button"), class: "button success" %>