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.5.2 app/models/pageflow/home_button.rb
pageflow-15.1.0.beta2 app/models/pageflow/home_button.rb
pageflow-15.1.0.beta1 app/models/pageflow/home_button.rb
pageflow-15.0.2 app/models/pageflow/home_button.rb
pageflow-15.0.1 app/models/pageflow/home_button.rb
pageflow-15.0.0 app/models/pageflow/home_button.rb
pageflow-14.5.1 app/models/pageflow/home_button.rb
pageflow-14.5.0 app/models/pageflow/home_button.rb
pageflow-15.0.0.rc2 app/models/pageflow/home_button.rb
pageflow-15.0.0.rc1 app/models/pageflow/home_button.rb
pageflow-15.0.0.beta4 app/models/pageflow/home_button.rb
pageflow-15.0.0.beta3 app/models/pageflow/home_button.rb
pageflow-14.4.0 app/models/pageflow/home_button.rb
pageflow-15.0.0.beta2 app/models/pageflow/home_button.rb
pageflow-15.0.0.beta1 app/models/pageflow/home_button.rb
pageflow-14.3.0 app/models/pageflow/home_button.rb
pageflow-14.2.1 app/models/pageflow/home_button.rb
pageflow-14.2.0 app/models/pageflow/home_button.rb
pageflow-14.1.1 app/models/pageflow/home_button.rb
pageflow-14.1.0 app/models/pageflow/home_button.rb