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/abstract_interface.rb,
lib/abstract_interface/themed_form_helper.rb
Defined Under Namespace
Modules: ControllerHelper, ViewHelper Classes: HamlBuilder, Theme, ThemedFormHelper, ViewBuilder
Constant Summary collapse
- THEMES_DIR =
'themes'
Class Attribute Summary collapse
-
.layout_configurations_dir ⇒ Object
Returns the value of attribute layout_configurations_dir.
-
.plugin_name ⇒ Object
Returns the value of attribute plugin_name.
Class Method Summary collapse
- .available_themes ⇒ Object
- .generate_helper_methods(*args) ⇒ Object
-
.layout_definitions_without_cache(theme) ⇒ Object
Place definitions of your layouts into :layout_configurations_dir folder, you can have multiple such directories.
- .layouts_defined? ⇒ Boolean
- .theme_metadata(theme) ⇒ Object
Class Attribute Details
.layout_configurations_dir ⇒ Object
Returns the value of attribute layout_configurations_dir.
6 7 8 |
# File 'lib/abstract_interface/abstract_interface.rb', line 6 def layout_configurations_dir @layout_configurations_dir end |
.plugin_name ⇒ Object
Returns the value of attribute plugin_name.
5 6 7 |
# File 'lib/abstract_interface/abstract_interface.rb', line 5 def plugin_name @plugin_name end |
Class Method Details
.available_themes ⇒ Object
12 |
# File 'lib/abstract_interface/abstract_interface.rb', line 12 def available_themes; @available_themes ||= [] end |
.generate_helper_methods(*args) ⇒ Object
8 9 10 |
# File 'lib/abstract_interface/abstract_interface.rb', line 8 def generate_helper_methods *args AbstractInterface::ViewBuilder.generate_helper_methods *args end |
.layout_definitions_without_cache(theme) ⇒ Object
Place definitions of your layouts into :layout_configurations_dir folder, you can have multiple such directories
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/abstract_interface/abstract_interface.rb', line 35 def layout_definitions_without_cache theme name = "#{layout_configurations_dir.must_be.present}/#{theme}.yml" raise "File '#{name}' not exist!" unless environment.file_exist? name result = {} environment.find_files(name).each do |fname| lds = YAML.load_file(fname) validate_layout_definition!(lds, theme) result.merge! lds end result end |
.layouts_defined? ⇒ Boolean
30 31 32 |
# File 'lib/abstract_interface/abstract_interface.rb', line 30 def layouts_defined? !!layout_configurations_dir end |
.theme_metadata(theme) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/abstract_interface/abstract_interface.rb', line 14 def theme logger.warn "Complex calculation (AbstractInterface.theme_metadata) called in production!" if config.production? = {} name = "/#{Crystal::Template::DIRECTORY_NAME}/#{THEMES_DIR}/#{theme}/metadata.rb" if environment.file_exist? name fname = environment.find_file name code = File.read fname = eval code .must_be.a Hash end .to_openobject end |