1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00
middleman--middleman/lib/middleman/helpers.rb
2009-07-31 09:35:12 -07:00

16 lines
488 B
Ruby

Middleman.helpers do
def link_to(title, url="#", params={ :href => url })
params = params.map { |k,v| %Q{#{k}="#{v}"}}.join(' ')
%Q{<a #{params}>#{title}</a>}
end
def page_classes(*additional)
classes = []
parts = @full_request_path.split('.')[0].split('/')
parts.each_with_index { |path, i| classes << parts.first(i+1).join('_') }
classes << "index" if classes.empty?
classes += additional unless additional.empty?
classes.join(' ')
end
end