Class: Pageflow::Themes

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/pageflow/themes.rb

Instance Method Summary collapse

Constructor Details

#initializeThemes

Returns a new instance of Themes.



5
6
7
# File 'lib/pageflow/themes.rb', line 5

def initialize
  @themes = HashWithIndifferentAccess.new
end

Instance Method Details

#each(&block) ⇒ Object



55
56
57
# File 'lib/pageflow/themes.rb', line 55

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

#get(name) ⇒ Object



47
48
49
# File 'lib/pageflow/themes.rb', line 47

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

#namesObject



51
52
53
# File 'lib/pageflow/themes.rb', line 51

def names
  map(&:name)
end

#register(name, options = {}) ⇒ Object

Register a theme and supply theme options.

Parameters:

  • name (Symbol)

    Used in conventional directory names.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :no_home_button (Boolean)

    Pass true if theme does not display home buttons in navigation bars.

  • :scroll_back_indicator (Boolean)

    Pass true if theme has styles for an indicator pointing to the previous page.

  • :scroll_indicator_modes (Boolean)

    Pass true if theme supports horizontal scroll indicators.

  • :emphasized_pages (Boolean)

    Pass true if theme has styles for emphasized pages in navigation bars.

  • :no_page_change_by_scrolling (Boolean)

    Pass true if changing the page by using the mouse wheel shall be deactivated.

  • :no_hide_text_on_swipe (Boolean)

    Pass true if hiding the text by swiping to left shall be deactivated on mobile devices.

  • :hide_logo_option (Boolean)

    Pass true if hiding the logo on specific pages should be supported as an option in the editor.

  • :logo_url (String)

    Pass logo url as string to turn the logo in navigation bar into a link.



43
44
45
# File 'lib/pageflow/themes.rb', line 43

def register(name, options = {})
  @themes[name] = Theme.new(name, options)
end