5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/spurs/modal/helper.rb', line 5
def spurs_modal(file_or_partial, object=nil, options={ })
opts = Spurs::Modal::default_options.merge(options)
builder_class = opts.delete(:builder)
builder = builder_class.new
modal_id = "modal_#{SecureRandom::hex(5)}"
options_for_content = options[:content_options] ? options.delete(:content_options) : { }
if object == nil
content = render :file => file_or_partial, :locals => options_for_content
else
content = render :object => object, :partial => file_or_partial, :locals => options_for_content
end
bm = builder.build_modal(modal_id, content, options)
end
|