Sha256: c88e985580be31f08b81c4e07a0ac7975897aa7a3807b2bb7c85d245ce46a31d

Contents?: true

Size: 1.28 KB

Versions: 13

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

module Decidim
  class ParticipatoryProcessGroup < ApplicationRecord
    include Decidim::Resourceable
    include Decidim::Traceable
    include Decidim::HasUploadValidations
    include Decidim::TranslatableResource

    translatable_fields :title, :description, :developer_group, :local_area, :meta_scope, :participatory_scope,
                        :participatory_structure, :target

    has_many :participatory_processes,
             foreign_key: "decidim_participatory_process_group_id",
             class_name: "Decidim::ParticipatoryProcess",
             inverse_of: :participatory_process_group,
             dependent: :nullify

    belongs_to :organization,
               foreign_key: "decidim_organization_id",
               class_name: "Decidim::Organization"

    has_one_attached :hero_image
    validates_upload :hero_image, uploader: Decidim::HeroImageUploader

    # Scope to return only the promoted groups.
    #
    # Returns an ActiveRecord::Relation.
    def self.promoted
      where(promoted: true)
    end

    def self.log_presenter_class_for(_log)
      Decidim::ParticipatoryProcesses::AdminLog::ParticipatoryProcessGroupPresenter
    end

    def self.participatory_spaces(group_id)
      find(group_id).participatory_processes
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.29.1 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.28.4 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.29.0 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.28.3 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.29.0.rc4 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.29.0.rc3 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.29.0.rc2 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.29.0.rc1 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.28.2 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.28.1 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.28.0 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.28.0.rc5 app/models/decidim/participatory_process_group.rb
decidim-participatory_processes-0.28.0.rc4 app/models/decidim/participatory_process_group.rb