Class: Decidim::Proposals::Admin::ProposalsForkForm

Inherits:
Form
  • Object
show all
Defined in:
decidim-proposals/app/forms/decidim/proposals/admin/proposals_fork_form.rb

Overview

A common abstract to be used by the Merge and Split proposals forms.

Direct Known Subclasses

ProposalsMergeForm, ProposalsSplitForm

Instance Method Summary collapse

Instance Method Details

#proposalsObject


17
18
19
# File 'decidim-proposals/app/forms/decidim/proposals/admin/proposals_fork_form.rb', line 17

def proposals
  @proposals ||= Decidim::Proposals::Proposal.where(component: current_component, id: proposal_ids).uniq
end

#same_component?Boolean

Returns:

  • (Boolean)

27
28
29
# File 'decidim-proposals/app/forms/decidim/proposals/admin/proposals_fork_form.rb', line 27

def same_component?
  target_component == current_component
end

#target_componentObject


21
22
23
24
25
# File 'decidim-proposals/app/forms/decidim/proposals/admin/proposals_fork_form.rb', line 21

def target_component
  return current_component if clean_target_component_id == current_component.id

  @target_component ||= current_component.siblings.find_by(id: target_component_id)
end