Sha256: d3c79e3787d5d9158e95cf61b15718b8cddb97f64810213e7abde20eef69cb58

Contents?: true

Size: 1.12 KB

Versions: 27

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    # The data store for a AgendaItem in the Decidim::Meetings component. It stores a
    # title, description and duration to render inside meeting.
    class AgendaItem < Meetings::ApplicationRecord
      include Decidim::Traceable
      include Decidim::Loggable

      belongs_to :agenda, -> { order(:position) }, foreign_key: "decidim_agenda_id", class_name: "Decidim::Meetings::Agenda"

      has_many :agenda_item_children, foreign_key: "parent_id", class_name: "Decidim::Meetings::AgendaItem", inverse_of: :parent, dependent: :destroy
      belongs_to :parent, foreign_key: "parent_id", class_name: "Decidim::Meetings::AgendaItem", inverse_of: :agenda_item_children, optional: true

      default_scope { order(:position) }

      def self.first_class
        where(parent_id: nil)
      end

      def parent?
        return true unless parent_id
      end

      def self.agenda_item_children
        where.not(parent_id: nil)
      end

      def self.log_presenter_class_for(_log)
        Decidim::Meetings::AdminLog::AgendaItemPresenter
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
decidim-meetings-0.22.0 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.21.0 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.20.1 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.20.0 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.19.1 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.18.1 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.19.0 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.17.2 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.18.0 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.17.1 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.16.1 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.17.0 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.16.0 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.15.2 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.15.1 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.15.0 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.14.4 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.14.3 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.14.2 app/models/decidim/meetings/agenda_item.rb
decidim-meetings-0.14.1 app/models/decidim/meetings/agenda_item.rb