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

#default_step_settings?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'app/forms/decidim/admin/feature_form.rb', line 34

def default_step_settings?
  default_step_settings.manifest.attributes.any?
end

#map_model(model) ⇒ Object



24
25
26
27
28
# File 'app/forms/decidim/admin/feature_form.rb', line 24

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

#settings?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'app/forms/decidim/admin/feature_form.rb', line 30

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

#step_settings?Boolean

Returns:

  • (Boolean)


38
39
40
41
42
43
44
45
46
47
# File 'app/forms/decidim/admin/feature_form.rb', line 38

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

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