Module: Voidtools::Sinatra::ViewHelpers
- Defined in:
- lib/voidtools/sinatra/view_helpers.rb
Instance Method Summary collapse
- #image_tag(url, options = {}) ⇒ Object
- #link_to(label, path = "javascript:void(0)", options = {}) ⇒ Object
Instance Method Details
#image_tag(url, options = {}) ⇒ Object
14 15 16 |
# File 'lib/voidtools/sinatra/view_helpers.rb', line 14 def image_tag(url, ={}) haml_tag :img, .merge(src: url) end |
#link_to(label, path = "javascript:void(0)", options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/voidtools/sinatra/view_helpers.rb', line 4 def link_to(label, path="javascript:void(0)", ={}) # haml_tag :a, { href: path } do # haml_concat label # end = .map do |key, value| " #{key}='#{value}'" end.join(" ") haml_concat "<a href='#{path}'#{}>#{label}</a>" end |