Class: Decidim::Admin::FeatureForm

Inherits:
Form
  • Object
show all
Includes:
TranslatableAttributes
Defined in:
app/forms/decidim/admin/feature_form.rb

Overview

A form object used to attach a feature to a participatory process from the admin panel.

Instance Method Summary collapse

Instance Method Details

#map_model(model) ⇒ Object



22
23
24
25
# File 'app/forms/decidim/admin/feature_form.rb', line 22

def map_model(model)
  self.attributes = model.attributes
  self.settings = model.settings
end

#settings?Boolean

Returns:

  • (Boolean)


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

def settings?
  settings.manifest.attributes.any?
end

#step_settings?Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
37
38
39
40
# File 'app/forms/decidim/admin/feature_form.rb', line 31

def step_settings?
  return false unless participatory_process.steps.any?

  step_settings
    .values
    .map(&:manifest)
    .flat_map(&:attributes)
    .flat_map(&:keys)
    .any?
end