Sha256: 32ded01394b9fed280ec81367b4d3b9ffff3170618383bea1596fa1ff5c7bb78

Contents?: true

Size: 568 Bytes

Versions: 4

Compression:

Stored size: 568 Bytes

Contents

Middleman.helpers do
  def link_to(title, url="#", params={})
    params.merge!(: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
  
  def asset_url(path, tld_length = 1)
    "/#{path}"
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
tdreyno-middleman-0.3.0 lib/middleman/helpers.rb
tdreyno-middleman-0.3.1 lib/middleman/helpers.rb
middleman-0.3.0 lib/middleman/helpers.rb
middleman-0.3.1 lib/middleman/helpers.rb