Merge pull request #152 from jgrevich/master
live scope in blog_archive_list helper method
This commit is contained in:
commit
62c525e424
1 changed files with 3 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
module BlogPostsHelper
|
module BlogPostsHelper
|
||||||
def blog_archive_list
|
def blog_archive_list
|
||||||
posts = BlogPost.select('published_at').all_previous
|
posts = BlogPost.live.select('published_at').all_previous
|
||||||
return nil if posts.blank?
|
return nil if posts.blank?
|
||||||
html = '<section id="blog_archive_list"><h2>'
|
html = '<section id="blog_archive_list"><h2>'
|
||||||
html << t('archives', :scope => 'blog.shared')
|
html << t('archives', :scope => 'blog.shared')
|
||||||
|
@ -20,7 +20,7 @@ module BlogPostsHelper
|
||||||
links.each do |l|
|
links.each do |l|
|
||||||
year = l.split('/')[1]
|
year = l.split('/')[1]
|
||||||
month = l.split('/')[0]
|
month = l.split('/')[0]
|
||||||
count = BlogPost.by_archive(Time.parse(l)).size
|
count = BlogPost.live.by_archive(Time.parse(l)).size
|
||||||
text = t("date.month_names")[month.to_i] + " #{year} (#{count})"
|
text = t("date.month_names")[month.to_i] + " #{year} (#{count})"
|
||||||
html << "<li>"
|
html << "<li>"
|
||||||
html << link_to(text, archive_blog_posts_path(:year => year, :month => month))
|
html << link_to(text, archive_blog_posts_path(:year => year, :month => month))
|
||||||
|
@ -28,7 +28,7 @@ module BlogPostsHelper
|
||||||
end
|
end
|
||||||
super_old_links.each do |l|
|
super_old_links.each do |l|
|
||||||
year = l.split('/')[1]
|
year = l.split('/')[1]
|
||||||
count = BlogPost.by_year(Time.parse(l)).size
|
count = BlogPost.live.by_year(Time.parse(l)).size
|
||||||
text = "#{year} (#{count})"
|
text = "#{year} (#{count})"
|
||||||
html << "<li>"
|
html << "<li>"
|
||||||
html << link_to(text, archive_blog_posts_path(:year => year))
|
html << link_to(text, archive_blog_posts_path(:year => year))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue