Module: NivoHelper
- Defined in:
- app/helpers/nivo_helper.rb
Instance Method Summary collapse
-
#nivo_slider(content_or_options = nil, options = {}, escape = false, &block) ⇒ Object
Convenient helper to create a div for your slider.
Instance Method Details
#nivo_slider(content_or_options = nil, options = {}, escape = false, &block) ⇒ Object
Convenient helper to create a div for your slider. The method’s definition is similar to Action View’s ‘content_tag` helper. It doesn’t escape the given content by default though.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/nivo_helper.rb', line 5 def ( = nil, = {}, escape = false, &block) # We are just keeping the two arguments to match Action View's # definition of `content_tag` but the first argument isn't # considered as the content if it's a Hash object. if .kind_of?(Hash) .merge!() end [:class] ? [:class] << " nivoSlider" : [:class] = "nivoSlider" [:id] ||= "slider" if .kind_of?(Hash) && !block_given? content_tag(:div, "", , escape) elsif block_given? content_tag(:div, capture(&block), , escape) else content_tag(:div, , , escape) end end |