Sha256: 7326dd89f09db8f6b55972d6a58fa36557e9f1debeed7937f9013a6f3a90f90d

Contents?: true

Size: 1.09 KB

Versions: 37

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module Decidim
  # It represents a member of the assembly (president, secretary, ...)
  # Can be linked to an existent user in the platform
  class AssemblyMember < ApplicationRecord
    include Decidim::Traceable
    include Decidim::Loggable
    include Decidim::HasUploadValidations

    POSITIONS = %w(president vice_president secretary other).freeze

    belongs_to :user, foreign_key: "decidim_user_id", class_name: "Decidim::UserBaseEntity", optional: true
    belongs_to :assembly, foreign_key: "decidim_assembly_id", class_name: "Decidim::Assembly"
    alias participatory_space assembly

    has_one_attached :non_user_avatar
    validates_avatar :non_user_avatar, uploader: Decidim::AvatarUploader

    delegate :organization, to: :assembly

    default_scope { order(weight: :asc, created_at: :asc) }

    scope :not_ceased, -> { where("ceased_date >= ? OR ceased_date IS NULL", Time.zone.today) }

    def self.log_presenter_class_for(_log)
      Decidim::Assemblies::AdminLog::AssemblyMemberPresenter
    end

    def remove_non_user_avatar
      false
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
decidim-assemblies-0.29.1 app/models/decidim/assembly_member.rb
decidim-assemblies-0.28.4 app/models/decidim/assembly_member.rb
decidim-assemblies-0.27.9 app/models/decidim/assembly_member.rb
decidim-assemblies-0.29.0 app/models/decidim/assembly_member.rb
decidim-assemblies-0.28.3 app/models/decidim/assembly_member.rb
decidim-assemblies-0.27.8 app/models/decidim/assembly_member.rb
decidim-assemblies-0.29.0.rc4 app/models/decidim/assembly_member.rb
decidim-assemblies-0.29.0.rc3 app/models/decidim/assembly_member.rb
decidim-assemblies-0.29.0.rc2 app/models/decidim/assembly_member.rb
decidim-assemblies-0.29.0.rc1 app/models/decidim/assembly_member.rb
decidim-assemblies-0.28.2 app/models/decidim/assembly_member.rb
decidim-assemblies-0.27.7 app/models/decidim/assembly_member.rb
decidim-assemblies-0.28.1 app/models/decidim/assembly_member.rb
decidim-assemblies-0.27.6 app/models/decidim/assembly_member.rb
decidim-assemblies-0.26.10 app/models/decidim/assembly_member.rb
decidim-assemblies-0.26.9 app/models/decidim/assembly_member.rb
decidim-assemblies-0.28.0 app/models/decidim/assembly_member.rb
decidim-assemblies-0.27.5 app/models/decidim/assembly_member.rb
decidim-assemblies-0.28.0.rc5 app/models/decidim/assembly_member.rb
decidim-assemblies-0.28.0.rc4 app/models/decidim/assembly_member.rb