Module: Merb::ApplicationHelper
- Defined in:
- app/helpers/application_helper.rb
Constant Summary collapse
- ROLE_STR =
"role"
- RECIPE_STR =
"recipe"
Instance Method Summary collapse
- #chef_version ⇒ Object
- #class_for_run_list_item(item) ⇒ Object
- #display_run_list_item(item) ⇒ Object
- #nav_link_item(title, dest) ⇒ Object
Instance Method Details
#chef_version ⇒ Object
11 12 13 |
# File 'app/helpers/application_helper.rb', line 11 def chef_version ::ChefServerWebui::VERSION end |
#class_for_run_list_item(item) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/application_helper.rb', line 15 def class_for_run_list_item(item) case item.type.to_s when ROLE_STR 'ui-state-highlight' when RECIPE_STR 'ui-state-default' else raise ArgumentError, "Cannot generate UI class for #{item.inspect}" end end |
#display_run_list_item(item) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/helpers/application_helper.rb', line 26 def display_run_list_item(item) case item.type.to_s when ROLE_STR item.name when RECIPE_STR # webui not sophisticated enough for versioned recipes # "#{item.name}@#{item.version}" item.name else raise ArgumentError, "can't generate display string for #{item.inspect}" end end |
#nav_link_item(title, dest) ⇒ Object
39 40 41 42 43 44 |
# File 'app/helpers/application_helper.rb', line 39 def nav_link_item(title, dest) name = title.gsub(/ /, "").downcase klass = controller_name == name ? 'class="active"' : "" link = link_to(title, url(dest)) "<li #{klass}>#{link}</li>" end |