Sha256: 19b2cc701fb7c8d3dae65d2a5d15e25166c778c190483d24554e61e83099bff9

Contents?: true

Size: 603 Bytes

Versions: 10

Compression:

Stored size: 603 Bytes

Contents

module Spina
  class Theme

    attr_accessor :name, :config

    def to_s
      name
    end

    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

    # Check if view_template is defined as a custom undeletable page
    def is_custom_undeletable_page?(view_template)
      config.custom_pages.any? { |page| page[:view_template] == view_template && !page[:deletable] }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spina-0.6.20 lib/spina/theme.rb
spina-0.6.19 lib/spina/theme.rb
spina-0.6.18 lib/spina/theme.rb
spina-0.6.17 lib/spina/theme.rb
spina-0.6.16 lib/spina/theme.rb
spina-0.6.15 lib/spina/theme.rb
spina-0.6.14 lib/spina/theme.rb
spina-0.6.13 lib/spina/theme.rb
spina-0.6.12 lib/spina/theme.rb
spina-0.6.11 lib/spina/theme.rb