Class: Joyride::TourBuilder

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TagHelper
Defined in:
lib/joyride/action_view_extensions.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts_from_helper) ⇒ TourBuilder

Returns a new instance of TourBuilder.



46
47
48
# File 'lib/joyride/action_view_extensions.rb', line 46

def initialize(opts_from_helper)
  @@class_to_apply_to_all = opts_from_helper[:class] ? opts_from_helper[:class] : ""
end

Instance Method Details

#step(*args) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/joyride/action_view_extensions.rb', line 50

def step(*args)
  opts = args.extract_options!

  html_opts = opts[:html] ? opts[:html] : {}
  html_opts['data-id'] = args[0]

  if html_opts[:class]
    html_opts[:class] = "#{@@class_to_apply_to_all} #{html_opts[:class]}"
  else
    html_opts[:class] = @@class_to_apply_to_all
  end

  (:li,args[1],html_opts)
end