9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/joyride/action_view_extensions.rb', line 9
def joyride(id, options,&block)
if options[:html] == nil
options[:html] = {}
end
opts = Joyride::ActionViewExtensions::default_options.merge(options)
opts_from_helper = {}
if opts[:tip_class]
opts_from_helper[:class] = opts[:tip_class]
end
builder = Joyride::TourBuilder.new(opts_from_helper)
output = capture(builder, &block)
class_str = !options[:html] || !options[:html][:class] ? "_joyride_tour" : "#{options[:html].delete(:class)} _joyride_tour"
mandatory_options = {:id => id, :class => class_str}
ht_opts = options[:html] ? mandatory_options.merge(options[:html]) : mandatory_options
use_cookie = options[:cookie] != nil && options[:cookie] == true
if use_cookie
ht_opts['data-cookie-enabled'] = true
end
ht_opts['data-animation'] = opts[:animation]
if opts[:post_tour_callback]
ht_opts['data-post-tour-callback'] = opts[:post_tour_callback]
end
if opts[:post_step_callback]
ht_opts['data-post-step-callback'] = opts[:post_step_callback]
end
content_tag(:ol,output,ht_opts)
end
|