Sha256: 25e6db4150e63fb8b38f5210526698a208f6b36182e1235cb52485405636c678

Contents?: true

Size: 738 Bytes

Versions: 48

Compression:

Stored size: 738 Bytes

Contents

module Pageflow
  class HomeButton
    attr_reader :revision, :theming

    def initialize(revision, theming)
      @revision = revision
      @theming = theming
    end

    def url
      revision.home_url.presence || theming_home_button_url
    end

    def enabled?
      revision.home_button_enabled? &&
        revision.theme.has_home_button? &&
        url.present?
    end

    def url_value
      revision.home_url
    end

    def enabled_value
      revision.home_button_enabled?
    end

    private

    def theming_home_button_url
      if theming.home_url.present?
        options = Pageflow.config.theming_url_options(theming) || {}
        options.merge(controller: 'entries', action: 'index')
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
pageflow-14.0.0 app/models/pageflow/home_button.rb
pageflow-14.0.0.rc2 app/models/pageflow/home_button.rb
pageflow-14.0.0.rc1 app/models/pageflow/home_button.rb
pageflow-14.0.0.beta3 app/models/pageflow/home_button.rb
pageflow-14.0.0.beta2 app/models/pageflow/home_button.rb
pageflow-14.0.0.beta1 app/models/pageflow/home_button.rb
pageflow-13.6.0 app/models/pageflow/home_button.rb
pageflow-13.5.0 app/models/pageflow/home_button.rb
pageflow-13.4.0 app/models/pageflow/home_button.rb
pageflow-13.3.0 app/models/pageflow/home_button.rb
pageflow-13.2.0 app/models/pageflow/home_button.rb
pageflow-12.6.0 app/models/pageflow/home_button.rb
pageflow-13.1.0 app/models/pageflow/home_button.rb
pageflow-12.5.0 app/models/pageflow/home_button.rb
pageflow-12.4.1 app/models/pageflow/home_button.rb
pageflow-13.0.0 app/models/pageflow/home_button.rb
pageflow-13.0.0.rc1 app/models/pageflow/home_button.rb
pageflow-12.4.0 app/models/pageflow/home_button.rb
pageflow-12.3.0 app/models/pageflow/home_button.rb
pageflow-13.0.0.beta7 app/models/pageflow/home_button.rb