Class: Decidim::EnhancedTextwork::Admin::ParagraphsForkForm

Inherits:
Form
  • Object
show all
Defined in:
app/forms/decidim/enhanced_textwork/admin/paragraphs_fork_form.rb

Overview

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

Direct Known Subclasses

ParagraphsMergeForm, ParagraphsSplitForm

Instance Method Summary collapse

Instance Method Details

#paragraphsObject



17
18
19
# File 'app/forms/decidim/enhanced_textwork/admin/paragraphs_fork_form.rb', line 17

def paragraphs
  @paragraphs ||= Decidim::EnhancedTextwork::Paragraph.where(component: current_component, id: paragraph_ids).uniq
end

#same_component?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'app/forms/decidim/enhanced_textwork/admin/paragraphs_fork_form.rb', line 27

def same_component?
  target_component == current_component
end

#target_componentObject



21
22
23
24
25
# File 'app/forms/decidim/enhanced_textwork/admin/paragraphs_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