Module: AbstractInterface

Defined in:
lib/abstract_interface.rb,
lib/abstract_interface/theme.rb,
lib/abstract_interface/view_helper.rb,
lib/abstract_interface/haml_builder.rb,
lib/abstract_interface/view_builder.rb,
lib/abstract_interface/controller_helper.rb,
lib/abstract_interface/form_builders/themed_form_builder.rb,
lib/abstract_interface/form_builders/abstract_form_builder.rb,
lib/abstract_interface/form_builders/themed_form_tag_builder.rb

Defined Under Namespace

Modules: ControllerHelper, FormBuilders, ViewHelper Classes: HamlBuilder, Theme, ViewBuilder

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.layout_configurations_dirObject

Returns the value of attribute layout_configurations_dir.



20
21
22
# File 'lib/abstract_interface.rb', line 20

def layout_configurations_dir
  @layout_configurations_dir
end

.plugin_nameObject

Returns the value of attribute plugin_name.



19
20
21
# File 'lib/abstract_interface.rb', line 19

def plugin_name
  @plugin_name
end

Class Method Details

.available_themesObject



26
# File 'lib/abstract_interface.rb', line 26

def available_themes; @available_themes ||= [] end

.generate_helper_methods(*args) ⇒ Object



22
23
24
# File 'lib/abstract_interface.rb', line 22

def generate_helper_methods *args
  AbstractInterface::ViewBuilder.generate_helper_methods *args
end

.layout_definitions(theme) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/abstract_interface.rb', line 52

def layout_definitions theme
  fname = "#{layout_configurations_dir.should_not_be!(:empty)}/#{theme}.yml"
  File.should! :exist?, fname
  lds = YAML.load_file(fname)
  validate_layout_definition!(lds, theme)
  lds
end

.layouts_defined?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/abstract_interface.rb', line 48

def layouts_defined?
  !!layout_configurations_dir
end

.theme_metadata(theme) ⇒ Object

TODO 3 don’t cache it becouse there’s a lots of text data that will be reside in memory.



32
33
34
35
36
37
38
39
40
41
# File 'lib/abstract_interface.rb', line 32

def  theme
   = {}
  fname = "#{AbstractInterface.themes_dir}/#{theme}/metadata.rb"
  if File.exist? fname
    code = File.read fname
     = eval code
    .should! :be_a, Hash        
  end
  .to_openobject
end

.themes_dirObject



44
45
46
# File 'lib/abstract_interface.rb', line 44

def themes_dir
  "#{RAILS_ROOT}/vendor/plugins/#{AbstractInterface.plugin_name.should_not_be!(:blank)}/app/views/themes"
end