Class: Spina::Theme

Inherits:
Object
  • Object
show all
Defined in:
lib/spina/theme.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject

Returns the value of attribute config.



4
5
6
# File 'lib/spina/theme.rb', line 4

def config
  @config
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/spina/theme.rb', line 4

def name
  @name
end

#public_themeObject

Returns the value of attribute public_theme.



4
5
6
# File 'lib/spina/theme.rb', line 4

def public_theme
  @public_theme
end

Instance Method Details

#is_custom_undeletable_page?(view_template) ⇒ Boolean

Check if view_template is defined as a custom undeletable page

Returns:

  • (Boolean)


17
18
19
# File 'lib/spina/theme.rb', line 17

def is_custom_undeletable_page?(view_template)
  config.custom_pages.any? { |page| page[:view_template] == view_template && !page[:deletable] }
end

#new_page_templatesObject



10
11
12
13
14
# File 'lib/spina/theme.rb', line 10

def new_page_templates
  config.view_templates.map do |view_template|
    [view_template[0], view_template[1][:title], view_template[1][:description], view_template[1][:usage]] unless is_custom_undeletable_page?(view_template[0])
  end.compact
end

#to_sObject



6
7
8
# File 'lib/spina/theme.rb', line 6

def to_s
  name
end