Sha256: 5c9a6551224f13fdd85ae87e09a562e608011ad67814875e9e57ba873c3db4ee

Contents?: true

Size: 1016 Bytes

Versions: 5

Compression:

Stored size: 1016 Bytes

Contents

require 'singleton'

module Owl

  module Lib
    class Theme
      include Singleton

      THEMES_PATH             = 'themes'
      LAYOUTS_PATH            = 'layouts'
      PARTIALS_PATH           = 'partials'
      ASSETS_PATH             = 'assets'
      DEFAULT_THEME           = 'base'
      DEFAULT_PAGE_LAYOUT     = 'default'

      def current
        Owl::Lib::Settings.instance.settings['theme'] || DEFAULT_THEME
      end

      def layout(layout)
        layout = DEFAULT_PAGE_LAYOUT if layout.nil?

        Cabi.read([ path, LAYOUTS_PATH, layout ].join(':')) ||
        Cabi.read([ path, LAYOUTS_PATH, DEFAULT_PAGE_LAYOUT ].join(':')) ||
         "= yield"
      end

      def file_path
        Cabi.file( path ) 
      end

      def path
        [ THEMES_PATH, current ].join(':')
      end

      def theme_path
        Cabi.file( [path, ASSETS_PATH].join(':') ) 
      end

      def settings
        Cabi.read([ path, Owl::Lib::Settings::SETTINGS_PATH ].join(':'))
      end

    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
owl-cms-0.1.5 core/classes/theme.rb
owl-cms-0.1.3 core/classes/theme.rb
owl-cms-0.1.2 core/classes/theme.rb
owl-cms-0.1.1 core/classes/theme.rb
owl-cms-0.1.0 core/classes/theme.rb