Fix all rubocop Metrics/LineLength issues (140+)
This commit is contained in:
@@ -8,7 +8,8 @@ class Admin::Legislation::DraftVersionsController < Admin::Legislation::BaseCont
|
||||
|
||||
def create
|
||||
if @draft_version.save
|
||||
redirect_to admin_legislation_process_draft_versions_path, notice: t('admin.legislation.draft_versions.create.notice', 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)
|
||||
else
|
||||
flash.now[:error] = t('admin.legislation.draft_versions.create.error')
|
||||
render :new
|
||||
@@ -17,7 +18,9 @@ class Admin::Legislation::DraftVersionsController < Admin::Legislation::BaseCont
|
||||
|
||||
def update
|
||||
if @draft_version.update(draft_version_params)
|
||||
redirect_to edit_admin_legislation_process_draft_version_path(@process, @draft_version), notice: t('admin.legislation.draft_versions.update.notice', 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)
|
||||
redirect_to edit_admin_legislation_process_draft_version_path(@process, @draft_version), notice: notice
|
||||
else
|
||||
flash.now[:error] = t('admin.legislation.draft_versions.update.error')
|
||||
render :edit
|
||||
|
||||
@@ -9,7 +9,8 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
|
||||
|
||||
def create
|
||||
if @process.save
|
||||
redirect_to edit_admin_legislation_process_path(@process), notice: t('admin.legislation.processes.create.notice', 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)
|
||||
else
|
||||
flash.now[:error] = t('admin.legislation.processes.create.error')
|
||||
render :new
|
||||
@@ -18,7 +19,8 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
|
||||
|
||||
def update
|
||||
if @process.update(process_params)
|
||||
redirect_to edit_admin_legislation_process_path(@process), notice: t('admin.legislation.processes.update.notice', 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.update.notice', link: link)
|
||||
else
|
||||
flash.now[:error] = t('admin.legislation.processes.update.error')
|
||||
render :edit
|
||||
|
||||
@@ -13,7 +13,8 @@ class Admin::Legislation::QuestionsController < Admin::Legislation::BaseControll
|
||||
def create
|
||||
@question.author = current_user
|
||||
if @question.save
|
||||
redirect_to admin_legislation_process_questions_path, notice: t('admin.legislation.questions.create.notice', link: legislation_process_question_path(@process, @question).html_safe)
|
||||
notice = t('admin.legislation.questions.create.notice', link: legislation_process_question_path(@process, @question).html_safe)
|
||||
redirect_to admin_legislation_process_questions_path, notice: notice
|
||||
else
|
||||
flash.now[:error] = t('admin.legislation.questions.create.error')
|
||||
render :new
|
||||
@@ -22,7 +23,8 @@ class Admin::Legislation::QuestionsController < Admin::Legislation::BaseControll
|
||||
|
||||
def update
|
||||
if @question.update(question_params)
|
||||
redirect_to edit_admin_legislation_process_question_path(@process, @question), notice: t('admin.legislation.questions.update.notice', link: legislation_process_question_path(@process, @question).html_safe)
|
||||
notice = t('admin.legislation.questions.update.notice', link: legislation_process_question_path(@process, @question).html_safe)
|
||||
redirect_to edit_admin_legislation_process_question_path(@process, @question), notice: notice
|
||||
else
|
||||
flash.now[:error] = t('admin.legislation.questions.update.error')
|
||||
render :edit
|
||||
|
||||
@@ -15,12 +15,14 @@ class Admin::Poll::BoothAssignmentsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def show
|
||||
@booth_assignment = @poll.booth_assignments.includes(:recounts, :final_recounts, :voters, officer_assignments: [officer: [:user]]).find(params[:id])
|
||||
@booth_assignment = @poll.booth_assignments.includes(:recounts, :final_recounts, :voters,
|
||||
officer_assignments: [officer: [:user]]).find(params[:id])
|
||||
@voters_by_date = @booth_assignment.voters.group_by {|v| v.created_at.to_date}
|
||||
end
|
||||
|
||||
def create
|
||||
@booth_assignment = ::Poll::BoothAssignment.new(poll_id: booth_assignment_params[:poll_id], booth_id: booth_assignment_params[:booth_id])
|
||||
@booth_assignment = ::Poll::BoothAssignment.new(poll_id: booth_assignment_params[:poll_id],
|
||||
booth_id: booth_assignment_params[:booth_id])
|
||||
|
||||
if @booth_assignment.save
|
||||
notice = t("admin.poll_booth_assignments.flash.create")
|
||||
@@ -63,4 +65,4 @@ class Admin::Poll::BoothAssignmentsController < Admin::BaseController
|
||||
@search = search_params[:search]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,7 +43,9 @@ class Admin::Poll::OfficerAssignmentsController < Admin::BaseController
|
||||
else
|
||||
notice = t("admin.poll_officer_assignments.flash.error_create")
|
||||
end
|
||||
redirect_to by_officer_admin_poll_officer_assignments_path(poll_id: create_params[:poll_id], officer_id: create_params[:officer_id]), notice: notice
|
||||
|
||||
redirect_params = { poll_id: create_params[:poll_id], officer_id: create_params[:officer_id] }
|
||||
redirect_to by_officer_admin_poll_officer_assignments_path(redirect_params), notice: notice
|
||||
end
|
||||
|
||||
def destroy
|
||||
@@ -54,7 +56,9 @@ class Admin::Poll::OfficerAssignmentsController < Admin::BaseController
|
||||
else
|
||||
notice = t("admin.poll_officer_assignments.flash.error_destroy")
|
||||
end
|
||||
redirect_to by_officer_admin_poll_officer_assignments_path(poll_id: @officer_assignment.poll_id, officer_id: @officer_assignment.officer_id), notice: notice
|
||||
|
||||
redirect_params = { poll_id: @officer_assignment.poll_id, officer_id: @officer_assignment.officer_id }
|
||||
redirect_to by_officer_admin_poll_officer_assignments_path(redirect_params), notice: notice
|
||||
end
|
||||
|
||||
private
|
||||
@@ -68,7 +72,8 @@ class Admin::Poll::OfficerAssignmentsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def load_booth_assignment
|
||||
@booth_assignment = ::Poll::BoothAssignment.includes(:poll).find_by(poll_id: create_params[:poll_id], booth_id: create_params[:booth_id])
|
||||
find_params = { poll_id: create_params[:poll_id], booth_id: create_params[:booth_id] }
|
||||
@booth_assignment = ::Poll::BoothAssignment.includes(:poll).find_by(find_params)
|
||||
end
|
||||
|
||||
def load_poll
|
||||
@@ -89,4 +94,4 @@ class Admin::Poll::OfficerAssignmentsController < Admin::BaseController
|
||||
@search = search_params[:search]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,9 @@ class Admin::SpendingProposalsController < Admin::BaseController
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
@spending_proposals = SpendingProposal.scoped_filter(params, @current_filter).order(cached_votes_up: :desc, created_at: :desc).page(params[:page])
|
||||
@spending_proposals = SpendingProposal.scoped_filter(params, @current_filter)
|
||||
.order(cached_votes_up: :desc, created_at: :desc)
|
||||
.page(params[:page])
|
||||
end
|
||||
|
||||
def show
|
||||
@@ -33,13 +35,15 @@ class Admin::SpendingProposalsController < Admin::BaseController
|
||||
|
||||
def summary
|
||||
@spending_proposals = SpendingProposal.group(:geozone).sum(:price).sort_by{|geozone, count| geozone.present? ? geozone.name : "z"}
|
||||
@spending_proposals_with_supports = SpendingProposal.with_supports.group(:geozone).sum(:price).sort_by{|geozone, count| geozone.present? ? geozone.name : "z"}
|
||||
@spending_proposals_with_supports = SpendingProposal.with_supports.group(:geozone).sum(:price)
|
||||
.sort_by{|geozone, count| geozone.present? ? geozone.name : "z"}
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def spending_proposal_params
|
||||
params.require(:spending_proposal).permit(:title, :description, :external_url, :geozone_id, :association_name, :administrator_id, :tag_list, valuator_ids: [])
|
||||
params.require(:spending_proposal).permit(:title, :description, :external_url, :geozone_id, :association_name,
|
||||
:administrator_id, :tag_list, valuator_ids: [])
|
||||
end
|
||||
|
||||
def load_admins
|
||||
@@ -54,4 +58,4 @@ class Admin::SpendingProposalsController < Admin::BaseController
|
||||
@tags = ActsAsTaggableOn::Tag.spending_proposal_tags
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user