Sha256: 81f7177de10669129916e718dd2058e852acec230160c4a90197e6a542e6a615

Contents?: true

Size: 578 Bytes

Versions: 2

Compression:

Stored size: 578 Bytes

Contents

module CmsHelper 
  
  def linked_tag_list(tags)
    tags.collect {|tag| link_to(tag.name, tag_posts_url(:tag_name => tag.name ))}.join(", ")
  end
  
  def post_link_list(limit = Spree::Config[:cms_posts_recent])
    link = Struct.new(:name,:url)
    Post.publish.limit(limit).collect { |post| link.new(post.title, post_path(post)) }
  end
  
  def page_link(id)
    if id.kind_of?(String)  
      page = Page.publish.find_by_permalink(id)
    elsif id.kind_of?(Fixnum)
      page = Page.publish.find(id)
    end
    link_to page.title, page.link unless page.nil?
  end
  
end 

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_cms-0.0.4 app/helpers/cms_helper.rb
spree_cms-0.0.3 app/helpers/cms_helper.rb