Sha256: 7693f6e4ccbdb5c1388e0083e583ff205305810a75c8f8177f23fd4b333cd15b

Contents?: true

Size: 885 Bytes

Versions: 5

Compression:

Stored size: 885 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module DecidimAwesome
    module Admin
      module NeedsConstraintHelpers
        private

        def create_constraint_never(var)
          settings = { "participatory_space_manifest" => "none" }
          subconfig = AwesomeConfig.find_or_initialize_by(var: "#{var}_#{@ident}", organization: @organization)
          @constraint = ConfigConstraint.create!(
            awesome_config: subconfig,
            settings:
          )
        end

        def constraint_can_be_destroyed?(constraint)
          return true if constraint.awesome_config.blank?
          return true if constraint.awesome_config.constraints.count > 1

          case constraint.awesome_config.var.to_s
          when /^proposal_(private_)?custom_field/
            false
          else
            true
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-decidim_awesome-0.12.0 app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb
decidim-decidim_awesome-0.11.4 app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb
decidim-decidim_awesome-0.11.3 app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb
decidim-decidim_awesome-0.11.2 app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb
decidim-decidim_awesome-0.11.1 app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb