Sha256: 0ccf11ec4cbb1e5ca0659141eed353b5b1fdc0a3b07402841a6c0cd806320ae5
Contents?: true
Size: 1.45 KB
Versions: 19
Compression:
Stored size: 1.45 KB
Contents
# frozen_string_literal: true module Decidim # Initiative type. class InitiativesType < ApplicationRecord include Decidim::HasResourcePermission include Decidim::TranslatableResource include Decidim::HasUploadValidations translatable_fields :title, :description, :extra_fields_legal_information belongs_to :organization, foreign_key: "decidim_organization_id", class_name: "Decidim::Organization" has_many :scopes, foreign_key: "decidim_initiatives_types_id", class_name: "Decidim::InitiativesTypeScope", dependent: :destroy, inverse_of: :type has_many :initiatives, through: :scopes, class_name: "Decidim::Initiative" enum signature_type: [:online, :offline, :any], _suffix: true validates :title, :description, :signature_type, presence: true validates :document_number_authorization_handler, presence: true, if: ->(form) { form.collect_user_extra_fields? } has_one_attached :banner_image validates_upload :banner_image, uploader: Decidim::BannerImageUploader def allowed_signature_types_for_initiatives return %w(online offline any) if any_signature_type? Array(signature_type.to_s) end def allow_resource_permissions? true end def mounted_admin_engine "decidim_admin_initiatives" end def mounted_params { host: organization.host } end end end
Version data entries
19 entries across 19 versions & 1 rubygems