Add rubocop spacing rules
We were following these rules in most places; we just didn't define them anywhere.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
---
|
---
|
||||||
linters:
|
linters:
|
||||||
|
ExtraNewline:
|
||||||
|
enabled: true
|
||||||
FinalNewline:
|
FinalNewline:
|
||||||
enabled: true
|
enabled: true
|
||||||
SelfClosingTag:
|
SelfClosingTag:
|
||||||
@@ -16,5 +18,27 @@ linters:
|
|||||||
enabled: true
|
enabled: true
|
||||||
only:
|
only:
|
||||||
- Layout/EndOfLine
|
- Layout/EndOfLine
|
||||||
|
- Layout/SpaceAfterColon
|
||||||
|
- Layout/SpaceAfterComma
|
||||||
|
- Layout/SpaceAfterMethodName
|
||||||
|
- Layout/SpaceAfterNot
|
||||||
|
- Layout/SpaceAfterSemicolon
|
||||||
|
- Layout/SpaceAroundBlockParameters
|
||||||
|
- Layout/SpaceAroundOperators
|
||||||
|
- Layout/SpaceBeforeBlockBraces
|
||||||
|
- Layout/SpaceBeforeComma
|
||||||
|
- Layout/SpaceBeforeComment
|
||||||
|
- Layout/SpaceBeforeFirstArg
|
||||||
|
- Layout/SpaceBeforeSemicolon
|
||||||
|
- Layout/SpaceInsideArrayLiteralBrackets
|
||||||
|
- Layout/SpaceInsideArrayPercentLiteral
|
||||||
|
- Layout/SpaceInsideBlockBraces
|
||||||
|
- Layout/SpaceInsideHashLiteralBraces
|
||||||
|
- Layout/SpaceInsideParens
|
||||||
|
- Layout/SpaceInsidePercentLiteralDelimiters
|
||||||
|
- Layout/SpaceInsideRangeLiteral
|
||||||
|
- Layout/SpaceInsideReferenceBrackets
|
||||||
|
- Layout/SpaceInsideStringInterpolation
|
||||||
|
- Layout/Tab
|
||||||
- Lint/LiteralAsCondition
|
- Lint/LiteralAsCondition
|
||||||
- Style/PercentLiteralDelimiters
|
- Style/PercentLiteralDelimiters
|
||||||
|
|||||||
@@ -32,6 +32,73 @@ Layout/EmptyLines:
|
|||||||
Layout/EndOfLine:
|
Layout/EndOfLine:
|
||||||
EnforcedStyle: lf
|
EnforcedStyle: lf
|
||||||
|
|
||||||
|
Layout/SpaceAfterColon:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceAfterComma:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceAfterMethodName:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceAfterNot:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceAfterSemicolon:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceAroundBlockParameters:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceAroundOperators:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceBeforeBlockBraces:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceBeforeComma:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceBeforeComment:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceBeforeFirstArg:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceBeforeSemicolon:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceInsideArrayLiteralBrackets:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceInsideArrayPercentLiteral:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceInsideBlockBraces:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceInsideHashLiteralBraces:
|
||||||
|
Enabled: true
|
||||||
|
EnforcedStyle: compact
|
||||||
|
|
||||||
|
Layout/SpaceInsideParens:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceInsidePercentLiteralDelimiters:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceInsideRangeLiteral:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceInsideReferenceBrackets:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceInsideStringInterpolation:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/Tab:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Layout/TrailingBlankLines:
|
Layout/TrailingBlankLines:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class Admin::BudgetsController < Admin::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def budget_params
|
def budget_params
|
||||||
descriptions = Budget::Phase::PHASE_KINDS.map{|p| "description_#{p}"}.map(&:to_sym)
|
descriptions = Budget::Phase::PHASE_KINDS.map { |p| "description_#{p}" }.map(&:to_sym)
|
||||||
valid_attributes = [:phase,
|
valid_attributes = [:phase,
|
||||||
:currency_symbol,
|
:currency_symbol,
|
||||||
:help_link,
|
:help_link,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class Admin::CommentsController < Admin::BaseController
|
|||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.csv {send_data to_csv(Comment.sort_by_newest, Comment),
|
format.csv { send_data to_csv(Comment.sort_by_newest, Comment),
|
||||||
type: "text/csv",
|
type: "text/csv",
|
||||||
disposition: "attachment",
|
disposition: "attachment",
|
||||||
filename: "comments.csv" }
|
filename: "comments.csv" }
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class Admin::Dashboard::AdministratorTasksController < Admin::Dashboard::BaseCon
|
|||||||
|
|
||||||
administrator_task.update(user: current_user, executed_at: Time.current)
|
administrator_task.update(user: current_user, executed_at: Time.current)
|
||||||
redirect_to admin_dashboard_administrator_tasks_path,
|
redirect_to admin_dashboard_administrator_tasks_path,
|
||||||
{ flash: { notice: t("admin.dashboard.administrator_tasks.update.success") } }
|
{ flash: { notice: t("admin.dashboard.administrator_tasks.update.success") }}
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class Admin::DownloadSettingsController < Admin::BaseController
|
|||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
permitted = downloadable_params
|
permitted = downloadable_params
|
||||||
@download_settings = []
|
@download_settings = []
|
||||||
if permitted_models.include? permitted[:resource]
|
if permitted_models.include? permitted[:resource]
|
||||||
set_edit(permitted[:resource])
|
set_edit(permitted[:resource])
|
||||||
@@ -12,7 +12,7 @@ class Admin::DownloadSettingsController < Admin::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
permitted = downloadable_params
|
permitted = downloadable_params
|
||||||
if permitted[:downloadable]
|
if permitted[:downloadable]
|
||||||
DownloadSetting.where(name_model: get_model(permitted[:resource]).to_s,
|
DownloadSetting.where(name_model: get_model(permitted[:resource]).to_s,
|
||||||
config: permitted[:config].to_i).each do |download_setting|
|
config: permitted[:config].to_i).each do |download_setting|
|
||||||
@@ -27,7 +27,7 @@ class Admin::DownloadSettingsController < Admin::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def set_edit(resource)
|
def set_edit(resource)
|
||||||
@download_resource = {name: resource, config: get_config}
|
@download_resource = { name: resource, config: get_config }
|
||||||
@download_settings = get_attrs(get_model(resource), get_config)
|
@download_settings = get_attrs(get_model(resource), get_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
|
|||||||
.page(params[:page])
|
.page(params[:page])
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.csv {send_data to_csv(process_for_download, Legislation::Process),
|
format.csv { send_data to_csv(process_for_download, Legislation::Process),
|
||||||
type: "text/csv",
|
type: "text/csv",
|
||||||
disposition: "attachment",
|
disposition: "attachment",
|
||||||
filename: "legislation_processes.csv" }
|
filename: "legislation_processes.csv" }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class Admin::LocalCensusRecords::ImportsController < Admin::LocalCensusRecords::
|
|||||||
def create
|
def create
|
||||||
@import = LocalCensusRecords::Import.new(local_census_records_import_params)
|
@import = LocalCensusRecords::Import.new(local_census_records_import_params)
|
||||||
if @import.save
|
if @import.save
|
||||||
flash.now[:notice] = t("admin.local_census_records.imports.create.notice")
|
flash.now[:notice] = t("admin.local_census_records.imports.create.notice")
|
||||||
render :show
|
render :show
|
||||||
else
|
else
|
||||||
render :new
|
render :new
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
|
|||||||
def show
|
def show
|
||||||
included_relations = [:recounts, :voters, officer_assignments: [officer: [:user]]]
|
included_relations = [:recounts, :voters, officer_assignments: [officer: [:user]]]
|
||||||
@booth_assignment = @poll.booth_assignments.includes(*included_relations).find(params[:id])
|
@booth_assignment = @poll.booth_assignments.includes(*included_relations).find(params[:id])
|
||||||
@voters_by_date = @booth_assignment.voters.group_by {|v| v.created_at.to_date}
|
@voters_by_date = @booth_assignment.voters.group_by { |v| v.created_at.to_date }
|
||||||
@partial_results = @booth_assignment.partial_results
|
@partial_results = @booth_assignment.partial_results
|
||||||
@recounts = @booth_assignment.recounts
|
@recounts = @booth_assignment.recounts
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Admin::SiteCustomization::ImagesController < Admin::SiteCustomization::Bas
|
|||||||
flash.now[:error] = t("admin.site_customization.images.update.error")
|
flash.now[:error] = t("admin.site_customization.images.update.error")
|
||||||
|
|
||||||
@images = SiteCustomization::Image.all_images
|
@images = SiteCustomization::Image.all_images
|
||||||
idx = @images.index {|e| e.name == @image.name }
|
idx = @images.index { |e| e.name == @image.name }
|
||||||
@images[idx] = @image
|
@images[idx] = @image
|
||||||
|
|
||||||
render :index
|
render :index
|
||||||
|
|||||||
@@ -77,13 +77,13 @@ class Admin::StatsController < Admin::BaseController
|
|||||||
|
|
||||||
authorize! :read_admin_stats, @budget, message: t("admin.stats.budgets.no_data_before_balloting_phase")
|
authorize! :read_admin_stats, @budget, message: t("admin.stats.budgets.no_data_before_balloting_phase")
|
||||||
|
|
||||||
@user_count = @budget.ballots.select {|ballot| ballot.lines.any? }.count
|
@user_count = @budget.ballots.select { |ballot| ballot.lines.any? }.count
|
||||||
|
|
||||||
@vote_count = @budget.lines.count
|
@vote_count = @budget.lines.count
|
||||||
|
|
||||||
@vote_count_by_heading = @budget.lines.group(:heading_id).count.collect {|k,v| [Budget::Heading.find(k).name, v]}.sort
|
@vote_count_by_heading = @budget.lines.group(:heading_id).count.collect { |k, v| [Budget::Heading.find(k).name, v] }.sort
|
||||||
|
|
||||||
@user_count_by_district = User.where.not(balloted_heading_id: nil).group(:balloted_heading_id).count.collect {|k,v| [Budget::Heading.find(k).name, v]}.sort
|
@user_count_by_district = User.where.not(balloted_heading_id: nil).group(:balloted_heading_id).count.collect { |k, v| [Budget::Heading.find(k).name, v] }.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
def polls
|
def polls
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ module Budgets
|
|||||||
end
|
end
|
||||||
|
|
||||||
def json_data
|
def json_data
|
||||||
investment = Budget::Investment.find(params[:id])
|
investment = Budget::Investment.find(params[:id])
|
||||||
data = {
|
data = {
|
||||||
investment_id: investment.id,
|
investment_id: investment.id,
|
||||||
investment_title: investment.title,
|
investment_title: investment.title,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ module CommentableActions
|
|||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.csv {send_data to_csv(resources_csv, resource_model),
|
format.csv { send_data to_csv(resources_csv, resource_model),
|
||||||
type: "text/csv",
|
type: "text/csv",
|
||||||
disposition: "attachment",
|
disposition: "attachment",
|
||||||
filename: "#{get_resource(resource_model)}.csv" }
|
filename: "#{get_resource(resource_model)}.csv" }
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ module Dashboard::GroupSupports
|
|||||||
end
|
end
|
||||||
|
|
||||||
def calculate_year_of_week(date)
|
def calculate_year_of_week(date)
|
||||||
year = date.year
|
year = date.year
|
||||||
if first_week_of_year?(date) && date.end_of_week.year != date.year
|
if first_week_of_year?(date) && date.end_of_week.year != date.year
|
||||||
year = year + 1
|
year = year + 1
|
||||||
elsif last_week_of_year?(date) && date.beginning_of_week.year != date.year
|
elsif last_week_of_year?(date) && date.beginning_of_week.year != date.year
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ module ModerateActions
|
|||||||
@resources = @resources.where(id: params[:resource_ids])
|
@resources = @resources.where(id: params[:resource_ids])
|
||||||
|
|
||||||
if params[:hide_resources].present?
|
if params[:hide_resources].present?
|
||||||
@resources.accessible_by(current_ability, :hide).each {|resource| hide_resource resource}
|
@resources.accessible_by(current_ability, :hide).each { |resource| hide_resource resource }
|
||||||
|
|
||||||
elsif params[:ignore_flags].present?
|
elsif params[:ignore_flags].present?
|
||||||
@resources.accessible_by(current_ability, :ignore_flag).each(&:ignore_flag)
|
@resources.accessible_by(current_ability, :ignore_flag).each(&:ignore_flag)
|
||||||
|
|
||||||
elsif params[:block_authors].present?
|
elsif params[:block_authors].present?
|
||||||
author_ids = @resources.pluck(author_id).uniq
|
author_ids = @resources.pluck(author_id).uniq
|
||||||
User.where(id: author_ids).accessible_by(current_ability, :block).each {|user| block_user user}
|
User.where(id: author_ids).accessible_by(current_ability, :block).each { |user| block_user user }
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_to request.query_parameters.merge(action: :index)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class Dashboard::ActionsController < Dashboard::BaseController
|
|||||||
Dashboard::AdministratorTask.create(source: @dashboard_executed_action)
|
Dashboard::AdministratorTask.create(source: @dashboard_executed_action)
|
||||||
|
|
||||||
redirect_to progress_proposal_dashboard_path(proposal.to_param),
|
redirect_to progress_proposal_dashboard_path(proposal.to_param),
|
||||||
{ flash: { info: t("dashboard.create_request.success") } }
|
{ flash: { info: t("dashboard.create_request.success") }}
|
||||||
else
|
else
|
||||||
flash.now[:alert] = @dashboard_executed_action.errors.full_messages.join("<br>")
|
flash.now[:alert] = @dashboard_executed_action.errors.full_messages.join("<br>")
|
||||||
render :new_request
|
render :new_request
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class DirectUploadsController < ApplicationController
|
|||||||
render json: { cached_attachment: @direct_upload.relation.cached_attachment,
|
render json: { cached_attachment: @direct_upload.relation.cached_attachment,
|
||||||
filename: @direct_upload.relation.attachment.original_filename,
|
filename: @direct_upload.relation.attachment.original_filename,
|
||||||
destroy_link: render_destroy_upload_link(@direct_upload).html_safe,
|
destroy_link: render_destroy_upload_link(@direct_upload).html_safe,
|
||||||
attachment_url: @direct_upload.relation.attachment.url}
|
attachment_url: @direct_upload.relation.attachment.url }
|
||||||
else
|
else
|
||||||
@direct_upload.destroy_attachment
|
@direct_upload.destroy_attachment
|
||||||
render json: { errors: @direct_upload.errors[:attachment].join(", ") },
|
render json: { errors: @direct_upload.errors[:attachment].join(", ") },
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class Legislation::ProcessesController < Legislation::BaseController
|
|||||||
@phase = :resume
|
@phase = :resume
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.xlsx {render xlsx: "resume_to_xlsx", filename: ("resume-" + Date.current.to_s + ".xlsx")}
|
format.xlsx { render xlsx: "resume_to_xlsx", filename: ("resume-" + Date.current.to_s + ".xlsx") }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ class Management::SessionsController < ActionController::Base
|
|||||||
|
|
||||||
def admin?
|
def admin?
|
||||||
if current_user.try(:administrator?)
|
if current_user.try(:administrator?)
|
||||||
session[:manager] = {login: "admin_user_#{current_user.id}"}
|
session[:manager] = { login: "admin_user_#{current_user.id}" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def manager?
|
def manager?
|
||||||
if current_user.try(:manager?)
|
if current_user.try(:manager?)
|
||||||
session[:manager] = {login: "manager_user_#{current_user.id}"}
|
session[:manager] = { login: "manager_user_#{current_user.id}" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class Officing::PollsController < Officing::BaseController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
@polls = current_user.poll_officer? ? current_user.poll_officer.voting_days_assigned_polls : []
|
@polls = current_user.poll_officer? ? current_user.poll_officer.voting_days_assigned_polls : []
|
||||||
@polls = @polls.select {|poll| poll.current?(Time.current) || poll.current?(1.day.ago)}
|
@polls = @polls.select { |poll| poll.current?(Time.current) || poll.current?(1.day.ago) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def final
|
def final
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class Polls::AnswersController < ApplicationController
|
|||||||
load_for_answers
|
load_for_answers
|
||||||
if @question.enum_type&.include?("answer_couples")
|
if @question.enum_type&.include?("answer_couples")
|
||||||
last_pair ||= generate_and_store_new_pair(@question)
|
last_pair ||= generate_and_store_new_pair(@question)
|
||||||
@last_pair_question_answers = {@question.id => last_pair}
|
@last_pair_question_answers = { @question.id => last_pair }
|
||||||
end
|
end
|
||||||
render "polls/questions/answer", format: :js
|
render "polls/questions/answer", format: :js
|
||||||
end
|
end
|
||||||
@@ -34,7 +34,7 @@ class Polls::AnswersController < ApplicationController
|
|||||||
load_for_answers
|
load_for_answers
|
||||||
if @question.enum_type&.include?("answer_couples")
|
if @question.enum_type&.include?("answer_couples")
|
||||||
last_pair ||= generate_and_store_new_pair(@question)
|
last_pair ||= generate_and_store_new_pair(@question)
|
||||||
@last_pair_question_answers = {@question.id => last_pair}
|
@last_pair_question_answers = { @question.id => last_pair }
|
||||||
end
|
end
|
||||||
render "polls/questions/answer", format: :js
|
render "polls/questions/answer", format: :js
|
||||||
end
|
end
|
||||||
@@ -53,10 +53,10 @@ class Polls::AnswersController < ApplicationController
|
|||||||
def load_for_answers
|
def load_for_answers
|
||||||
@page = params[:page].present? ? params[:page] : 1
|
@page = params[:page].present? ? params[:page] : 1
|
||||||
question_answers
|
question_answers
|
||||||
@answers_by_question_id = {@question.id => @question.answers
|
@answers_by_question_id = { @question.id => @question.answers
|
||||||
.by_author(current_user)
|
.by_author(current_user)
|
||||||
.order(:order)
|
.order(:order)
|
||||||
.pluck(:answer)}
|
.pluck(:answer) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def question_answers
|
def question_answers
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Polls::QuestionsController < ApplicationController
|
|||||||
load_for_answers
|
load_for_answers
|
||||||
if @question.enum_type&.include?("answer_couples")
|
if @question.enum_type&.include?("answer_couples")
|
||||||
last_pair ||= generate_and_store_new_pair(@question)
|
last_pair ||= generate_and_store_new_pair(@question)
|
||||||
@last_pair_question_answers = {@question.id => last_pair}
|
@last_pair_question_answers = { @question.id => last_pair }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -39,10 +39,10 @@ class Polls::QuestionsController < ApplicationController
|
|||||||
def load_for_answers
|
def load_for_answers
|
||||||
@page = params[:page].present? ? params[:page] : 1
|
@page = params[:page].present? ? params[:page] : 1
|
||||||
question_answers
|
question_answers
|
||||||
@answers_by_question_id = {@question.id => @question.answers
|
@answers_by_question_id = { @question.id => @question.answers
|
||||||
.by_author(current_user)
|
.by_author(current_user)
|
||||||
.order(:order)
|
.order(:order)
|
||||||
.pluck(:answer)}
|
.pluck(:answer) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def vote_stored(answer, new_answer, token)
|
def vote_stored(answer, new_answer, token)
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class ProposalsController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def proposal_params
|
def proposal_params
|
||||||
attributes = [:video_url,:responsible_name, :tag_list,
|
attributes = [:video_url, :responsible_name, :tag_list,
|
||||||
:terms_of_service, :geozone_id, :skip_map,
|
:terms_of_service, :geozone_id, :skip_map,
|
||||||
image_attributes: image_attributes,
|
image_attributes: image_attributes,
|
||||||
documents_attributes: [:id, :title, :attachment, :cached_attachment,
|
documents_attributes: [:id, :title, :attachment, :cached_attachment,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class RemoteTranslationsController < ApplicationController
|
|||||||
def set_remote_translations
|
def set_remote_translations
|
||||||
remote_translations = remote_translations_params["remote_translations"]
|
remote_translations = remote_translations_params["remote_translations"]
|
||||||
decoded_remote_translations = ActiveSupport::JSON.decode(remote_translations)
|
decoded_remote_translations = ActiveSupport::JSON.decode(remote_translations)
|
||||||
@remote_translations = decoded_remote_translations.map{ |remote_translation|
|
@remote_translations = decoded_remote_translations.map { |remote_translation|
|
||||||
remote_translation.slice("remote_translatable_id",
|
remote_translation.slice("remote_translatable_id",
|
||||||
"remote_translatable_type",
|
"remote_translatable_type",
|
||||||
"locale")
|
"locale")
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class Tracking::BudgetInvestmentsController < Tracking::BaseController
|
|||||||
filters << {
|
filters << {
|
||||||
name: heading.name,
|
name: heading.name,
|
||||||
id: heading.id,
|
id: heading.id,
|
||||||
count: investments.select{|i| i.heading_id == heading.id}.size
|
count: investments.select { |i| i.heading_id == heading.id }.size
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
filters.uniq
|
filters.uniq
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Tracking::ProposalProgressBarsController < Tracking::ProgressBarsController
|
class Tracking::ProposalProgressBarsController < Tracking::ProgressBarsController
|
||||||
|
|
||||||
private
|
private
|
||||||
def progressable
|
def progressable
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class Users::ConfirmationsController < Devise::ConfirmationsController
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
resource.errors.add(:email, :password_already_set)
|
resource.errors.add(:email, :password_already_set)
|
||||||
respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new }
|
respond_with_navigational(resource.errors, status: :unprocessable_entity) { render :new }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -33,14 +33,14 @@ class Users::ConfirmationsController < Devise::ConfirmationsController
|
|||||||
|
|
||||||
# New condition added to if: when no password was given, display the "show" view (which uses "update" above)
|
# New condition added to if: when no password was given, display the "show" view (which uses "update" above)
|
||||||
if resource.encrypted_password.blank?
|
if resource.encrypted_password.blank?
|
||||||
respond_with_navigational(resource){ render :show }
|
respond_with_navigational(resource) { render :show }
|
||||||
elsif resource.errors.empty?
|
elsif resource.errors.empty?
|
||||||
set_official_position if resource.has_official_email?
|
set_official_position if resource.has_official_email?
|
||||||
resource.confirm # Last change: confirm happens here for people with passwords instead of af the top of the show action
|
resource.confirm # Last change: confirm happens here for people with passwords instead of af the top of the show action
|
||||||
set_flash_message(:notice, :confirmed) if is_flashing_format?
|
set_flash_message(:notice, :confirmed) if is_flashing_format?
|
||||||
respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) }
|
respond_with_navigational(resource) { redirect_to after_confirmation_path_for(resource_name, resource) }
|
||||||
else
|
else
|
||||||
respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new }
|
respond_with_navigational(resource.errors, status: :unprocessable_entity) { render :new }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
|||||||
|
|
||||||
def check_username
|
def check_username
|
||||||
if User.find_by username: params[:username]
|
if User.find_by username: params[:username]
|
||||||
render json: {available: false, message: t("devise_views.users.registrations.new.username_is_not_available")}
|
render json: { available: false, message: t("devise_views.users.registrations.new.username_is_not_available") }
|
||||||
else
|
else
|
||||||
render json: {available: true, message: t("devise_views.users.registrations.new.username_is_available")}
|
render json: { available: true, message: t("devise_views.users.registrations.new.username_is_available") }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
|
|||||||
filters << {
|
filters << {
|
||||||
name: heading.name,
|
name: heading.name,
|
||||||
id: heading.id,
|
id: heading.id,
|
||||||
count: investments.select{|i| i.heading_id == heading.id}.size
|
count: investments.select { |i| i.heading_id == heading.id }.size
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ module AdminHelper
|
|||||||
|
|
||||||
def admin_select_options
|
def admin_select_options
|
||||||
Administrator.with_user
|
Administrator.with_user
|
||||||
.collect { |v| [ v.description_or_name, v.id ] }
|
.collect { |v| [v.description_or_name, v.id] }
|
||||||
.sort_by { |a| a[0] }
|
.sort_by { |a| a[0] }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ module BudgetExecutionsHelper
|
|||||||
|
|
||||||
def first_milestone_with_image(investment)
|
def first_milestone_with_image(investment)
|
||||||
investment.milestones.order_by_publication_date
|
investment.milestones.order_by_publication_date
|
||||||
.select{ |milestone| milestone.image.present? }.last
|
.select { |milestone| milestone.image.present? }.last
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ module BudgetsHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def budget_phases_select_options
|
def budget_phases_select_options
|
||||||
Budget::Phase::PHASE_KINDS.map { |ph| [ t("budgets.phase.#{ph}"), ph ] }
|
Budget::Phase::PHASE_KINDS.map { |ph| [t("budgets.phase.#{ph}"), ph] }
|
||||||
end
|
end
|
||||||
|
|
||||||
def budget_currency_symbol_select_options
|
def budget_currency_symbol_select_options
|
||||||
Budget::CURRENCY_SYMBOLS.map { |cs| [ cs, cs ] }
|
Budget::CURRENCY_SYMBOLS.map { |cs| [cs, cs] }
|
||||||
end
|
end
|
||||||
|
|
||||||
def namespaced_budget_investment_path(investment, options = {})
|
def namespaced_budget_investment_path(investment, options = {})
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ module DocumentsHelper
|
|||||||
remote: true,
|
remote: true,
|
||||||
class: "delete remove-cached-attachment"
|
class: "delete remove-cached-attachment"
|
||||||
else
|
else
|
||||||
link_to_remove_association document.new_record? ? t("documents.form.cancel_button") : t("documents.form.delete_button") , builder, class: "delete remove-document"
|
link_to_remove_association document.new_record? ? t("documents.form.cancel_button") : t("documents.form.delete_button"), builder, class: "delete remove-document"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ module FollowablesHelper
|
|||||||
|
|
||||||
followable = follow.followable
|
followable = follow.followable
|
||||||
partial = followable_class_name(followable) + "_follow"
|
partial = followable_class_name(followable) + "_follow"
|
||||||
locals = {followable_class_name(followable).to_sym => followable}
|
locals = { followable_class_name(followable).to_sym => followable }
|
||||||
|
|
||||||
render partial, locals
|
render partial, locals
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ module GeozonesHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def geozone_select_options
|
def geozone_select_options
|
||||||
Geozone.all.order(name: :asc).collect { |g| [ g.name, g.id ] }
|
Geozone.all.order(name: :asc).collect { |g| [g.name, g.id] }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ module GlobalizeHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def available_locales(resource)
|
def available_locales(resource)
|
||||||
I18n.available_locales.select{ |locale| enabled_locale?(resource, locale) }.map do |locale|
|
I18n.available_locales.select { |locale| enabled_locale?(resource, locale) }.map do |locale|
|
||||||
[name_for_locale(locale), locale , { data: { locale: locale } }]
|
[name_for_locale(locale), locale, { data: { locale: locale }}]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ module ImageablesHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def imageable_accepted_content_types
|
def imageable_accepted_content_types
|
||||||
Setting["uploads.images.content_types"]&.split(" ") || [ "image/jpeg" ]
|
Setting["uploads.images.content_types"]&.split(" ") || ["image/jpeg"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def imageable_accepted_content_types_extensions
|
def imageable_accepted_content_types_extensions
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ module OfficingHelper
|
|||||||
officer_assignments.each do |oa|
|
officer_assignments.each do |oa|
|
||||||
options << [oa.booth_assignment.booth.name.to_s, oa.id]
|
options << [oa.booth_assignment.booth.name.to_s, oa.id]
|
||||||
end
|
end
|
||||||
options.sort! {|x, y| x[0] <=> y[0]}
|
options.sort! { |x, y| x[0] <=> y[0] }
|
||||||
options_for_select(options, params[:oa])
|
options_for_select(options, params[:oa])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ module ProposalsDashboardHelper
|
|||||||
|
|
||||||
def new_resources_since_last_login?(resources, new_actions_since_last_login)
|
def new_resources_since_last_login?(resources, new_actions_since_last_login)
|
||||||
if resources.present?
|
if resources.present?
|
||||||
resources.pluck(:id).any? {|id| new_actions_since_last_login.include?(id) }
|
resources.pluck(:id).any? { |id| new_actions_since_last_login.include?(id) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ module ProposalsHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def retire_proposals_options
|
def retire_proposals_options
|
||||||
Proposal::RETIRE_OPTIONS.collect { |option| [ t("proposals.retire_options.#{option}"), option ] }
|
Proposal::RETIRE_OPTIONS.collect { |option| [t("proposals.retire_options.#{option}"), option] }
|
||||||
end
|
end
|
||||||
|
|
||||||
def empty_recommended_proposals_message_text(user)
|
def empty_recommended_proposals_message_text(user)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
module SearchHelper
|
module SearchHelper
|
||||||
|
|
||||||
def official_level_search_options
|
def official_level_search_options
|
||||||
options_for_select((1..5).map{ |i| [setting["official_level_#{i}_name"], i] },
|
options_for_select((1..5).map { |i| [setting["official_level_#{i}_name"], i] },
|
||||||
params[:advanced_search].try(:[], :official_level))
|
params[:advanced_search].try(:[], :official_level))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ module SettingsHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def setting
|
def setting
|
||||||
@all_settings ||= Hash[ Setting.all.map{|s| [s.key, s.value.presence]} ]
|
@all_settings ||= Hash[Setting.all.map { |s| [s.key, s.value.presence] }]
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_setting_name(setting_name)
|
def display_setting_name(setting_name)
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ module ValuationHelper
|
|||||||
|
|
||||||
def valuator_select_options
|
def valuator_select_options
|
||||||
Valuator.order("description ASC").order("users.email ASC").includes(:user).
|
Valuator.order("description ASC").order("users.email ASC").includes(:user).
|
||||||
collect { |v| [ v.description_or_email, "valuator_#{v.id}"] }
|
collect { |v| [v.description_or_email, "valuator_#{v.id}"] }
|
||||||
end
|
end
|
||||||
|
|
||||||
def valuator_group_select_options
|
def valuator_group_select_options
|
||||||
ValuatorGroup.order("name ASC").collect { |g| [ g.name, "group_#{g.id}"] }
|
ValuatorGroup.order("name ASC").collect { |g| [g.name, "group_#{g.id}"] }
|
||||||
end
|
end
|
||||||
|
|
||||||
def assigned_valuators_info(valuators)
|
def assigned_valuators_info(valuators)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ module ValuatorsHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def valuator_abilities(valuator)
|
def valuator_abilities(valuator)
|
||||||
[ valuator.can_comment ? I18n.t("admin.valuators.index.can_comment") : nil ,
|
[valuator.can_comment ? I18n.t("admin.valuators.index.can_comment") : nil,
|
||||||
valuator.can_edit_dossier ? I18n.t("admin.valuators.index.can_edit_dossier") : nil
|
valuator.can_edit_dossier ? I18n.t("admin.valuators.index.can_edit_dossier") : nil
|
||||||
].compact.join(", ")
|
].compact.join(", ")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ module VotesHelper
|
|||||||
def css_classes_for_vote(votes, votable)
|
def css_classes_for_vote(votes, votable)
|
||||||
case votes[votable.id]
|
case votes[votable.id]
|
||||||
when true
|
when true
|
||||||
{in_favor: "voted", against: "no-voted"}
|
{ in_favor: "voted", against: "no-voted" }
|
||||||
when false
|
when false
|
||||||
{in_favor: "no-voted", against: "voted"}
|
{ in_favor: "no-voted", against: "voted" }
|
||||||
else
|
else
|
||||||
{in_favor: "", against: ""}
|
{ in_favor: "", against: "" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ module Abilities
|
|||||||
merge Abilities::Common.new(user)
|
merge Abilities::Common.new(user)
|
||||||
|
|
||||||
can :read, Organization
|
can :read, Organization
|
||||||
can(:verify, Organization){ |o| !o.verified? }
|
can(:verify, Organization) { |o| !o.verified? }
|
||||||
can(:reject, Organization){ |o| !o.rejected? }
|
can(:reject, Organization) { |o| !o.rejected? }
|
||||||
|
|
||||||
can :read, Comment
|
can :read, Comment
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class Activity < ApplicationRecord
|
|||||||
|
|
||||||
VALID_ACTIONS = %w[hide block restore valuate email]
|
VALID_ACTIONS = %w[hide block restore valuate email]
|
||||||
|
|
||||||
validates :action, inclusion: {in: VALID_ACTIONS}
|
validates :action, inclusion: { in: VALID_ACTIONS }
|
||||||
|
|
||||||
scope :on_proposals, -> { where(actionable_type: "Proposal") }
|
scope :on_proposals, -> { where(actionable_type: "Proposal") }
|
||||||
scope :on_debates, -> { where(actionable_type: "Debate") }
|
scope :on_debates, -> { where(actionable_type: "Debate") }
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ module Ahoy
|
|||||||
# chart
|
# chart
|
||||||
def add(name, collection)
|
def add(name, collection)
|
||||||
collections.push data: collection, name: name
|
collections.push data: collection, name: name
|
||||||
collection.each_key{ |key| add_key key }
|
collection.each_key { |key| add_key key }
|
||||||
end
|
end
|
||||||
|
|
||||||
def build
|
def build
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ class Budget
|
|||||||
has_many :valuator_group_assignments, dependent: :destroy
|
has_many :valuator_group_assignments, dependent: :destroy
|
||||||
has_many :valuator_groups, through: :valuator_group_assignments
|
has_many :valuator_groups, through: :valuator_group_assignments
|
||||||
|
|
||||||
has_many :comments, -> {where(valuation: false)}, as: :commentable, class_name: "Comment"
|
has_many :comments, -> { where(valuation: false) }, as: :commentable, class_name: "Comment"
|
||||||
has_many :valuations, -> {where(valuation: true)}, as: :commentable, class_name: "Comment"
|
has_many :valuations, -> { where(valuation: true) }, as: :commentable, class_name: "Comment"
|
||||||
|
|
||||||
has_many :tracker_assignments, dependent: :destroy
|
has_many :tracker_assignments, dependent: :destroy
|
||||||
has_many :trackers, through: :tracker_assignments
|
has_many :trackers, through: :tracker_assignments
|
||||||
@@ -74,7 +74,7 @@ class Budget
|
|||||||
scope :without_valuator, -> { valuation_open.without_valuator_group.where(valuator_assignments_count: 0) }
|
scope :without_valuator, -> { valuation_open.without_valuator_group.where(valuator_assignments_count: 0) }
|
||||||
scope :under_valuation, -> { valuation_open.valuating.where("administrator_id IS NOT ?", nil) }
|
scope :under_valuation, -> { valuation_open.valuating.where("administrator_id IS NOT ?", nil) }
|
||||||
scope :managed, -> { valuation_open.where(valuator_assignments_count: 0).where("administrator_id IS NOT ?", nil) }
|
scope :managed, -> { valuation_open.where(valuator_assignments_count: 0).where("administrator_id IS NOT ?", nil) }
|
||||||
scope :valuating, -> { valuation_open.where("valuator_assignments_count > 0 OR valuator_group_assignments_count > 0" ) }
|
scope :valuating, -> { valuation_open.where("valuator_assignments_count > 0 OR valuator_group_assignments_count > 0") }
|
||||||
scope :visible_to_valuators, -> { where(visible_to_valuators: true) }
|
scope :visible_to_valuators, -> { where(visible_to_valuators: true) }
|
||||||
scope :valuation_finished, -> { where(valuation_finished: true) }
|
scope :valuation_finished, -> { where(valuation_finished: true) }
|
||||||
scope :valuation_finished_feasible, -> { where(valuation_finished: true, feasibility: "feasible") }
|
scope :valuation_finished_feasible, -> { where(valuation_finished: true, feasibility: "feasible") }
|
||||||
@@ -88,7 +88,7 @@ class Budget
|
|||||||
scope :incompatible, -> { where(incompatible: true) }
|
scope :incompatible, -> { where(incompatible: true) }
|
||||||
scope :winners, -> { selected.compatible.where(winner: true) }
|
scope :winners, -> { selected.compatible.where(winner: true) }
|
||||||
scope :unselected, -> { not_unfeasible.where(selected: false) }
|
scope :unselected, -> { not_unfeasible.where(selected: false) }
|
||||||
scope :last_week, -> { where("created_at >= ?", 7.days.ago)}
|
scope :last_week, -> { where("created_at >= ?", 7.days.ago) }
|
||||||
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
||||||
scope :sort_by_created_at, -> { reorder(created_at: :desc) }
|
scope :sort_by_created_at, -> { reorder(created_at: :desc) }
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ class Budget
|
|||||||
|
|
||||||
validates :user, presence: true
|
validates :user, presence: true
|
||||||
validates :investment, presence: true
|
validates :investment, presence: true
|
||||||
validates :reason, inclusion: {in: REASONS, allow_nil: false}
|
validates :reason, inclusion: { in: REASONS, allow_nil: false }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -72,18 +72,18 @@ class Budget::Stats
|
|||||||
end
|
end
|
||||||
|
|
||||||
groups[:total] = Hash.new(0)
|
groups[:total] = Hash.new(0)
|
||||||
groups[:total][:total_investments_count] = groups.collect {|_k, v| v[:total_investments_count]}.sum
|
groups[:total][:total_investments_count] = groups.collect { |_k, v| v[:total_investments_count] }.sum
|
||||||
groups[:total][:total_participants_support_phase] = groups.collect {|_k, v| v[:total_participants_support_phase]}.sum
|
groups[:total][:total_participants_support_phase] = groups.collect { |_k, v| v[:total_participants_support_phase] }.sum
|
||||||
groups[:total][:total_participants_vote_phase] = groups.collect {|_k, v| v[:total_participants_vote_phase]}.sum
|
groups[:total][:total_participants_vote_phase] = groups.collect { |_k, v| v[:total_participants_vote_phase] }.sum
|
||||||
groups[:total][:total_participants_every_phase] = groups.collect {|_k, v| v[:total_participants_every_phase]}.sum
|
groups[:total][:total_participants_every_phase] = groups.collect { |_k, v| v[:total_participants_every_phase] }.sum
|
||||||
|
|
||||||
budget.headings.each do |heading|
|
budget.headings.each do |heading|
|
||||||
groups[heading.id].merge!(calculate_heading_stats_with_totals(groups[heading.id], groups[:total], heading.population))
|
groups[heading.id].merge!(calculate_heading_stats_with_totals(groups[heading.id], groups[:total], heading.population))
|
||||||
end
|
end
|
||||||
|
|
||||||
groups[:total][:percentage_participants_support_phase] = groups.collect {|_k, v| v[:percentage_participants_support_phase]}.sum
|
groups[:total][:percentage_participants_support_phase] = groups.collect { |_k, v| v[:percentage_participants_support_phase] }.sum
|
||||||
groups[:total][:percentage_participants_vote_phase] = groups.collect {|_k, v| v[:percentage_participants_vote_phase]}.sum
|
groups[:total][:percentage_participants_vote_phase] = groups.collect { |_k, v| v[:percentage_participants_vote_phase] }.sum
|
||||||
groups[:total][:percentage_participants_every_phase] = groups.collect {|_k, v| v[:percentage_participants_every_phase]}.sum
|
groups[:total][:percentage_participants_every_phase] = groups.collect { |_k, v| v[:percentage_participants_every_phase] }.sum
|
||||||
|
|
||||||
groups
|
groups
|
||||||
end
|
end
|
||||||
@@ -125,7 +125,7 @@ class Budget::Stats
|
|||||||
def balloters_by_heading(heading_id)
|
def balloters_by_heading(heading_id)
|
||||||
stats_cache("balloters_by_heading_#{heading_id}") do
|
stats_cache("balloters_by_heading_#{heading_id}") do
|
||||||
budget.ballots.joins(:lines)
|
budget.ballots.joins(:lines)
|
||||||
.where(budget_ballot_lines: { heading_id: heading_id} )
|
.where(budget_ballot_lines: { heading_id: heading_id })
|
||||||
.distinct.pluck(:user_id)
|
.distinct.pluck(:user_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ module Documentable
|
|||||||
end
|
end
|
||||||
|
|
||||||
def accepted_content_types
|
def accepted_content_types
|
||||||
Setting["uploads.documents.content_types"]&.split(" ") || [ "application/pdf" ]
|
Setting["uploads.documents.content_types"]&.split(" ") || ["application/pdf"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module DownloadSettings
|
|||||||
CSV.generate(options) do |csv|
|
CSV.generate(options) do |csv|
|
||||||
csv << attributes
|
csv << attributes
|
||||||
budgets.each do |budget|
|
budgets.each do |budget|
|
||||||
csv << attributes.map{ |attr| budget.send(attr)}
|
csv << attributes.map { |attr| budget.send(attr) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module DownloadSettings
|
|||||||
CSV.generate(options) do |csv|
|
CSV.generate(options) do |csv|
|
||||||
csv << attributes
|
csv << attributes
|
||||||
comments.each do |comment|
|
comments.each do |comment|
|
||||||
csv << attributes.map {|attr| comment.send(attr)}
|
csv << attributes.map { |attr| comment.send(attr) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module DownloadSettings
|
|||||||
CSV.generate(options) do |csv|
|
CSV.generate(options) do |csv|
|
||||||
csv << attributes
|
csv << attributes
|
||||||
debates.each do |debate|
|
debates.each do |debate|
|
||||||
csv << attributes.map{ |attr| debate.send(attr)}
|
csv << attributes.map { |attr| debate.send(attr) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module DownloadSettings
|
|||||||
CSV.generate(options) do |csv|
|
CSV.generate(options) do |csv|
|
||||||
csv << attributes
|
csv << attributes
|
||||||
processes.each do |process|
|
processes.each do |process|
|
||||||
csv << attributes.map{ |attr| process.send(attr)}
|
csv << attributes.map { |attr| process.send(attr) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module DownloadSettings
|
|||||||
CSV.generate(options) do |csv|
|
CSV.generate(options) do |csv|
|
||||||
csv << attributes
|
csv << attributes
|
||||||
proposals.each do |proposal|
|
proposals.each do |proposal|
|
||||||
csv << attributes.map {|attr| proposal.send(attr)}
|
csv << attributes.map { |attr| proposal.send(attr) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ module Followable
|
|||||||
has_many :follows, as: :followable, dependent: :destroy
|
has_many :follows, as: :followable, dependent: :destroy
|
||||||
has_many :followers, through: :follows, source: :user
|
has_many :followers, through: :follows, source: :user
|
||||||
|
|
||||||
scope :followed_by_user, ->(user){
|
scope :followed_by_user, ->(user) {
|
||||||
joins(:follows).where("follows.user_id = ?", user.id)
|
joins(:follows).where("follows.user_id = ?", user.id)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,18 +22,18 @@ module Globalizable
|
|||||||
end
|
end
|
||||||
|
|
||||||
def locales_persisted_and_marked_for_destruction
|
def locales_persisted_and_marked_for_destruction
|
||||||
translations.select{|t| t.persisted? && t.marked_for_destruction? }.map(&:locale)
|
translations.select { |t| t.persisted? && t.marked_for_destruction? }.map(&:locale)
|
||||||
end
|
end
|
||||||
|
|
||||||
def translations_required?
|
def translations_required?
|
||||||
translated_attribute_names.any?{|attr| required_attribute?(attr)}
|
translated_attribute_names.any? { |attr| required_attribute?(attr) }
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.paranoid? && translation_class.attribute_names.include?("hidden_at")
|
if self.paranoid? && translation_class.attribute_names.include?("hidden_at")
|
||||||
translation_class.send :acts_as_paranoid, column: :hidden_at
|
translation_class.send :acts_as_paranoid, column: :hidden_at
|
||||||
end
|
end
|
||||||
|
|
||||||
scope :with_translation, -> { joins("LEFT OUTER JOIN #{translations_table_name} ON #{table_name}.id = #{translations_table_name}.#{reflections["translations"].foreign_key} AND #{translations_table_name}.locale='#{I18n.locale }'") }
|
scope :with_translation, -> { joins("LEFT OUTER JOIN #{translations_table_name} ON #{table_name}.id = #{translations_table_name}.#{reflections["translations"].foreign_key} AND #{translations_table_name}.locale='#{I18n.locale}'") }
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ module Globalizable
|
|||||||
presence_validators = [ActiveModel::Validations::PresenceValidator,
|
presence_validators = [ActiveModel::Validations::PresenceValidator,
|
||||||
ActiveRecord::Validations::PresenceValidator]
|
ActiveRecord::Validations::PresenceValidator]
|
||||||
|
|
||||||
attribute_validators(attribute).any?{|validator| presence_validators.include? validator }
|
attribute_validators(attribute).any? { |validator| presence_validators.include? validator }
|
||||||
end
|
end
|
||||||
|
|
||||||
def attribute_validators(attribute)
|
def attribute_validators(attribute)
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ module SearchCache
|
|||||||
|
|
||||||
def searchable_values_sql
|
def searchable_values_sql
|
||||||
searchable_values
|
searchable_values
|
||||||
.select{ |k, _| k.present? }
|
.select { |k, _| k.present? }
|
||||||
.collect{ |value, weight| set_tsvector(value, weight) }
|
.collect { |value, weight| set_tsvector(value, weight) }
|
||||||
.join(" || ")
|
.join(" || ")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ module Taggable
|
|||||||
def tag_list_with_limit(limit = nil)
|
def tag_list_with_limit(limit = nil)
|
||||||
return tags if limit.blank?
|
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
|
end
|
||||||
|
|
||||||
def tags_count_out_of_limit(limit = nil)
|
def tags_count_out_of_limit(limit = nil)
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ class Debate < ApplicationRecord
|
|||||||
scope :sort_by_relevance, -> { all }
|
scope :sort_by_relevance, -> { all }
|
||||||
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
||||||
scope :sort_by_recommendations, -> { order(cached_votes_total: :desc) }
|
scope :sort_by_recommendations, -> { order(cached_votes_total: :desc) }
|
||||||
scope :last_week, -> { where("created_at >= ?", 7.days.ago)}
|
scope :last_week, -> { where("created_at >= ?", 7.days.ago) }
|
||||||
scope :featured, -> { where("featured_at is not null")}
|
scope :featured, -> { where("featured_at is not null") }
|
||||||
scope :public_for_api, -> { all }
|
scope :public_for_api, -> { all }
|
||||||
|
|
||||||
# Ahoy setup
|
# Ahoy setup
|
||||||
@@ -149,11 +149,11 @@ class Debate < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def after_hide
|
def after_hide
|
||||||
tags.each{ |t| t.decrement_custom_counter_for("Debate") }
|
tags.each { |t| t.decrement_custom_counter_for("Debate") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_restore
|
def after_restore
|
||||||
tags.each{ |t| t.increment_custom_counter_for("Debate") }
|
tags.each { |t| t.increment_custom_counter_for("Debate") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def featured?
|
def featured?
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ class Legislation::Annotation < ApplicationRecord
|
|||||||
selector_end = "/html/body/#{range_end}"
|
selector_end = "/html/body/#{range_end}"
|
||||||
el_end = doc.at_xpath(selector_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]
|
remainder_el_end = el_end.text[range_end_offset..-1]
|
||||||
|
|
||||||
self.context = "#{remainder_el_start}<span class=annotator-hl>#{quote}</span>#{remainder_el_end}"
|
self.context = "#{remainder_el_start}<span class=annotator-hl>#{quote}</span>#{remainder_el_end}"
|
||||||
rescue
|
rescue
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class Legislation::Answer < ApplicationRecord
|
|||||||
inverse_of: :answers, counter_cache: true
|
inverse_of: :answers, counter_cache: true
|
||||||
belongs_to :user, dependent: :destroy, inverse_of: :legislation_answers
|
belongs_to :user, dependent: :destroy, inverse_of: :legislation_answers
|
||||||
|
|
||||||
validates :question, presence: true, uniqueness: { scope: :user_id}
|
validates :question, presence: true, uniqueness: { scope: :user_id }
|
||||||
validates :question_option, presence: true
|
validates :question_option, presence: true
|
||||||
validates :user, presence: true
|
validates :user, presence: true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class Legislation::PeopleProposal < ApplicationRecord
|
|||||||
scope :sort_by_id, -> { reorder(id: :asc) }
|
scope :sort_by_id, -> { reorder(id: :asc) }
|
||||||
scope :sort_by_supports, -> { reorder(cached_votes_score: :desc) }
|
scope :sort_by_supports, -> { reorder(cached_votes_score: :desc) }
|
||||||
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
||||||
scope :last_week, -> { where("people_proposals.created_at >= ?", 7.days.ago)}
|
scope :last_week, -> { where("people_proposals.created_at >= ?", 7.days.ago) }
|
||||||
scope :validated, -> { where(validated: true) }
|
scope :validated, -> { where(validated: true) }
|
||||||
scope :selected, -> { where(selected: true) }
|
scope :selected, -> { where(selected: true) }
|
||||||
scope :winners, -> { selected.sort_by_confidence_score }
|
scope :winners, -> { selected.sort_by_confidence_score }
|
||||||
@@ -60,7 +60,7 @@ class Legislation::PeopleProposal < ApplicationRecord
|
|||||||
author.username => "B",
|
author.username => "B",
|
||||||
tag_list.join(" ") => "B",
|
tag_list.join(" ") => "B",
|
||||||
summary => "C",
|
summary => "C",
|
||||||
description => "D"}
|
description => "D" }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.search(terms)
|
def self.search(terms)
|
||||||
@@ -131,11 +131,11 @@ class Legislation::PeopleProposal < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def after_hide
|
def after_hide
|
||||||
tags.each{ |t| t.decrement_custom_counter_for("LegislationPeopleProposal") }
|
tags.each { |t| t.decrement_custom_counter_for("LegislationPeopleProposal") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_restore
|
def after_restore
|
||||||
tags.each{ |t| t.increment_custom_counter_for("LegislationPeopleProposal") }
|
tags.each { |t| t.increment_custom_counter_for("LegislationPeopleProposal") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def contact_info
|
def contact_info
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class Legislation::Proposal < ApplicationRecord
|
|||||||
scope :sort_by_id, -> { reorder(id: :asc) }
|
scope :sort_by_id, -> { reorder(id: :asc) }
|
||||||
scope :sort_by_supports, -> { reorder(cached_votes_score: :desc) }
|
scope :sort_by_supports, -> { reorder(cached_votes_score: :desc) }
|
||||||
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
||||||
scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)}
|
scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago) }
|
||||||
scope :selected, -> { where(selected: true) }
|
scope :selected, -> { where(selected: true) }
|
||||||
scope :winners, -> { selected.sort_by_confidence_score }
|
scope :winners, -> { selected.sort_by_confidence_score }
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ class Legislation::Proposal < ApplicationRecord
|
|||||||
tag_list.join(" ") => "B",
|
tag_list.join(" ") => "B",
|
||||||
geozone.try(:name) => "B",
|
geozone.try(:name) => "B",
|
||||||
summary => "C",
|
summary => "C",
|
||||||
description => "D"}
|
description => "D" }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.search(terms)
|
def self.search(terms)
|
||||||
@@ -132,11 +132,11 @@ class Legislation::Proposal < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def after_hide
|
def after_hide
|
||||||
tags.each{ |t| t.decrement_custom_counter_for("LegislationProposal") }
|
tags.each { |t| t.decrement_custom_counter_for("LegislationProposal") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_restore
|
def after_restore
|
||||||
tags.each{ |t| t.increment_custom_counter_for("LegislationProposal") }
|
tags.each { |t| t.increment_custom_counter_for("LegislationProposal") }
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ class LocalCensusRecords::Import
|
|||||||
|
|
||||||
def file_headers_definition
|
def file_headers_definition
|
||||||
headers = fetch_file_headers
|
headers = fetch_file_headers
|
||||||
return if headers.all? {|header| ATTRIBUTES.include? header } &&
|
return if headers.all? { |header| ATTRIBUTES.include? header } &&
|
||||||
ATTRIBUTES.all? {|attr| headers.include? attr }
|
ATTRIBUTES.all? { |attr| headers.include? attr }
|
||||||
|
|
||||||
errors.add :file, :headers, required_headers: ATTRIBUTES.join(", ")
|
errors.add :file, :headers, required_headers: ATTRIBUTES.join(", ")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class Poll < ApplicationRecord
|
|||||||
scope :expired, -> { where("ends_at < ?", Date.current.beginning_of_day) }
|
scope :expired, -> { where("ends_at < ?", Date.current.beginning_of_day) }
|
||||||
scope :recounting, -> { Poll.where(ends_at: (Date.current.beginning_of_day - RECOUNT_DURATION)..Date.current.beginning_of_day) }
|
scope :recounting, -> { Poll.where(ends_at: (Date.current.beginning_of_day - RECOUNT_DURATION)..Date.current.beginning_of_day) }
|
||||||
scope :published, -> { where("published = ?", true) }
|
scope :published, -> { where("published = ?", true) }
|
||||||
scope :by_geozone_id, ->(geozone_id) { where(geozones: {id: geozone_id}.joins(:geozones)) }
|
scope :by_geozone_id, ->(geozone_id) { where(geozones: { id: geozone_id }.joins(:geozones)) }
|
||||||
scope :public_for_api, -> { all }
|
scope :public_for_api, -> { all }
|
||||||
scope :not_budget, -> { where(budget_id: nil) }
|
scope :not_budget, -> { where(budget_id: nil) }
|
||||||
scope :created_by_admin, -> { where(related_type: nil) }
|
scope :created_by_admin, -> { where(related_type: nil) }
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ class Poll
|
|||||||
officer_assignments.voting_days.includes(booth_assignment: :poll).
|
officer_assignments.voting_days.includes(booth_assignment: :poll).
|
||||||
map(&:booth_assignment).
|
map(&:booth_assignment).
|
||||||
map(&:poll).uniq.compact.
|
map(&:poll).uniq.compact.
|
||||||
sort {|x, y| y.ends_at <=> x.ends_at}
|
sort { |x, y| y.ends_at <=> x.ends_at }
|
||||||
end
|
end
|
||||||
|
|
||||||
def final_days_assigned_polls
|
def final_days_assigned_polls
|
||||||
officer_assignments.final.includes(booth_assignment: :poll).
|
officer_assignments.final.includes(booth_assignment: :poll).
|
||||||
map(&:booth_assignment).
|
map(&:booth_assignment).
|
||||||
map(&:poll).uniq.compact.
|
map(&:poll).uniq.compact.
|
||||||
sort {|x, y| y.ends_at <=> x.ends_at}
|
sort { |x, y| y.ends_at <=> x.ends_at }
|
||||||
end
|
end
|
||||||
|
|
||||||
def todays_booths
|
def todays_booths
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ class Poll
|
|||||||
scope :by_officer_and_poll, ->(officer_id, poll_id) do
|
scope :by_officer_and_poll, ->(officer_id, poll_id) do
|
||||||
where("officer_id = ? AND poll_booth_assignments.poll_id = ?", officer_id, poll_id)
|
where("officer_id = ? AND poll_booth_assignments.poll_id = ?", officer_id, poll_id)
|
||||||
end
|
end
|
||||||
scope :by_officer, ->(officer){ where(officer_id: officer.id) }
|
scope :by_officer, ->(officer) { where(officer_id: officer.id) }
|
||||||
scope :by_poll, ->(poll){ joins(:booth_assignment).where("poll_booth_assignments.poll_id" => poll.id) }
|
scope :by_poll, ->(poll) { joins(:booth_assignment).where("poll_booth_assignments.poll_id" => poll.id) }
|
||||||
scope :by_booth, ->(booth){ joins(:booth_assignment).where("poll_booth_assignments.booth_id" => booth.id) }
|
scope :by_booth, ->(booth) { joins(:booth_assignment).where("poll_booth_assignments.booth_id" => booth.id) }
|
||||||
scope :by_date, ->(date){ where(date: date) }
|
scope :by_date, ->(date) { where(date: date) }
|
||||||
|
|
||||||
before_create :log_user_data
|
before_create :log_user_data
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class Poll::Question < ApplicationRecord
|
|||||||
|
|
||||||
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 :sort_for_list, -> { order("poll_questions.proposal_id IS NULL", :created_at) }
|
||||||
scope :for_render, -> { includes(:author, :proposal) }
|
scope :for_render, -> { includes(:author, :proposal) }
|
||||||
|
|
||||||
def self.search(params)
|
def self.search(params)
|
||||||
|
|||||||
@@ -76,12 +76,12 @@ class Poll::Question::Answer < ApplicationRecord
|
|||||||
when "positive_negative_open"
|
when "positive_negative_open"
|
||||||
answers = question.question_answers.visibles
|
answers = question.question_answers.visibles
|
||||||
.map { |a| count_positive_negative(a, true) - count_positive_negative(a, false) }
|
.map { |a| count_positive_negative(a, true) - count_positive_negative(a, false) }
|
||||||
is_most_voted = answers.none? {|a| a > total_votes_positive_negative}
|
is_most_voted = answers.none? { |a| a > total_votes_positive_negative }
|
||||||
update(most_voted: is_most_voted)
|
update(most_voted: is_most_voted)
|
||||||
when "prioritized"
|
when "prioritized"
|
||||||
answers = question.question_answers.visibles
|
answers = question.question_answers.visibles
|
||||||
.map { |a| Poll::Answer.where(question_id: a.question, answer: a.title).sum(:value) }
|
.map { |a| Poll::Answer.where(question_id: a.question, answer: a.title).sum(:value) }
|
||||||
is_most_voted = answers.none? {|a| a > total_votes_prioritized}
|
is_most_voted = answers.none? { |a| a > total_votes_prioritized }
|
||||||
update(most_voted: is_most_voted)
|
update(most_voted: is_most_voted)
|
||||||
else
|
else
|
||||||
for_only_votes
|
for_only_votes
|
||||||
@@ -97,8 +97,8 @@ class Poll::Question::Answer < ApplicationRecord
|
|||||||
|
|
||||||
def for_only_votes
|
def for_only_votes
|
||||||
answers = question.question_answers.visibles
|
answers = question.question_answers.visibles
|
||||||
.map {|a| Poll::Answer.where(question_id: a.question, answer: a.title).count}
|
.map { |a| Poll::Answer.where(question_id: a.question, answer: a.title).count }
|
||||||
is_most_voted = answers.none? {|a| a > total_votes}
|
is_most_voted = answers.none? { |a| a > total_votes }
|
||||||
update(most_voted: is_most_voted)
|
update(most_voted: is_most_voted)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class Poll::Recount < ApplicationRecord
|
|||||||
belongs_to :officer_assignment
|
belongs_to :officer_assignment
|
||||||
|
|
||||||
validates :author, presence: true
|
validates :author, presence: true
|
||||||
validates :origin, inclusion: {in: VALID_ORIGINS}
|
validates :origin, inclusion: { in: VALID_ORIGINS }
|
||||||
|
|
||||||
scope :web, -> { where(origin: "web") }
|
scope :web, -> { where(origin: "web") }
|
||||||
scope :booth, -> { where(origin: "booth") }
|
scope :booth, -> { where(origin: "booth") }
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class Proposal < ApplicationRecord
|
|||||||
scope :sort_by_recommendations, -> { order(cached_votes_up: :desc) }
|
scope :sort_by_recommendations, -> { order(cached_votes_up: :desc) }
|
||||||
scope :archived, -> { where("proposals.created_at <= ?", Setting["months_to_archive_proposals"].to_i.months.ago) }
|
scope :archived, -> { where("proposals.created_at <= ?", Setting["months_to_archive_proposals"].to_i.months.ago) }
|
||||||
scope :not_archived, -> { where("proposals.created_at > ?", Setting["months_to_archive_proposals"].to_i.months.ago) }
|
scope :not_archived, -> { where("proposals.created_at > ?", Setting["months_to_archive_proposals"].to_i.months.ago) }
|
||||||
scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)}
|
scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago) }
|
||||||
scope :retired, -> { where.not(retired_at: nil) }
|
scope :retired, -> { where.not(retired_at: nil) }
|
||||||
scope :not_retired, -> { where(retired_at: nil) }
|
scope :not_retired, -> { where(retired_at: nil) }
|
||||||
scope :successful, -> { where("cached_votes_up >= ?", Proposal.votes_needed_for_success) }
|
scope :successful, -> { where("cached_votes_up >= ?", Proposal.votes_needed_for_success) }
|
||||||
@@ -213,11 +213,11 @@ class Proposal < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def after_hide
|
def after_hide
|
||||||
tags.each{ |t| t.decrement_custom_counter_for("Proposal") }
|
tags.each { |t| t.decrement_custom_counter_for("Proposal") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_restore
|
def after_restore
|
||||||
tags.each{ |t| t.increment_custom_counter_for("Proposal") }
|
tags.each { |t| t.increment_custom_counter_for("Proposal") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.votes_needed_for_success
|
def self.votes_needed_for_success
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class SignatureSheet < ApplicationRecord
|
|||||||
has_many :signatures
|
has_many :signatures
|
||||||
|
|
||||||
validates :author, presence: true
|
validates :author, presence: true
|
||||||
validates :signable_type, inclusion: {in: VALID_SIGNABLES}
|
validates :signable_type, inclusion: { in: VALID_SIGNABLES }
|
||||||
validates :required_fields_to_verify, presence: true
|
validates :required_fields_to_verify, presence: true
|
||||||
validates :signable, presence: true
|
validates :signable, presence: true
|
||||||
validate :signable_found
|
validate :signable_found
|
||||||
@@ -35,7 +35,7 @@ class SignatureSheet < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def parsed_required_fields_to_verify_groups
|
def parsed_required_fields_to_verify_groups
|
||||||
required_fields_to_verify.split(/[;]/).collect {|d| d.gsub(/\s+/, "") }.map { |group| group.split(/[,]/)}
|
required_fields_to_verify.split(/[;]/).collect { |d| d.gsub(/\s+/, "") }.map { |group| group.split(/[,]/) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def signable_found
|
def signable_found
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class TagCloud
|
|||||||
end
|
end
|
||||||
|
|
||||||
def geozone_names
|
def geozone_names
|
||||||
Geozone.all.map {|geozone| geozone.name.downcase }
|
Geozone.all.map { |geozone| geozone.name.downcase }
|
||||||
end
|
end
|
||||||
|
|
||||||
def resource_model_scoped
|
def resource_model_scoped
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class User < ApplicationRecord
|
|||||||
|
|
||||||
validate :validate_username_length
|
validate :validate_username_length
|
||||||
|
|
||||||
validates :official_level, inclusion: {in: 0..5}
|
validates :official_level, inclusion: { in: 0..5 }
|
||||||
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
|
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
|
||||||
|
|
||||||
validates_associated :organization, message: false
|
validates_associated :organization, message: false
|
||||||
@@ -128,7 +128,7 @@ class User < ApplicationRecord
|
|||||||
|
|
||||||
def comment_flags(comments)
|
def comment_flags(comments)
|
||||||
comment_flags = flags.for_comments(comments)
|
comment_flags = flags.for_comments(comments)
|
||||||
comment_flags.each_with_object({}){ |f, h| h[f.flaggable_id] = true }
|
comment_flags.each_with_object({}) { |f, h| h[f.flaggable_id] = true }
|
||||||
end
|
end
|
||||||
|
|
||||||
def voted_in_group?(group)
|
def voted_in_group?(group)
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ class VotationType < ApplicationRecord
|
|||||||
variables: [:max_votes, :max_groups_answers] },
|
variables: [:max_votes, :max_groups_answers] },
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
enum enum_type: ENUM_TYPES_PROPS.map{ |k,v| [k, v[:enum_type]] }.to_h.freeze
|
enum enum_type: ENUM_TYPES_PROPS.map { |k, v| [k, v[:enum_type]] }.to_h.freeze
|
||||||
|
|
||||||
enum prioritization_type: {borda: 1, dowdall: 2}.freeze
|
enum prioritization_type: { borda: 1, dowdall: 2 }.freeze
|
||||||
|
|
||||||
validates :questionable, presence: true
|
validates :questionable, presence: true
|
||||||
validates :questionable_type, inclusion: {in: QUESTIONABLE_TYPES}
|
validates :questionable_type, inclusion: { in: QUESTIONABLE_TYPES }
|
||||||
validates_presence_of :max_votes, allow_blank: false,
|
validates_presence_of :max_votes, allow_blank: false,
|
||||||
if: :max_votes_required?
|
if: :max_votes_required?
|
||||||
validates_presence_of :max_groups_answers, allow_blank: false,
|
validates_presence_of :max_groups_answers, allow_blank: false,
|
||||||
@@ -49,7 +49,7 @@ class VotationType < ApplicationRecord
|
|||||||
prioritized
|
prioritized
|
||||||
end
|
end
|
||||||
|
|
||||||
def answer (user, answer, options = {})
|
def answer(user, answer, options = {})
|
||||||
result = nil
|
result = nil
|
||||||
votes = questionable.answers
|
votes = questionable.answers
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ class VotationType < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.build_by_type(questionable, params)
|
def self.build_by_type(questionable, params)
|
||||||
attributes = {questionable: questionable}
|
attributes = { questionable: questionable }
|
||||||
enum_type = self.enum_types.key(params[:enum_type].to_i)
|
enum_type = self.enum_types.key(params[:enum_type].to_i)
|
||||||
enum_type_props = enum_properties(enum_type)
|
enum_type_props = enum_properties(enum_type)
|
||||||
attributes.merge!(enum_type_props.except(:variables))
|
attributes.merge!(enum_type_props.except(:variables))
|
||||||
@@ -155,7 +155,7 @@ class VotationType < ApplicationRecord
|
|||||||
end
|
end
|
||||||
when "dowdall"
|
when "dowdall"
|
||||||
questionable.answers.by_author(user).order(:order).each_with_index do |answer, i|
|
questionable.answers.by_author(user).order(:order).each_with_index do |answer, i|
|
||||||
value = 60/(i + 1)
|
value = 60 / (i + 1)
|
||||||
!answer.update(value: value)
|
!answer.update(value: value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,14 +32,14 @@
|
|||||||
<div class="small-12 medium-6 column">
|
<div class="small-12 medium-6 column">
|
||||||
<%= translations_form.text_field :title,
|
<%= translations_form.text_field :title,
|
||||||
placeholder: t("admin.banners.banner.title"),
|
placeholder: t("admin.banners.banner.title"),
|
||||||
data: {js_banner_title: "js_banner_title"},
|
data: { js_banner_title: "js_banner_title" },
|
||||||
label: t("admin.banners.banner.title") %>
|
label: t("admin.banners.banner.title") %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
<%= translations_form.text_field :description,
|
<%= translations_form.text_field :description,
|
||||||
placeholder: t("admin.banners.banner.description"),
|
placeholder: t("admin.banners.banner.description"),
|
||||||
data: {js_banner_description: "js_banner_description"},
|
data: { js_banner_description: "js_banner_description" },
|
||||||
label: t("admin.banners.banner.description") %>
|
label: t("admin.banners.banner.description") %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
label: false,
|
label: false,
|
||||||
maxlength: 8,
|
maxlength: 8,
|
||||||
placeholder: t("admin.budget_headings.form.population"),
|
placeholder: t("admin.budget_headings.form.population"),
|
||||||
data: {toggle_focus: "population-info"},
|
data: { toggle_focus: "population-info" },
|
||||||
aria: {describedby: "budgets-population-help-text"} %>
|
aria: { describedby: "budgets-population-help-text" } %>
|
||||||
|
|
||||||
<%= f.text_field :latitude,
|
<%= f.text_field :latitude,
|
||||||
label: t("admin.budget_headings.form.latitude"),
|
label: t("admin.budget_headings.form.latitude"),
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<%= form_tag(admin_budget_budget_investments_path(budget: @budget), method: :get, enforce_utf8: false) do %>
|
<%= form_tag(admin_budget_budget_investments_path(budget: @budget), method: :get, enforce_utf8: false) do %>
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
<%= link_to "#advanced_filters_content",
|
<%= link_to "#advanced_filters_content",
|
||||||
data: {toggle: "advanced_filters"},
|
data: { toggle: "advanced_filters" },
|
||||||
class: "advanced-filters float-right clear" do %>
|
class: "advanced-filters float-right clear" do %>
|
||||||
<%= t("admin.budget_investments.index.advanced_filters") %>
|
<%= t("admin.budget_investments.index.advanced_filters") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -36,32 +36,32 @@
|
|||||||
<%= select_tag :administrator_id,
|
<%= select_tag :administrator_id,
|
||||||
options_for_select(admin_select_options, params[:administrator_id]),
|
options_for_select(admin_select_options, params[:administrator_id]),
|
||||||
{ prompt: t("admin.budget_investments.index.administrator_filter_all"),
|
{ prompt: t("admin.budget_investments.index.administrator_filter_all"),
|
||||||
label: false} %>
|
label: false } %>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-12 medium-3 column">
|
<div class="small-12 medium-3 column">
|
||||||
<%= select_tag :valuator_or_group_id,
|
<%= select_tag :valuator_or_group_id,
|
||||||
options_for_select(valuator_or_group_select_options, params[:valuator_or_group_id]),
|
options_for_select(valuator_or_group_select_options, params[:valuator_or_group_id]),
|
||||||
{ prompt: t("admin.budget_investments.index.valuator_filter_all"),
|
{ prompt: t("admin.budget_investments.index.valuator_filter_all"),
|
||||||
label: false} %>
|
label: false } %>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-12 medium-3 column">
|
<div class="small-12 medium-3 column">
|
||||||
<%= select_tag :heading_id,
|
<%= select_tag :heading_id,
|
||||||
options_for_select(budget_heading_select_options(@budget), params[:heading_id]),
|
options_for_select(budget_heading_select_options(@budget), params[:heading_id]),
|
||||||
{ prompt: t("admin.budget_investments.index.heading_filter_all"),
|
{ prompt: t("admin.budget_investments.index.heading_filter_all"),
|
||||||
label: false} %>
|
label: false } %>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-12 medium-3 column">
|
<div class="small-12 medium-3 column">
|
||||||
<%= select_tag :tag_name,
|
<%= select_tag :tag_name,
|
||||||
options_for_select(investment_tags_select_options(@budget), params[:tag_name]),
|
options_for_select(investment_tags_select_options(@budget), params[:tag_name]),
|
||||||
{ prompt: t("admin.budget_investments.index.tags_filter_all"),
|
{ prompt: t("admin.budget_investments.index.tags_filter_all"),
|
||||||
label: false} %>
|
label: false } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 medium-3 column">
|
<div class="small-12 medium-3 column">
|
||||||
<%= select_tag :milestone_tag_name,
|
<%= select_tag :milestone_tag_name,
|
||||||
options_for_select(investment_milestone_tags_select_options(@budget), params[:milestone_tag_name]),
|
options_for_select(investment_milestone_tags_select_options(@budget), params[:milestone_tag_name]),
|
||||||
{ prompt: t("admin.budget_investments.index.milestone_tags_filter_all"),
|
{ prompt: t("admin.budget_investments.index.milestone_tags_filter_all"),
|
||||||
label: false} %>
|
label: false } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 medium-6 column">
|
<div class="small-12 medium-6 column">
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="small text-center" data-field="valuation_finished">
|
<td class="small text-center" data-field="valuation_finished">
|
||||||
<%= investment.valuation_finished? ? t("shared.yes"): t("shared.no") %>
|
<%= investment.valuation_finished? ? t("shared.yes") : t("shared.no") %>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="small text-center" data-field="visible_to_valuators">
|
<td class="small text-center" data-field="visible_to_valuators">
|
||||||
@@ -94,6 +94,6 @@
|
|||||||
|
|
||||||
<% if params[:advanced_filters]&.include?("selected") %>
|
<% if params[:advanced_filters]&.include?("selected") %>
|
||||||
<td class="small text-center" data-field="incompatible">
|
<td class="small text-center" data-field="incompatible">
|
||||||
<%= investment.incompatible? ? t("shared.yes"): t("shared.no") %>
|
<%= investment.incompatible? ? t("shared.yes") : t("shared.no") %>
|
||||||
</td>
|
</td>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
<div class="small-12 medium-6">
|
<div class="small-12 medium-6">
|
||||||
<%= f.select(:administrator_id,
|
<%= f.select(:administrator_id,
|
||||||
@admins.collect{ |a| [a.description_or_name_and_email, a.id ] },
|
@admins.collect { |a| [a.description_or_name_and_email, a.id] },
|
||||||
{ include_blank: t("admin.budget_investments.edit.undefined") }) %>
|
{ include_blank: t("admin.budget_investments.edit.undefined") }) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<%= link_to admin_budget_budget_investments_path(Budget::Investment.filter_params(params).to_h),
|
<%= link_to admin_budget_budget_investments_path(Budget::Investment.filter_params(params).to_h),
|
||||||
class: "back", data: {no_turbolink: true} do %>
|
class: "back", data: { no_turbolink: true } do %>
|
||||||
<span class="icon-angle-left"></span><%= t("shared.back") %>
|
<span class="icon-angle-left"></span><%= t("shared.back") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
<p>
|
<p>
|
||||||
<%= link_to t("admin.budget_investments.show.edit_classification"),
|
<%= link_to t("admin.budget_investments.show.edit_classification"),
|
||||||
edit_admin_budget_budget_investment_path(@budget, @investment,
|
edit_admin_budget_budget_investment_path(@budget, @investment,
|
||||||
{anchor: "classification"}.merge(Budget::Investment.filter_params(params).to_h)) unless @budget.finished? %>
|
{ anchor: "classification" }.merge(Budget::Investment.filter_params(params).to_h)) unless @budget.finished? %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<% ::Dashboard::Action.action_types.keys.each do |action_type_value| %>
|
<% ::Dashboard::Action.action_types.keys.each do |action_type_value| %>
|
||||||
<span class="margin-right">
|
<span class="margin-right">
|
||||||
<%= f.radio_button :action_type, action_type_value, label: false,
|
<%= f.radio_button :action_type, action_type_value, label: false,
|
||||||
data: {toggle: "request_to_administrators short_description"} %>
|
data: { toggle: "request_to_administrators short_description" } %>
|
||||||
<%= f.label "action_type_#{action_type_value}", t("admin.dashboard.actions.action_type.#{action_type_value}") %>
|
<%= f.label "action_type_#{action_type_value}", t("admin.dashboard.actions.action_type.#{action_type_value}") %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -36,4 +36,4 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<%= paginate [@debates, @comments].sort_by {|x| x.size}.last %>
|
<%= paginate [@debates, @comments].sort_by { |x| x.size }.last %>
|
||||||
|
|||||||
@@ -6,6 +6,6 @@
|
|||||||
|
|
||||||
<%= f.submit(t("admin.settings.index.features.#{setting.enabled? ? "disable" : "enable"}"),
|
<%= f.submit(t("admin.settings.index.features.#{setting.enabled? ? "disable" : "enable"}"),
|
||||||
class: "button #{setting.enabled? ? "hollow alert" : "success"}",
|
class: "button #{setting.enabled? ? "hollow alert" : "success"}",
|
||||||
data: {confirm: t("admin.actions.confirm")}) %>
|
data: { confirm: t("admin.actions.confirm") }) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<%= render "shared/globalize_locales", resource: @draft_version %>
|
<%= render "shared/globalize_locales", resource: @draft_version %>
|
||||||
|
|
||||||
<%= translatable_form_for [:admin, @process, @draft_version], url: url, html: {data: {watch_changes: true}} do |f| %>
|
<%= translatable_form_for [:admin, @process, @draft_version], url: url, html: { data: { watch_changes: true }} do |f| %>
|
||||||
|
|
||||||
<% if @draft_version.errors.any? %>
|
<% if @draft_version.errors.any? %>
|
||||||
<div id="error_explanation" data-alert class="callout alert" data-closable>
|
<div id="error_explanation" data-alert class="callout alert" data-closable>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<div class="markdown-editor-header truncate">
|
<div class="markdown-editor-header truncate">
|
||||||
<%= t("admin.legislation.draft_versions.form.title_html",
|
<%= t("admin.legislation.draft_versions.form.title_html",
|
||||||
draft_version_title: @draft_version.title,
|
draft_version_title: @draft_version.title,
|
||||||
process_title: @process.title ) %>
|
process_title: @process.title) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="markdown-editor-buttons">
|
<div class="markdown-editor-buttons">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
display_style: lambda { |locale| enable_translation_style(@process, locale) },
|
display_style: lambda { |locale| enable_translation_style(@process, locale) },
|
||||||
manage_languages: false %>
|
manage_languages: false %>
|
||||||
|
|
||||||
<%= translatable_form_for [:admin, @process], url: url, html: {data: {watch_changes: true}} do |f| %>
|
<%= translatable_form_for [:admin, @process], url: url, html: { data: { watch_changes: true } } do |f| %>
|
||||||
|
|
||||||
<%= render "shared/errors", resource: @process %>
|
<%= render "shared/errors", resource: @process %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<%= render "shared/globalize_locales", resource: @process %>
|
<%= render "shared/globalize_locales", resource: @process %>
|
||||||
|
|
||||||
<%= translatable_form_for [:admin, @process], html: {data: {watch_changes: true}} do |f| %>
|
<%= translatable_form_for [:admin, @process], html: { data: { watch_changes: true } } do |f| %>
|
||||||
|
|
||||||
<% if @process.errors.any? %>
|
<% if @process.errors.any? %>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<%= form_for [:admin, @process], html: {data: {watch_changes: true}} do |f| %>
|
<%= form_for [:admin, @process], html: { data: { watch_changes: true } } do |f| %>
|
||||||
|
|
||||||
<% if @process.errors.any? %>
|
<% if @process.errors.any? %>
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
label: false,
|
label: false,
|
||||||
placeholder: t("admin.legislation.proposals.form.custom_categories_placeholder"),
|
placeholder: t("admin.legislation.proposals.form.custom_categories_placeholder"),
|
||||||
class: "js-tag-list",
|
class: "js-tag-list",
|
||||||
aria: {describedby: "tag-list-help-text"} %>
|
aria: { describedby: "tag-list-help-text" } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 medium-3 column clear end">
|
<div class="small-12 medium-3 column clear end">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<%= render "shared/globalize_locales", resource: @question %>
|
<%= render "shared/globalize_locales", resource: @question %>
|
||||||
|
|
||||||
<%= translatable_form_for [:admin, @process, @question], url: url, html: {data: {watch_changes: true}} do |f| %>
|
<%= translatable_form_for [:admin, @process, @question], url: url, html: { data: { watch_changes: true } } do |f| %>
|
||||||
|
|
||||||
<% if @question.errors.any? %>
|
<% if @question.errors.any? %>
|
||||||
<div class="small-12 medium-9 column">
|
<div class="small-12 medium-9 column">
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
remote: true,
|
remote: true,
|
||||||
title: t("admin.booth_assignments.manage.actions.unassign"),
|
title: t("admin.booth_assignments.manage.actions.unassign"),
|
||||||
class: "button hollow alert expanded",
|
class: "button hollow alert expanded",
|
||||||
data: (booth_assignment.shifts? ? {confirm: "#{t("admin.poll_booth_assignments.alert.shifts")}"} : nil) if !@poll.expired? %>
|
data: (booth_assignment.shifts? ? { confirm: "#{t("admin.poll_booth_assignments.alert.shifts")}" } : nil) if !@poll.expired? %>
|
||||||
</td>
|
</td>
|
||||||
<% else %>
|
<% else %>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
method: :delete,
|
method: :delete,
|
||||||
class: "button hollow alert expanded" %>
|
class: "button hollow alert expanded" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to t("admin.poll_officers.officer.add"),{ controller: "admin/poll/officers", action: :create, user_id: officer.user_id },
|
<%= link_to t("admin.poll_officers.officer.add"), { controller: "admin/poll/officers", action: :create, user_id: officer.user_id },
|
||||||
method: :post,
|
method: :post,
|
||||||
class: "button success expanded" %>
|
class: "button success expanded" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<%= fields_for :votation_type do |votation_f| %>
|
<%= fields_for :votation_type do |votation_f| %>
|
||||||
<div class="small-12 medium-6">
|
<div class="small-12 medium-6">
|
||||||
<%= votation_f.select :enum_type,
|
<%= votation_f.select :enum_type,
|
||||||
options_for_select(VotationType.enum_types.map {|k, v| [t(k, scope: :enum_type), v]},
|
options_for_select(VotationType.enum_types.map { |k, v| [t(k, scope: :enum_type), v] },
|
||||||
params.dig(:votation_type, :enum_type)), default: 0,
|
params.dig(:votation_type, :enum_type)), default: 0,
|
||||||
disabled: @question.persisted?, label: t("enum_type.title") %>
|
disabled: @question.persisted?, label: t("enum_type.title") %>
|
||||||
</div>
|
</div>
|
||||||
@@ -53,8 +53,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="small-12 medium-6 js-prioritization_type hidden">
|
<div class="small-12 medium-6 js-prioritization_type hidden">
|
||||||
<%= votation_f.select :prioritization_type,
|
<%= votation_f.select :prioritization_type,
|
||||||
options_for_select(VotationType.prioritization_types.map {|k, v| [t(k, scope: :prioritization_type), v]},
|
options_for_select(VotationType.prioritization_types.map { |k, v| [t(k, scope: :prioritization_type), v] },
|
||||||
params.dig(:votation_type, :prioritization_type) ), default: 0,
|
params.dig(:votation_type, :prioritization_type)), default: 0,
|
||||||
disabled: @question.persisted?, label: t("prioritization_type.title") %>
|
disabled: @question.persisted?, label: t("prioritization_type.title") %>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-12 medium-6 js-max_group_votes hidden">
|
<div class="small-12 medium-6 js-max_group_votes hidden">
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @poll.booth_assignments.sort_by {|ba| ba.booth.name }.each do |booth_assignment| %>
|
<% @poll.booth_assignments.sort_by { |ba| ba.booth.name }.each do |booth_assignment| %>
|
||||||
<tr id="booth_assignment_<%= booth_assignment.id %>_result">
|
<tr id="booth_assignment_<%= booth_assignment.id %>_result">
|
||||||
<td><%= booth_assignment.booth.name %></td>
|
<td><%= booth_assignment.booth.name %></td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<div class="small-12 medium-3 column">
|
<div class="small-12 medium-3 column">
|
||||||
<label><%= t("admin.poll_shifts.new.task") %></label>
|
<label><%= t("admin.poll_shifts.new.task") %></label>
|
||||||
<%= f.select :task,
|
<%= f.select :task,
|
||||||
Poll::Shift.tasks.map {|k,v| [t("admin.poll_shifts.#{k}"), k]},
|
Poll::Shift.tasks.map { |k, v| [t("admin.poll_shifts.#{k}"), k] },
|
||||||
{ prompt: t("admin.poll_shifts.new.select_task"),
|
{ prompt: t("admin.poll_shifts.new.select_task"),
|
||||||
label: false },
|
label: false },
|
||||||
class: "js-poll-shifts" %>
|
class: "js-poll-shifts" %>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<%= form_for(feature, url: admin_setting_path(feature), html: { id: "edit_#{dom_id(feature)}"}) do |f| %>
|
<%= form_for(feature, url: admin_setting_path(feature), html: { id: "edit_#{dom_id(feature)}" }) do |f| %>
|
||||||
<%= f.hidden_field :tab, value: tab if defined?(tab) %>
|
<%= f.hidden_field :tab, value: tab if defined?(tab) %>
|
||||||
<%= f.hidden_field :value, id: dom_id(feature), value: (feature.enabled? ? "" : "active") %>
|
<%= f.hidden_field :value, id: dom_id(feature), value: (feature.enabled? ? "" : "active") %>
|
||||||
<%= f.submit(t("admin.settings.index.features.#{feature.enabled? ? "disable" : "enable"}"),
|
<%= f.submit(t("admin.settings.index.features.#{feature.enabled? ? "disable" : "enable"}"),
|
||||||
class: "button expanded #{feature.enabled? ? "hollow alert" : "success"}",
|
class: "button expanded #{feature.enabled? ? "hollow alert" : "success"}",
|
||||||
data: {confirm: t("admin.actions.confirm")}) %>
|
data: { confirm: t("admin.actions.confirm") }) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
|
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}" }) do |f| %>
|
||||||
<%= f.hidden_field :tab, value: tab if defined?(tab) %>
|
<%= f.hidden_field :tab, value: tab if defined?(tab) %>
|
||||||
<div class="small-12 medium-6 large-8 column">
|
<div class="small-12 medium-6 large-8 column">
|
||||||
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
|
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<%= f.label :required_fields_to_verify %>
|
<%= f.label :required_fields_to_verify %>
|
||||||
<p class="help-text" id="required-fields-to-verify-help-text"><%= required_fields_to_verify_text_help %></p>
|
<p class="help-text" id="required-fields-to-verify-help-text"><%= required_fields_to_verify_text_help %></p>
|
||||||
<p class="help-text"> <%= example_text_help %></p>
|
<p class="help-text"> <%= example_text_help %></p>
|
||||||
<%= f.text_area :required_fields_to_verify, rows: "6", label: false, aria: {describedby: "required-fields-to-verify-help-text"} %>
|
<%= f.text_area :required_fields_to_verify, rows: "6", label: false, aria: { describedby: "required-fields-to-verify-help-text" } %>
|
||||||
|
|
||||||
<%= f.submit(class: "button", value: t("admin.signature_sheets.new.submit")) %>
|
<%= f.submit(class: "button", value: t("admin.signature_sheets.new.submit")) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user