Sha256: 84c11029fd8c29af9ce51c8449d1eb93a546a855fbf17066c1481afef749486d
Contents?: true
Size: 1.2 KB
Versions: 14
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true module Decidim module Admin # A form object used to attach a feature to a participatory process from the # admin panel. # class FeatureForm < Decidim::Form include TranslatableAttributes mimic :feature translatable_attribute :name, String validates :name, translatable_presence: true attribute :settings, Object attribute :default_step_settings, Object attribute :manifest attribute :weight, Integer, default: 0 attribute :step_settings, Hash[String => Object] attribute :participatory_process def map_model(model) self.attributes = model.attributes self.settings = model.settings self.default_step_settings = model.default_step_settings end def settings? settings.manifest.attributes.any? end def default_step_settings? default_step_settings.manifest.attributes.any? end def step_settings? return false unless participatory_process.steps.any? step_settings .values .map(&:manifest) .flat_map(&:attributes) .flat_map(&:keys) .any? end end end end
Version data entries
14 entries across 14 versions & 2 rubygems