Module: SimpleNavigation
- Defined in:
- lib/simple_navigation.rb,
lib/simple_navigation/item.rb,
lib/simple_navigation/helpers.rb,
lib/simple_navigation/configuration.rb,
lib/simple_navigation/renderer/base.rb,
lib/simple_navigation/renderer/list.rb,
lib/simple_navigation/item_container.rb,
lib/simple_navigation/controller_methods.rb
Overview
TODO: add :except and :only options to navigation method
Defined Under Namespace
Modules: ControllerMethods, Helpers, Renderer Classes: Configuration, Item, ItemContainer
Class Method Summary collapse
-
.config ⇒ Object
Returns the singleton instance of the SimpleNavigation::Configuration.
-
.config_file_name(navigation_context = :default) ⇒ Object
Returns the path to the config_file for the given navigation_context.
-
.load_config(navigation_context = :default) ⇒ Object
Reads the config_file for the specified navigation_context and stores it for later evaluation.
-
.primary_navigation ⇒ Object
Returns the ItemContainer that contains the items for the primary navigation.
Class Method Details
.config ⇒ Object
Returns the singleton instance of the SimpleNavigation::Configuration
32 33 34 |
# File 'lib/simple_navigation.rb', line 32 def config Configuration.instance end |
.config_file_name(navigation_context = :default) ⇒ Object
Returns the path to the config_file for the given navigation_context
42 43 44 45 |
# File 'lib/simple_navigation.rb', line 42 def config_file_name( = :default) file_name = == :default ? '' : "#{.to_s.underscore}_" File.join(config_file_path, "#{file_name}navigation.rb") end |
.load_config(navigation_context = :default) ⇒ Object
Reads the config_file for the specified navigation_context and stores it for later evaluation.
21 22 23 24 25 26 27 28 29 |
# File 'lib/simple_navigation.rb', line 21 def load_config( = :default) raise "config_file_path is not set!" unless self.config_file_path raise "Config file '#{config_file_name()}' does not exists!" unless File.exists?(config_file_name()) if ::RAILS_ENV == 'production' self.config_files[] ||= IO.read(config_file_name()) else self.config_files[] = IO.read(config_file_name()) end end |
.primary_navigation ⇒ Object
Returns the ItemContainer that contains the items for the primary navigation
37 38 39 |
# File 'lib/simple_navigation.rb', line 37 def config. end |