tweak link_to
This commit is contained in:
parent
63997274e7
commit
261d345d52
|
@ -23,8 +23,9 @@ class Middleman < Sinatra::Base
|
||||||
helpers Sinatra::ContentFor
|
helpers Sinatra::ContentFor
|
||||||
|
|
||||||
helpers do
|
helpers do
|
||||||
def link_to(title, url="#")
|
def link_to(title, url="#", params={})
|
||||||
%Q{<a href="#{url}">#{title}</a>}
|
params = params.map { |k,v| %Q{#{k}="#{v}"}}.join(' ')
|
||||||
|
%Q{<a href="#{url}" #{params}>#{title}</a>}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue