Fix all rubocop Metrics/LineLength issues (140+)
This commit is contained in:
@@ -23,10 +23,12 @@ class AccountController < ApplicationController
|
||||
|
||||
def account_params
|
||||
if @account.organization?
|
||||
params.require(:account).permit(:phone_number, :email_on_comment, :email_on_comment_reply, :newsletter, organization_attributes: [:name, :responsible_name])
|
||||
params.require(:account).permit(:phone_number, :email_on_comment, :email_on_comment_reply, :newsletter,
|
||||
organization_attributes: [:name, :responsible_name])
|
||||
else
|
||||
params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :email_on_direct_message, :email_digest, :newsletter, :official_position_badge)
|
||||
params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply,
|
||||
:email_on_direct_message, :email_digest, :newsletter, :official_position_badge)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -28,7 +28,8 @@ module Budgets
|
||||
respond_to :html, :js
|
||||
|
||||
def index
|
||||
@investments = @investments.apply_filters_and_search(@budget, params, @current_filter).send("sort_by_#{@current_order}").page(params[:page]).per(10).for_render
|
||||
@investments = @investments.apply_filters_and_search(@budget, params, @current_filter)
|
||||
.send("sort_by_#{@current_order}").page(params[:page]).per(10).for_render
|
||||
@investment_ids = @investments.pluck(:id)
|
||||
load_investment_votes(@investments)
|
||||
@tag_cloud = tag_cloud
|
||||
@@ -102,7 +103,8 @@ module Budgets
|
||||
end
|
||||
|
||||
def investment_params
|
||||
params.require(:budget_investment).permit(:title, :description, :external_url, :heading_id, :tag_list, :organization_name, :location, :terms_of_service)
|
||||
params.require(:budget_investment).permit(:title, :description, :external_url, :heading_id, :tag_list,
|
||||
:organization_name, :location, :terms_of_service)
|
||||
end
|
||||
|
||||
def load_ballot
|
||||
|
||||
@@ -88,7 +88,8 @@ module CommentableActions
|
||||
end
|
||||
|
||||
def set_geozone
|
||||
@resource.geozone = Geozone.find(params[resource_name.to_sym].try(:[], :geozone_id)) if params[resource_name.to_sym].try(:[], :geozone_id).present?
|
||||
geozone_id = params[resource_name.to_sym].try(:[], :geozone_id)
|
||||
@resource.geozone = Geozone.find(geozone_id) if geozone_id.present?
|
||||
end
|
||||
|
||||
def load_categories
|
||||
@@ -109,4 +110,4 @@ module CommentableActions
|
||||
nil
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -102,8 +102,9 @@ class Legislation::AnnotationsController < ApplicationController
|
||||
end
|
||||
|
||||
def convert_ranges_parameters
|
||||
if params[:legislation_annotation] && params[:legislation_annotation][:ranges] && params[:legislation_annotation][:ranges].is_a?(String)
|
||||
params[:legislation_annotation][:ranges] = JSON.parse(params[:legislation_annotation][:ranges])
|
||||
annotation = params[:legislation_annotation]
|
||||
if annotation && annotation[:ranges] && annotation[:ranges].is_a?(String)
|
||||
params[:legislation_annotation][:ranges] = JSON.parse(annotation[:ranges])
|
||||
end
|
||||
rescue JSON::ParserError
|
||||
end
|
||||
|
||||
@@ -18,9 +18,10 @@ class Legislation::AnswersController < Legislation::BaseController
|
||||
format.html { redirect_to legislation_process_question_path(@process, @question) }
|
||||
end
|
||||
else
|
||||
alert = t('legislation.questions.participation.phase_not_open')
|
||||
respond_to do |format|
|
||||
format.js { render json: {}, status: :not_found }
|
||||
format.html { redirect_to legislation_process_question_path(@process, @question), alert: t('legislation.questions.participation.phase_not_open') }
|
||||
format.html { redirect_to legislation_process_question_path(@process, @question), alert: alert }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,7 +43,8 @@ class Management::DocumentVerificationsController < Management::BaseController
|
||||
end
|
||||
|
||||
def clean_document_number
|
||||
params[:document_verification][:document_number] = params[:document_verification][:document_number].gsub(/[^a-z0-9]+/i, "").upcase unless params[:document_verification][:document_number].blank?
|
||||
return if params[:document_verification][:document_number].blank?
|
||||
params[:document_verification][:document_number] = params[:document_verification][:document_number].gsub(/[^a-z0-9]+/i, "").upcase
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,7 +34,8 @@ class Management::ProposalsController < Management::BaseController
|
||||
end
|
||||
|
||||
def proposal_params
|
||||
params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url, :responsible_name, :tag_list, :terms_of_service, :geozone_id)
|
||||
params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url,
|
||||
:responsible_name, :tag_list, :terms_of_service, :geozone_id)
|
||||
end
|
||||
|
||||
def resource_model
|
||||
@@ -53,4 +54,4 @@ class Management::ProposalsController < Management::BaseController
|
||||
@comment_flags = managed_user ? managed_user.comment_flags(comments) : {}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,7 +17,8 @@ class Management::SpendingProposalsController < Management::BaseController
|
||||
@spending_proposal.author = managed_user
|
||||
|
||||
if @spending_proposal.save
|
||||
redirect_to management_spending_proposal_path(@spending_proposal), notice: t('flash.actions.create.notice', resource_name: t("activerecord.models.spending_proposal", count: 1))
|
||||
notice = t('flash.actions.create.notice', resource_name: t("activerecord.models.spending_proposal", count: 1))
|
||||
redirect_to management_spending_proposal_path(@spending_proposal), notice: notice
|
||||
else
|
||||
render :new
|
||||
end
|
||||
|
||||
@@ -15,7 +15,8 @@ class Officing::FinalRecountsController < Officing::BaseController
|
||||
end
|
||||
|
||||
def create
|
||||
@final_recount = ::Poll::FinalRecount.find_or_initialize_by(booth_assignment_id: @officer_assignment.booth_assignment_id, date: final_recount_params[:date])
|
||||
@final_recount = ::Poll::FinalRecount.find_or_initialize_by(booth_assignment_id: @officer_assignment.booth_assignment_id,
|
||||
date: final_recount_params[:date])
|
||||
@final_recount.officer_assignment_id = @officer_assignment.id
|
||||
@final_recount.count = final_recount_params[:count]
|
||||
|
||||
@@ -45,4 +46,4 @@ class Officing::FinalRecountsController < Officing::BaseController
|
||||
params.permit(:officer_assignment_id, :count, :date)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,7 +14,8 @@ class Officing::RecountsController < Officing::BaseController
|
||||
end
|
||||
|
||||
def create
|
||||
@recount = ::Poll::Recount.find_or_initialize_by(booth_assignment_id: @officer_assignment.booth_assignment_id, date: @officer_assignment.date)
|
||||
@recount = ::Poll::Recount.find_or_initialize_by(booth_assignment_id: @officer_assignment.booth_assignment_id,
|
||||
date: @officer_assignment.date)
|
||||
@recount.officer_assignment_id = @officer_assignment.id
|
||||
@recount.count = recount_params[:count]
|
||||
|
||||
@@ -44,4 +45,4 @@ class Officing::RecountsController < Officing::BaseController
|
||||
params.permit(:officer_assignment_id, :count)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -126,7 +126,8 @@ class Officing::ResultsController < Officing::BaseController
|
||||
|
||||
def load_partial_results
|
||||
if @officer_assignments.present?
|
||||
@partial_results = ::Poll::PartialResult.where(officer_assignment_id: @officer_assignments.map(&:id)).order(:booth_assignment_id, :date)
|
||||
@partial_results = ::Poll::PartialResult.where(officer_assignment_id: @officer_assignments.map(&:id))
|
||||
.order(:booth_assignment_id, :date)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ class Organizations::RegistrationsController < Devise::RegistrationsController
|
||||
private
|
||||
|
||||
def sign_up_params
|
||||
params.require(:user).permit(:email, :password, :phone_number, :password_confirmation, :terms_of_service, organization_attributes: [:name, :responsible_name])
|
||||
params.require(:user).permit(:email, :password, :phone_number, :password_confirmation, :terms_of_service,
|
||||
organization_attributes: [:name, :responsible_name])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -74,7 +74,8 @@ class ProposalsController < ApplicationController
|
||||
private
|
||||
|
||||
def proposal_params
|
||||
params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url, :responsible_name, :tag_list, :terms_of_service, :geozone_id)
|
||||
params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url,
|
||||
:responsible_name, :tag_list, :terms_of_service, :geozone_id)
|
||||
end
|
||||
|
||||
def retired_params
|
||||
@@ -109,7 +110,8 @@ class ProposalsController < ApplicationController
|
||||
end
|
||||
|
||||
def load_featured
|
||||
@featured_proposals = Proposal.not_archived.sort_by_confidence_score.limit(3) if (!@advanced_search_terms && @search_terms.blank? && @tag_filter.blank? && params[:retired].blank?)
|
||||
return unless !@advanced_search_terms && @search_terms.blank? && @tag_filter.blank? && params[:retired].blank?
|
||||
@featured_proposals = Proposal.not_archived.sort_by_confidence_score.limit(3)
|
||||
if @featured_proposals.present?
|
||||
set_featured_proposal_votes(@featured_proposals)
|
||||
@resources = @resources.where('proposals.id NOT IN (?)', @featured_proposals.map(&:id))
|
||||
|
||||
@@ -30,7 +30,8 @@ class SpendingProposalsController < ApplicationController
|
||||
@spending_proposal.author = current_user
|
||||
|
||||
if @spending_proposal.save
|
||||
notice = t('flash.actions.create.spending_proposal', activity: "<a href='#{user_path(current_user, filter: :spending_proposals)}'>#{t('layouts.header.my_activity_link')}</a>")
|
||||
activity = "<a href='#{user_path(current_user, filter: :spending_proposals)}'>#{t('layouts.header.my_activity_link')}</a>"
|
||||
notice = t('flash.actions.create.spending_proposal', activity: activity)
|
||||
redirect_to @spending_proposal, notice: notice, flash: { html_safe: true }
|
||||
else
|
||||
render :new
|
||||
|
||||
@@ -12,11 +12,13 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
|
||||
|
||||
def index
|
||||
@heading_filters = heading_filters
|
||||
if current_user.valuator? && @budget.present?
|
||||
@investments = @budget.investments.scoped_filter(params_for_current_valuator, @current_filter).order(cached_votes_up: :desc).page(params[:page])
|
||||
else
|
||||
@investments = Budget::Investment.none.page(params[:page])
|
||||
end
|
||||
@investments = if current_user.valuator? && @budget.present?
|
||||
@budget.investments.scoped_filter(params_for_current_valuator, @current_filter)
|
||||
.order(cached_votes_up: :desc)
|
||||
.page(params[:page])
|
||||
else
|
||||
Budget::Investment.none.page(params[:page])
|
||||
end
|
||||
end
|
||||
|
||||
def valuate
|
||||
@@ -63,11 +65,14 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
|
||||
end
|
||||
|
||||
def valuation_params
|
||||
params.require(:budget_investment).permit(:price, :price_first_year, :price_explanation, :feasibility, :unfeasibility_explanation, :duration, :valuation_finished, :internal_comments)
|
||||
params.require(:budget_investment).permit(:price, :price_first_year, :price_explanation, :feasibility, :unfeasibility_explanation,
|
||||
:duration, :valuation_finished, :internal_comments)
|
||||
end
|
||||
|
||||
def restrict_access_to_assigned_items
|
||||
raise ActionController::RoutingError.new('Not Found') unless current_user.administrator? || Budget::ValuatorAssignment.exists?(investment_id: params[:id], valuator_id: current_user.valuator.id)
|
||||
return if current_user.administrator? ||
|
||||
Budget::ValuatorAssignment.exists?(investment_id: params[:id], valuator_id: current_user.valuator.id)
|
||||
raise ActionController::RoutingError.new('Not Found')
|
||||
end
|
||||
|
||||
def valid_price_params?
|
||||
|
||||
@@ -10,11 +10,13 @@ class Valuation::SpendingProposalsController < Valuation::BaseController
|
||||
|
||||
def index
|
||||
@geozone_filters = geozone_filters
|
||||
if current_user.valuator?
|
||||
@spending_proposals = SpendingProposal.scoped_filter(params_for_current_valuator, @current_filter).order(cached_votes_up: :desc).page(params[:page])
|
||||
else
|
||||
@spending_proposals = SpendingProposal.none.page(params[:page])
|
||||
end
|
||||
@spending_proposals = if current_user.valuator?
|
||||
SpendingProposal.scoped_filter(params_for_current_valuator, @current_filter)
|
||||
.order(cached_votes_up: :desc)
|
||||
.page(params[:page])
|
||||
else
|
||||
SpendingProposal.none.page(params[:page])
|
||||
end
|
||||
end
|
||||
|
||||
def valuate
|
||||
@@ -54,7 +56,8 @@ class Valuation::SpendingProposalsController < Valuation::BaseController
|
||||
def valuation_params
|
||||
params[:spending_proposal][:feasible] = nil if params[:spending_proposal][:feasible] == 'nil'
|
||||
|
||||
params.require(:spending_proposal).permit(:price, :price_first_year, :price_explanation, :feasible, :feasible_explanation, :time_scope, :valuation_finished, :internal_comments)
|
||||
params.require(:spending_proposal).permit(:price, :price_first_year, :price_explanation, :feasible, :feasible_explanation,
|
||||
:time_scope, :valuation_finished, :internal_comments)
|
||||
end
|
||||
|
||||
def params_for_current_valuator
|
||||
@@ -62,7 +65,9 @@ class Valuation::SpendingProposalsController < Valuation::BaseController
|
||||
end
|
||||
|
||||
def restrict_access_to_assigned_items
|
||||
raise ActionController::RoutingError.new('Not Found') unless current_user.administrator? || ValuationAssignment.exists?(spending_proposal_id: params[:id], valuator_id: current_user.valuator.id)
|
||||
return if current_user.administrator? ||
|
||||
ValuationAssignment.exists?(spending_proposal_id: params[:id], valuator_id: current_user.valuator.id)
|
||||
raise ActionController::RoutingError.new('Not Found')
|
||||
end
|
||||
|
||||
def valid_price_params?
|
||||
@@ -77,4 +82,4 @@ class Valuation::SpendingProposalsController < Valuation::BaseController
|
||||
@spending_proposal.errors.empty?
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user