Fix line lenght offenses at multiple controllers
This commit is contained in:
@@ -59,10 +59,11 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def poll_params
|
def poll_params
|
||||||
params.require(:poll).permit(:name, :starts_at, :ends_at, :geozone_restricted,
|
image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||||
:summary, :description, :results_enabled, :stats_enabled,
|
attributes = [:name, :starts_at, :ends_at, :geozone_restricted, :summary, :description,
|
||||||
geozone_ids: [],
|
:results_enabled, :stats_enabled, geozone_ids: [],
|
||||||
image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy])
|
image_attributes: image_attributes]
|
||||||
|
params.require(:poll).permit(*attributes)
|
||||||
end
|
end
|
||||||
|
|
||||||
def search_params
|
def search_params
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def answer_params
|
def answer_params
|
||||||
params.require(:poll_question_answer).permit(:title, :description, :question_id, documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy])
|
documents_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||||
|
attributes = [:title, :description, :question_id, documents_attributes: documents_attributes]
|
||||||
|
params.require(:poll_question_answer).permit(*attributes)
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_answer
|
def load_answer
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController
|
|||||||
@officer = @shift.officer
|
@officer = @shift.officer
|
||||||
|
|
||||||
if @shift.save
|
if @shift.save
|
||||||
redirect_to new_admin_booth_shift_path(@shift.booth), notice: t("admin.poll_shifts.flash.create")
|
notice = t("admin.poll_shifts.flash.create")
|
||||||
|
redirect_to new_admin_booth_shift_path(@shift.booth), notice: notice
|
||||||
else
|
else
|
||||||
load_shifts
|
load_shifts
|
||||||
flash[:error] = t("admin.poll_shifts.flash.date_missing")
|
flash[:error] = t("admin.poll_shifts.flash.date_missing")
|
||||||
@@ -31,7 +32,7 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def search_officers
|
def search_officers
|
||||||
@officers = User.search(params[:search]).order(username: :asc).select { |o| o.poll_officer? == true }
|
@officers = User.search(params[:search]).order(username: :asc).select { |o| o.poll_officer? }
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -51,7 +52,9 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def shift_params
|
def shift_params
|
||||||
shift_params = params.require(:shift).permit(:booth_id, :officer_id, :task, date: [:vote_collection_date, :recount_scrutiny_date])
|
date_attributes = [:vote_collection_date, :recount_scrutiny_date]
|
||||||
|
attributes = [:booth_id, :officer_id, :task, date: date_attributes]
|
||||||
|
shift_params = params.require(:shift).permit(*attributes)
|
||||||
shift_params.merge(date: shift_params[:date]["#{shift_params[:task]}_date".to_sym])
|
shift_params.merge(date: shift_params[:date]["#{shift_params[:task]}_date".to_sym])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ class Admin::ProposalsController < Admin::BaseController
|
|||||||
before_action :load_proposal, only: [:confirm_hide, :restore]
|
before_action :load_proposal, only: [:confirm_hide, :restore]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@proposals = Proposal.only_hidden.send(@current_filter).order(hidden_at: :desc).page(params[:page])
|
@proposals = Proposal.only_hidden.send(@current_filter).order(hidden_at: :desc)
|
||||||
|
.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirm_hide
|
def confirm_hide
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ class Admin::SiteCustomization::ContentBlocksController < Admin::SiteCustomizati
|
|||||||
|
|
||||||
def create
|
def create
|
||||||
if @content_block.save
|
if @content_block.save
|
||||||
redirect_to admin_site_customization_content_blocks_path, notice: t('admin.site_customization.content_blocks.create.notice')
|
notice = t('admin.site_customization.content_blocks.create.notice')
|
||||||
|
redirect_to admin_site_customization_content_blocks_path, notice: notice
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.site_customization.content_blocks.create.error')
|
flash.now[:error] = t('admin.site_customization.content_blocks.create.error')
|
||||||
render :new
|
render :new
|
||||||
@@ -16,7 +17,8 @@ class Admin::SiteCustomization::ContentBlocksController < Admin::SiteCustomizati
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
if @content_block.update(content_block_params)
|
if @content_block.update(content_block_params)
|
||||||
redirect_to admin_site_customization_content_blocks_path, notice: t('admin.site_customization.content_blocks.update.notice')
|
notice = t('admin.site_customization.content_blocks.update.notice')
|
||||||
|
redirect_to admin_site_customization_content_blocks_path, notice: notice
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.site_customization.content_blocks.update.error')
|
flash.now[:error] = t('admin.site_customization.content_blocks.update.error')
|
||||||
render :edit
|
render :edit
|
||||||
@@ -25,7 +27,8 @@ class Admin::SiteCustomization::ContentBlocksController < Admin::SiteCustomizati
|
|||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@content_block.destroy
|
@content_block.destroy
|
||||||
redirect_to admin_site_customization_content_blocks_path, notice: t('admin.site_customization.content_blocks.destroy.notice')
|
notice = t('admin.site_customization.content_blocks.destroy.notice')
|
||||||
|
redirect_to admin_site_customization_content_blocks_path, notice: notice
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ class Admin::SiteCustomization::ImagesController < Admin::SiteCustomization::Bas
|
|||||||
end
|
end
|
||||||
|
|
||||||
if @image.update(image_params)
|
if @image.update(image_params)
|
||||||
redirect_to admin_site_customization_images_path, notice: t('admin.site_customization.images.update.notice')
|
notice = t('admin.site_customization.images.update.notice')
|
||||||
|
redirect_to admin_site_customization_images_path, notice: notice
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.site_customization.images.update.error')
|
flash.now[:error] = t('admin.site_customization.images.update.error')
|
||||||
|
|
||||||
@@ -27,9 +28,11 @@ class Admin::SiteCustomization::ImagesController < Admin::SiteCustomization::Bas
|
|||||||
def destroy
|
def destroy
|
||||||
@image.image = nil
|
@image.image = nil
|
||||||
if @image.save
|
if @image.save
|
||||||
redirect_to admin_site_customization_images_path, notice: t('admin.site_customization.images.destroy.notice')
|
notice = t('admin.site_customization.images.destroy.notice')
|
||||||
|
redirect_to admin_site_customization_images_path, notice: notice
|
||||||
else
|
else
|
||||||
redirect_to admin_site_customization_images_path, notice: t('admin.site_customization.images.destroy.error')
|
notice = t('admin.site_customization.images.destroy.error')
|
||||||
|
redirect_to admin_site_customization_images_path, notice: notice
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ class Admin::SiteCustomization::PagesController < Admin::SiteCustomization::Base
|
|||||||
|
|
||||||
def create
|
def create
|
||||||
if @page.save
|
if @page.save
|
||||||
redirect_to admin_site_customization_pages_path, notice: t('admin.site_customization.pages.create.notice')
|
notice = t('admin.site_customization.pages.create.notice')
|
||||||
|
redirect_to admin_site_customization_pages_path, notice: notice
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.site_customization.pages.create.error')
|
flash.now[:error] = t('admin.site_customization.pages.create.error')
|
||||||
render :new
|
render :new
|
||||||
@@ -16,7 +17,8 @@ class Admin::SiteCustomization::PagesController < Admin::SiteCustomization::Base
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
if @page.update(page_params)
|
if @page.update(page_params)
|
||||||
redirect_to admin_site_customization_pages_path, notice: t('admin.site_customization.pages.update.notice')
|
notice = t('admin.site_customization.pages.update.notice')
|
||||||
|
redirect_to admin_site_customization_pages_path, notice: notice
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.site_customization.pages.update.error')
|
flash.now[:error] = t('admin.site_customization.pages.update.error')
|
||||||
render :edit
|
render :edit
|
||||||
@@ -25,7 +27,8 @@ class Admin::SiteCustomization::PagesController < Admin::SiteCustomization::Base
|
|||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@page.destroy
|
@page.destroy
|
||||||
redirect_to admin_site_customization_pages_path, notice: t('admin.site_customization.pages.destroy.notice')
|
notice = t('admin.site_customization.pages.destroy.notice')
|
||||||
|
redirect_to admin_site_customization_pages_path, notice: notice
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
Reference in New Issue
Block a user