Class: Decidim::TermCustomizer::Admin::TranslationSetConstraintForm

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

Instance Method Summary collapse

Instance Method Details

#componentObject



44
45
46
47
48
# File 'app/forms/decidim/term_customizer/admin/translation_set_constraint_form.rb', line 44

def component
  return unless subject_form

  subject_form.component
end

#map_model(model) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'app/forms/decidim/term_customizer/admin/translation_set_constraint_form.rb', line 19

def map_model(model)
  self.subject_manifest = model.manifest_name

  return unless model.subject

  self.subject_model = [
    TermCustomizer::Admin::TranslationSetSubjectForm.from_model(
      model.subject
    )
  ]
end

#subjectObject



37
38
39
40
41
42
# File 'app/forms/decidim/term_customizer/admin/translation_set_constraint_form.rb', line 37

def subject
  return component if component
  return unless subject_form

  subject_form.subject
end

#subject_formObject



50
51
52
53
54
# File 'app/forms/decidim/term_customizer/admin/translation_set_constraint_form.rb', line 50

def subject_form
  @subject_form ||= subject_model.find do |sm|
    sm.subject_manifest == subject_manifest
  end
end

#subject_typeObject



31
32
33
34
35
# File 'app/forms/decidim/term_customizer/admin/translation_set_constraint_form.rb', line 31

def subject_type
  return unless subject_form

  subject_form.manifest.try(:model_class_name)
end

#to_paramObject



13
14
15
16
17
# File 'app/forms/decidim/term_customizer/admin/translation_set_constraint_form.rb', line 13

def to_param
  return id if id.present?

  "constraint-id"
end