Module: BlogHelper
- Defined in:
- app/helpers/blog_helper.rb
Overview
View helper: blog.
Instance Method Summary collapse
-
#post_title(post) ⇒ String
Renders a linked, truncated blog post title.
-
#tags_with_links(post) ⇒ ActiveSupport::SafeBuffer
Renders a comma-separated list of links for a post's recognized tags.
Instance Method Details
#post_title(post) ⇒ String
Renders a linked, truncated blog post title.
8 9 10 |
# File 'app/helpers/blog_helper.rb', line 8 def post_title(post) link_to post.title[0..65], post_path(post) end |
#tags_with_links(post) ⇒ ActiveSupport::SafeBuffer
Renders a comma-separated list of links for a post's recognized tags.
Only tags included in Post::POST_TAGS are rendered; each links to the
tag's CMS archive page.
20 21 22 23 24 |
# File 'app/helpers/blog_helper.rb', line 20 def (post) post..select { |t| t.in?(Post::POST_TAGS) }.map do |t| link_to Post.tag_title(t), cms_link("/posts/#{t}/tag") end.join(', ').html_safe end |