Simplify method to get the toggle selection path
This commit is contained in:
@@ -16,12 +16,7 @@ class Admin::Proposals::ToggleSelectionComponent < ApplicationComponent
|
|||||||
end
|
end
|
||||||
|
|
||||||
def path
|
def path
|
||||||
case proposal.class.to_s
|
admin_polymorphic_path(proposal, action: :toggle_selection)
|
||||||
when "Proposal"
|
|
||||||
toggle_selection_admin_proposal_path(proposal)
|
|
||||||
when "Legislation::Proposal"
|
|
||||||
toggle_selection_admin_legislation_process_proposal_path(proposal.process, proposal)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def options
|
def options
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ module ActionDispatch::Routing::UrlFor
|
|||||||
end
|
end
|
||||||
|
|
||||||
def namespaced_polymorphic_path(namespace, resource, options = {})
|
def namespaced_polymorphic_path(namespace, resource, options = {})
|
||||||
if %w[Budget::Group Budget::Heading Legislation::DraftVersion Legislation::Question
|
if %w[Budget::Group Budget::Heading Legislation::DraftVersion Legislation::Proposal Legislation::Question
|
||||||
Poll::Booth Poll::BoothAssignment Poll::Officer Poll::Question Poll::Question::Option
|
Poll::Booth Poll::BoothAssignment Poll::Officer Poll::Question Poll::Question::Option
|
||||||
Poll::Question::Option::Video Poll::Shift SDG::LocalTarget].include?(resource.class.name)
|
Poll::Question::Option::Video Poll::Shift SDG::LocalTarget].include?(resource.class.name)
|
||||||
resolve = resolve_for(resource)
|
resolve = resolve_for(resource)
|
||||||
|
|||||||
Reference in New Issue
Block a user