Sha256: e884fcb82726f2a932cd695ac3974c8181241b396a2e2df59cd2ef5ec4e350a6

Contents?: true

Size: 1.71 KB

Versions: 15

Compression:

Stored size: 1.71 KB

Contents

module Pageflow
  class Themes
    include Enumerable

    def initialize
      @themes = HashWithIndifferentAccess.new
    end

    # Register a theme and supply theme options.
    #
    # @param name [Symbol]
    #   Used in conventional directory names.
    #
    # @option options :no_home_button [Boolean]
    #   Pass true if theme does not display home buttons in navigation
    #   bars.
    #
    # @option options :scroll_back_indicator [Boolean]
    #   Pass true if theme has styles for an indicator pointing to the
    #   previous page.
    #
    # @option options :scroll_indicator_modes [Boolean]
    #   Pass true if theme supports horizontal scroll indicators.
    #
    # @option options :emphasized_pages [Boolean]
    #   Pass true if theme has styles for emphasized pages in navigation bars.
    #
    # @option options :no_page_change_by_scrolling [Boolean]
    #   Pass true if changing the page by using the mouse wheel shall
    #   be deactivated.
    #
    # @option options :no_hide_text_on_swipe [Boolean]
    #   Pass true if hiding the text by swiping to left shall be
    #   deactivated on mobile devices.
    #
    # @option options :hide_logo_option [Boolean]
    #   Pass true if hiding the logo on specific pages should be supported
    #   as an option in the editor.
    #
    # @option options :logo_url [String]
    #   Pass logo url as string to turn the logo in navigation bar into a link.
    #
    def register(name, options = {})
      @themes[name] = Theme.new(name, options)
    end

    def get(name)
      @themes.fetch(name) { raise(ArgumentError, "Unknown theme '#{name}'.") }
    end

    def names
      map(&:name)
    end

    def each(&block)
      @themes.values.each(&block)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
pageflow-17.0.4 lib/pageflow/themes.rb
pageflow-17.0.3 lib/pageflow/themes.rb
pageflow-17.0.2 lib/pageflow/themes.rb
pageflow-17.0.1 lib/pageflow/themes.rb
pageflow-17.0.0 lib/pageflow/themes.rb
pageflow-16.2.0 lib/pageflow/themes.rb
pageflow-16.1.0 lib/pageflow/themes.rb
pageflow-16.0.0 lib/pageflow/themes.rb
pageflow-15.8.0 lib/pageflow/themes.rb
pageflow-15.7.1 lib/pageflow/themes.rb
pageflow-15.7.0 lib/pageflow/themes.rb
pageflow-15.6.1 lib/pageflow/themes.rb
pageflow-15.6.0 lib/pageflow/themes.rb
pageflow-15.5.0 lib/pageflow/themes.rb
pageflow-15.4.0 lib/pageflow/themes.rb