Sha256: 76d28fb01f51d2d1eb8e25d39b20c330cca6e81d563ee2527de54dfe7fb004a5
Contents?: true
Size: 1.37 KB
Versions: 5
Compression:
Stored size: 1.37 KB
Contents
module Spina class Theme attr_accessor :name, :title, :parts, :page_parts, :structures, :view_templates, :layout_parts, :custom_pages, :plugins, :public_theme, :config, :navigations, :resources class << self def all ::Spina::THEMES end def find_by_name(name) all.find { |theme| theme.name == name } end def register theme = ::Spina::Theme.new yield theme raise 'Missing theme name' if theme.name.nil? if theme.plugins.nil? theme.plugins = ::Spina::Plugin.all.map { |plugin| plugin.name } end all << theme end end def initialize @page_parts = [] @structures = [] @layout_parts = [] @view_templates = [] @custom_pages = [] @navigations = [] @resources = [] @public_theme = false end def new_page_templates @view_templates.map do |view_template| [view_template[:name], view_template[:title], view_template[:description], view_template[:usage]] unless is_custom_undeletable_page?(view_template[:name]) end.compact end # Check if view_template is defined as a custom undeletable page def is_custom_undeletable_page?(view_template) @custom_pages.any? { |page| page[:view_template] == view_template && !page[:deletable] } end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
spina-2.0.2 | lib/spina/theme.rb |
spina-2.0.1 | lib/spina/theme.rb |
spina-2.0.0 | lib/spina/theme.rb |
spina-2.0.0.beta | lib/spina/theme.rb |
spina-2.0.0.alpha | lib/spina/theme.rb |