Sha256: 90f24e6670a2e9284c76abba6b453d2bde22805ffc7ab1a84a8d3efc1e51e0ba

Contents?: true

Size: 726 Bytes

Versions: 13

Compression:

Stored size: 726 Bytes

Contents

module Pageflow
  class Page < ApplicationRecord
    include SerializedConfiguration
    include AutoGeneratedPermaId

    belongs_to :chapter, touch: true

    attr_accessor :is_first

    validates_inclusion_of :template, :in => ->(_) { Pageflow.config.page_types.names }

    scope :displayed_in_navigation, -> { where(:display_in_navigation => true) }

    def title
      configuration['title'].presence || configuration['additional_title']
    end

    def page_type
      Pageflow.config.page_types.find_by_name!(template)
    end

    def configuration=(value)
      self.display_in_navigation = value['display_in_navigation']
      super
    end

    def copy_to(chapter)
      chapter.pages << dup
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
pageflow-15.4.0 app/models/pageflow/page.rb
pageflow-15.3.0 app/models/pageflow/page.rb
pageflow-15.2.2 app/models/pageflow/page.rb
pageflow-15.2.1 app/models/pageflow/page.rb
pageflow-15.2.0 app/models/pageflow/page.rb
pageflow-15.1.2 app/models/pageflow/page.rb
pageflow-15.1.1 app/models/pageflow/page.rb
pageflow-15.1.0 app/models/pageflow/page.rb
pageflow-15.1.0.rc0 app/models/pageflow/page.rb
pageflow-15.1.0.beta6 app/models/pageflow/page.rb
pageflow-15.1.0.beta5 app/models/pageflow/page.rb
pageflow-15.1.0.beta4 app/models/pageflow/page.rb
pageflow-15.1.0.beta3 app/models/pageflow/page.rb