Sha256: 57084a9a73e51035b829cd063b05be5d5bb48751425cfd31e15ebe2189a2c146

Contents?: true

Size: 538 Bytes

Versions: 50

Compression:

Stored size: 538 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class StaticPageTopic < ApplicationRecord
    validates :title, presence: true
    include Decidim::TranslatableResource

    translatable_fields :title, :description

    default_scope { order(arel_table[:weight].asc) }

    belongs_to :organization, class_name: "Decidim::Organization"
    has_many :pages, class_name: "Decidim::StaticPage", foreign_key: "topic_id", dependent: :nullify

    def accessible_pages_for(user)
      pages.accessible_for(organization, user)
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

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