7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/helpers/sexybutton_helper.rb', line 7
def sexybutton(text, url = nil)
tag_name = 'button'
btn = SexyButton.new
yield btn if block_given?
html_class = "sexybutton sexysimple sexy#{btn.color}"
if btn.style
html_class << " #{btn.style}"
end
html_options = btn.html_options.merge! :class => html_class
html_options.merge! :type => btn.type if btn.type
html_options.merge! :id => btn.id if btn.id
if url
html_options.merge! :href => url
tag_name = 'a'
end
content = btn.image ? content_tag(:span, text, :class => btn.image) : text
content_tag(tag_name, content, html_options)
end
|