Module: EaselHelpersLite::Helpers
- Defined in:
- lib/easel_helpers_lite/helpers.rb
Instance Method Summary collapse
Instance Method Details
#body(*args) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/easel_helpers_lite/helpers.rb', line 3 def body(*args) @_classes ||= [] @_classes += args.select(&:present?).map do |arg| arg.to_s.strip end.uniq if block_given? attributes = {} attributes[:class] = @_classes.join(" ") if @_classes.length > 0 content_tag(:body, capture {yield}, attributes) else nil end end |
#link_button(*args, &block) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/easel_helpers_lite/helpers.rb', line 18 def (*args, &block) doc = Nokogiri(link_to(*args, &block)) doc.at("a").inner_html = "<span>#{doc.at("a").inner_html}</span>" (doc/:a).add_class("btn") raw(doc.to_html) end |
#submit_button(*args, &block) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/easel_helpers_lite/helpers.rb', line 25 def (*args, &block) = args.first = args. klass = [:class] || "btn" content_tag("button", :type => "submit", :class => klass) do if block_given? yield else content_tag("span", ) end end end |