Sha256: 2dc90af4fb39cc374e5e7ef770f6145101402b713a3c35961969a990631973be

Contents?: true

Size: 944 Bytes

Versions: 11

Compression:

Stored size: 944 Bytes

Contents

module AbstractInterface 
  class Theme
    attr_writer :name, :layout_template, :layout    
    def name; @name || 'default' end    
    def layout; @layout || 'default' end
    
    def layout_template
      if @layout_template
        # Check if this template exists
        exists = layout_definitions.any?{|layout_name, ld| ld['layout_template'] == @layout_template}
        exists ? @layout_template : 'default'
      else
        layout_definition['layout_template'] || 'default'
      end
    end
    
    def layout_definition      
      layout_definitions[layout] || layout_definitions['default'] || {}
    end
    
    def layout_definitions
      if AbstractInterface.layouts_defined?
        AbstractInterface.layout_definitions(name)
      else
        {}
      end
    end
    
    def available_layouts_names
      layout_definitions.keys
    end

    def metadata
      AbstractInterface.theme_metadata(name)
    end
  end
end

Version data entries

11 entries across 11 versions & 4 rubygems

Version Path
abstract_interface-0.1.7 lib/abstract_interface/theme.rb
abstract_interface-0.1.6 lib/abstract_interface/theme.rb
abstract_interface-0.1.5 lib/abstract_interface/theme.rb
abstract_interface-0.1.3 lib/abstract_interface/theme.rb
abstract_interface-0.1.1 lib/abstract_interface/theme.rb
abstract_interface-0.1.0 lib/abstract_interface/theme.rb
abstract-interface-0.0.3 lib/abstract_interface/theme.rb
crystal-ext-0.0.3 lib/abstract_interface/theme.rb
crystal-ext-0.0.2 lib/abstract_interface/theme.rb
crystal-ext-0.0.1 lib/abstract_interface/theme.rb
rails-ext-0.3.29 lib/abstract_interface/theme.rb