Sha256: 5e661e5a5cda7d56c93241bc9a2361e8dbce1361e3e3c61464e46cbbd9395d66

Contents?: true

Size: 1.42 KB

Versions: 77

Compression:

Stored size: 1.42 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
    #   deactived on mobile devices.
    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

77 entries across 77 versions & 1 rubygems

Version Path
pageflow-14.5.2 lib/pageflow/themes.rb
pageflow-15.1.2 lib/pageflow/themes.rb
pageflow-15.1.1 lib/pageflow/themes.rb
pageflow-15.1.0 lib/pageflow/themes.rb
pageflow-15.1.0.rc0 lib/pageflow/themes.rb
pageflow-15.1.0.beta6 lib/pageflow/themes.rb
pageflow-15.1.0.beta5 lib/pageflow/themes.rb
pageflow-15.1.0.beta4 lib/pageflow/themes.rb
pageflow-15.1.0.beta3 lib/pageflow/themes.rb
pageflow-15.1.0.beta2 lib/pageflow/themes.rb
pageflow-15.1.0.beta1 lib/pageflow/themes.rb
pageflow-15.0.2 lib/pageflow/themes.rb
pageflow-15.0.1 lib/pageflow/themes.rb
pageflow-15.0.0 lib/pageflow/themes.rb
pageflow-14.5.1 lib/pageflow/themes.rb
pageflow-14.5.0 lib/pageflow/themes.rb
pageflow-15.0.0.rc2 lib/pageflow/themes.rb
pageflow-15.0.0.rc1 lib/pageflow/themes.rb
pageflow-15.0.0.beta4 lib/pageflow/themes.rb
pageflow-15.0.0.beta3 lib/pageflow/themes.rb