Fix line lenght offenses at multiple controllers
This commit is contained in:
@@ -22,13 +22,15 @@ class AccountController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def account_params
|
def account_params
|
||||||
if @account.organization?
|
attributes = if @account.organization?
|
||||||
params.require(:account).permit(:phone_number, :email_on_comment, :email_on_comment_reply, :newsletter,
|
[:phone_number, :email_on_comment, :email_on_comment_reply, :newsletter,
|
||||||
organization_attributes: [:name, :responsible_name])
|
organization_attributes: [:name, :responsible_name]]
|
||||||
else
|
else
|
||||||
params.require(:account).permit(:username, :public_activity, :public_interests, :email_on_comment, :email_on_comment_reply,
|
[:username, :public_activity, :public_interests, :email_on_comment,
|
||||||
:email_on_direct_message, :email_digest, :newsletter, :official_position_badge)
|
:email_on_comment_reply, :email_on_direct_message, :email_digest, :newsletter,
|
||||||
end
|
:official_position_badge]
|
||||||
|
end
|
||||||
|
params.require(:account).permit(*attributes)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ class Admin::ActivityController < Admin::BaseController
|
|||||||
has_filters %w{all on_users on_proposals on_debates on_comments}
|
has_filters %w{all on_users on_proposals on_debates on_comments}
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@activity = Activity.for_render.send(@current_filter).order(created_at: :desc).page(params[:page])
|
@activity = Activity.for_render.send(@current_filter)
|
||||||
|
.order(created_at: :desc).page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -38,15 +38,21 @@ class Admin::BannersController < Admin::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def banner_params
|
def banner_params
|
||||||
params.require(:banner).permit(:title, :description, :target_url, :style, :image, :post_started_at, :post_ended_at)
|
attributes = [:title, :description, :target_url, :style, :image,
|
||||||
|
:post_started_at, :post_ended_at]
|
||||||
|
params.require(:banner).permit(*attributes)
|
||||||
end
|
end
|
||||||
|
|
||||||
def banner_styles
|
def banner_styles
|
||||||
@banner_styles = Setting.all.banner_style.map { |banner_style| [banner_style.value, banner_style.key.split('.')[1]] }
|
@banner_styles = Setting.all.banner_style.map do |banner_style|
|
||||||
|
[banner_style.value, banner_style.key.split('.')[1]]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def banner_imgs
|
def banner_imgs
|
||||||
@banner_imgs = Setting.all.banner_img.map { |banner_img| [banner_img.value, banner_img.key.split('.')[1]] }
|
@banner_imgs = Setting.all.banner_img.map do |banner_img|
|
||||||
|
[banner_img.value, banner_img.key.split('.')[1]]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -42,10 +42,11 @@ class Admin::BudgetInvestmentMilestonesController < Admin::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def milestone_params
|
def milestone_params
|
||||||
params.require(:budget_investment_milestone)
|
image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||||
.permit(:title, :description, :publication_date, :budget_investment_id,
|
documents_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||||
image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy],
|
attributes = [:title, :description, :publication_date, :budget_investment_id,
|
||||||
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy])
|
image_attributes: image_attributes, documents_attributes: documents_attributes]
|
||||||
|
params.require(:budget_investment_milestone).permit(*attributes)
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_budget_investment
|
def load_budget_investment
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ class Admin::BudgetPhasesController < Admin::BaseController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
if @phase.update(budget_phase_params)
|
if @phase.update(budget_phase_params)
|
||||||
redirect_to edit_admin_budget_path(@phase.budget), notice: t("flash.actions.save_changes.notice")
|
notice = t("flash.actions.save_changes.notice")
|
||||||
|
redirect_to edit_admin_budget_path(@phase.budget), notice: notice
|
||||||
else
|
else
|
||||||
render :edit
|
render :edit
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ class Admin::Legislation::DraftVersionsController < Admin::Legislation::BaseCont
|
|||||||
def create
|
def create
|
||||||
if @draft_version.save
|
if @draft_version.save
|
||||||
link = legislation_process_draft_version_path(@process, @draft_version).html_safe
|
link = legislation_process_draft_version_path(@process, @draft_version).html_safe
|
||||||
redirect_to admin_legislation_process_draft_versions_path, notice: t('admin.legislation.draft_versions.create.notice', link: link)
|
notice = t('admin.legislation.draft_versions.create.notice', link: link)
|
||||||
|
redirect_to admin_legislation_process_draft_versions_path, notice: notice
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.legislation.draft_versions.create.error')
|
flash.now[:error] = t('admin.legislation.draft_versions.create.error')
|
||||||
render :new
|
render :new
|
||||||
@@ -20,7 +21,8 @@ class Admin::Legislation::DraftVersionsController < Admin::Legislation::BaseCont
|
|||||||
if @draft_version.update(draft_version_params)
|
if @draft_version.update(draft_version_params)
|
||||||
link = legislation_process_draft_version_path(@process, @draft_version).html_safe
|
link = legislation_process_draft_version_path(@process, @draft_version).html_safe
|
||||||
notice = t('admin.legislation.draft_versions.update.notice', link: link)
|
notice = t('admin.legislation.draft_versions.update.notice', link: link)
|
||||||
redirect_to edit_admin_legislation_process_draft_version_path(@process, @draft_version), notice: notice
|
edit_path = edit_admin_legislation_process_draft_version_path(@process, @draft_version)
|
||||||
|
redirect_to edit_path, notice: notice
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.legislation.draft_versions.update.error')
|
flash.now[:error] = t('admin.legislation.draft_versions.update.error')
|
||||||
render :edit
|
render :edit
|
||||||
@@ -29,7 +31,8 @@ class Admin::Legislation::DraftVersionsController < Admin::Legislation::BaseCont
|
|||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@draft_version.destroy
|
@draft_version.destroy
|
||||||
redirect_to admin_legislation_process_draft_versions_path, notice: t('admin.legislation.draft_versions.destroy.notice')
|
notice = t('admin.legislation.draft_versions.destroy.notice')
|
||||||
|
redirect_to admin_legislation_process_draft_versions_path, notice: notice
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
|
|||||||
def create
|
def create
|
||||||
if @process.save
|
if @process.save
|
||||||
link = legislation_process_path(@process).html_safe
|
link = legislation_process_path(@process).html_safe
|
||||||
redirect_to edit_admin_legislation_process_path(@process), notice: t('admin.legislation.processes.create.notice', link: link)
|
notice = t('admin.legislation.processes.create.notice', link: link)
|
||||||
|
redirect_to edit_admin_legislation_process_path(@process), notice: notice
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.legislation.processes.create.error')
|
flash.now[:error] = t('admin.legislation.processes.create.error')
|
||||||
render :new
|
render :new
|
||||||
@@ -31,7 +32,8 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
|
|||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@process.destroy
|
@process.destroy
|
||||||
redirect_to admin_legislation_processes_path, notice: t('admin.legislation.processes.destroy.notice')
|
notice = t('admin.legislation.processes.destroy.notice')
|
||||||
|
redirect_to admin_legislation_processes_path, notice: notice
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class Admin::Legislation::QuestionsController < Admin::Legislation::BaseControll
|
|||||||
def create
|
def create
|
||||||
@question.author = current_user
|
@question.author = current_user
|
||||||
if @question.save
|
if @question.save
|
||||||
notice = t('admin.legislation.questions.create.notice', link: legislation_process_question_path(@process, @question).html_safe)
|
notice = t('admin.legislation.questions.create.notice', link: question_path)
|
||||||
redirect_to admin_legislation_process_questions_path, notice: notice
|
redirect_to admin_legislation_process_questions_path, notice: notice
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.legislation.questions.create.error')
|
flash.now[:error] = t('admin.legislation.questions.create.error')
|
||||||
@@ -23,7 +23,7 @@ class Admin::Legislation::QuestionsController < Admin::Legislation::BaseControll
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
if @question.update(question_params)
|
if @question.update(question_params)
|
||||||
notice = t('admin.legislation.questions.update.notice', link: legislation_process_question_path(@process, @question).html_safe)
|
notice = t('admin.legislation.questions.update.notice', link: question_path)
|
||||||
redirect_to edit_admin_legislation_process_question_path(@process, @question), notice: notice
|
redirect_to edit_admin_legislation_process_question_path(@process, @question), notice: notice
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.legislation.questions.update.error')
|
flash.now[:error] = t('admin.legislation.questions.update.error')
|
||||||
@@ -33,11 +33,16 @@ class Admin::Legislation::QuestionsController < Admin::Legislation::BaseControll
|
|||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@question.destroy
|
@question.destroy
|
||||||
redirect_to admin_legislation_process_questions_path, notice: t('admin.legislation.questions.destroy.notice')
|
notice = t('admin.legislation.questions.destroy.notice')
|
||||||
|
redirect_to admin_legislation_process_questions_path, notice: notice
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def question_path
|
||||||
|
legislation_process_question_path(@process, @question).html_safe
|
||||||
|
end
|
||||||
|
|
||||||
def question_params
|
def question_params
|
||||||
params.require(:legislation_question).permit(
|
params.require(:legislation_question).permit(
|
||||||
:title,
|
:title,
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
|
|||||||
before_action :load_poll, except: [:create, :destroy]
|
before_action :load_poll, except: [:create, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@booth_assignments = @poll.booth_assignments.includes(:booth).order('poll_booths.name').page(params[:page]).per(50)
|
@booth_assignments = @poll.booth_assignments.includes(:booth).order('poll_booths.name')
|
||||||
|
.page(params[:page]).per(50)
|
||||||
end
|
end
|
||||||
|
|
||||||
def search_booths
|
def search_booths
|
||||||
@@ -15,8 +16,8 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@booth_assignment = @poll.booth_assignments.includes(:recounts, :voters,
|
included_relations = [:recounts, :voters, officer_assignments: [officer: [:user]]]
|
||||||
officer_assignments: [officer: [:user]]).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
|
||||||
|
|||||||
Reference in New Issue
Block a user