Module: Voidtools::Sinatra::ViewHelpers

Defined in:
lib/voidtools/sinatra/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#image_tag(url, options = {}) ⇒ Object



14
15
16
# File 'lib/voidtools/sinatra/view_helpers.rb', line 14

def image_tag(url, options={})
  haml_tag :img, options.merge(src: url)
end


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)", options={})
  # haml_tag :a, { href: path } do
  #   haml_concat label
  # end
  options = options.map do |key, value|
    " #{key}='#{value}'"
  end.join(" ")
  haml_concat "<a href='#{path}'#{options}>#{label}</a>"
end