Module: Blogit::PostsHelper
- Defined in:
- app/helpers/blogit/posts_helper.rb
Instance Method Summary collapse
-
#archive_list_for_posts(archive_posts) ⇒ Object
Creates a ul tag tree with posts by year and months.
-
#comments_for_post(post) ⇒ Object
Renders the comments for a Post based on the Configuration::include_comments configuration.
-
#related_posts_for_post(post) ⇒ Object
Returns the Posts that share one or more of the same tags for a given post.
-
#share_bar_for_post(post) ⇒ Object
Renders the comments for a JS share bar based on the Configuration::include_share_bar configuration.
Instance Method Details
#archive_list_for_posts(archive_posts) ⇒ Object
Creates a ul tag tree with posts by year and months. Include blogit/archive.js in your js to enabled expand collapse.
Examples
<%= archive_list_for_posts(@posts) %>
# => <div class="blogit_archive">
<ul class="blogit_archive__list blogit_archive__list--years">
...
</ul>
</div>
Returns an HTML safe String
43 44 45 |
# File 'app/helpers/blogit/posts_helper.rb', line 43 def archive_list_for_posts(archive_posts) render Blogit::Archive::List.new(archive_posts) end |
#comments_for_post(post) ⇒ Object
Renders the comments for a Blogit::Post based on the Configuration::include_comments configuration
8 9 10 11 12 |
# File 'app/helpers/blogit/posts_helper.rb', line 8 def comments_for_post(post) comment_type = Blogit.configuration.include_comments render(partial: "blogit/comments/#{comment_type}_comments", locals: { post: post, comment: Blogit::Comment.new }) end |
#related_posts_for_post(post) ⇒ Object
Returns the Posts that share one or more of the same tags for a given post
post - A Blogit::Post instance
Returns a collection of Posts
26 27 28 |
# File 'app/helpers/blogit/posts_helper.rb', line 26 def (post) post..active end |
#share_bar_for_post(post) ⇒ Object
Renders the comments for a JS share bar based on the Configuration::include_share_bar configuration
16 17 18 19 |
# File 'app/helpers/blogit/posts_helper.rb', line 16 def (post) return "" unless Blogit.configuration. render(partial: "blogit/posts/share_bar", locals: { post: post}) end |