Sha256: 22df25b41729533cd568e7f42708d14c5c021ce03cf9b65eb991fb8b4c205712

Contents?: true

Size: 488 Bytes

Versions: 2

Compression:

Stored size: 488 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
tdreyno-middleman-0.2.8 lib/middleman/helpers.rb
middleman-0.2.8 lib/middleman/helpers.rb