Class: JqmHelper::NavBuilder
- Inherits:
-
Object
- Object
- JqmHelper::NavBuilder
- Includes:
- ActionView::Helpers::OutputSafetyHelper, ActionView::Helpers::TagHelper, JqmHelper
- Defined in:
- lib/jqm_helper/nav_builder.rb
Constant Summary collapse
- ACTIVE_CLASS =
'ui-btn-active'
Instance Method Summary collapse
- #button(action, options, title = nil) ⇒ Object
-
#initialize(active_action = '') ⇒ NavBuilder
constructor
A new instance of NavBuilder.
Methods included from JqmHelper
#back_button, #backward_button, #dialog_button, #forward_button, #jqm_button, #jqm_page, #make_options, #nav_for, #slider_tag
Constructor Details
#initialize(active_action = '') ⇒ NavBuilder
Returns a new instance of NavBuilder.
24 25 26 27 28 |
# File 'lib/jqm_helper/nav_builder.rb', line 24 def initialize(active_action = '') self.reverse_animation_direction = true @active_action = active_action.to_s # someday: we may be able to replace with rails current_page helper end |
Instance Method Details
#button(action, options, title = nil) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/jqm_helper/nav_builder.rb', line 30 def (action, , title = nil) if active = action.to_s == @active_action self.reverse_animation_direction = false end defaults = { :class => active ? ACTIVE_CLASS : '', :data => { :icon => action, } } # commented from trouble including named routes =/ #defaults[:href] = method("#{action}_path").call unless options[:href] # incase method 404 defaults[:data][:direction] = 'reverse' if self.reverse_animation_direction (title || action.capitalize, '', (defaults, )) end |