Module: CmsHelper

Defined in:
app/helpers/cms_helper.rb

Instance Method Summary collapse

Instance Method Details

#linked_tag_list(tags) ⇒ Object



3
4
5
# File 'app/helpers/cms_helper.rb', line 3

def linked_tag_list(tags)
  tags.collect {|tag| link_to(tag.name, tag_posts_url(:tag_name => tag.name ))}.join(", ")
end


12
13
14
15
16
17
18
19
# File 'app/helpers/cms_helper.rb', line 12

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

#post_link_list(limit = Spree::Config[:cms_posts_recent]) ⇒ Object



7
8
9
10
# File 'app/helpers/cms_helper.rb', line 7

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