diff options
Diffstat (limited to 'app/views/blog')
-rw-r--r-- | app/views/blog/posts/_post.html.erb | 2 | ||||
-rw-r--r-- | app/views/blog/posts/archive.html.erb | 3 | ||||
-rw-r--r-- | app/views/blog/posts/index.html.erb | 6 | ||||
-rw-r--r-- | app/views/blog/posts/show.html.erb | 8 | ||||
-rw-r--r-- | app/views/blog/posts/tagged.html.erb | 22 | ||||
-rw-r--r-- | app/views/blog/shared/_categories.html.erb | 18 | ||||
-rw-r--r-- | app/views/blog/shared/_post.html.erb | 23 | ||||
-rw-r--r-- | app/views/blog/shared/_posts.html.erb | 18 | ||||
-rw-r--r-- | app/views/blog/shared/_tags.html.erb | 8 |
9 files changed, 75 insertions, 33 deletions
diff --git a/app/views/blog/posts/_post.html.erb b/app/views/blog/posts/_post.html.erb index 6a16631..d1c204e 100644 --- a/app/views/blog/posts/_post.html.erb +++ b/app/views/blog/posts/_post.html.erb @@ -9,7 +9,7 @@ <details> <time datetime="<%=l @blog_post.published_at.to_date, :format => :default %>" class='posted_at'> <%= t('blog.shared.posts.created_at', :when => l(@blog_post.published_at.to_date, :format => :short)) %>. - </time> + </time><%= " by #{@blog_post.author.username}" if @blog_post.author.present? %> <% if (categories = @blog_post.categories).any? %> <aside class='filed_in'> <%= t('blog.posts.show.filed_in') %> diff --git a/app/views/blog/posts/archive.html.erb b/app/views/blog/posts/archive.html.erb index d44aa7f..a2044e8 100644 --- a/app/views/blog/posts/archive.html.erb +++ b/app/views/blog/posts/archive.html.erb @@ -1,5 +1,4 @@ <% content_for :body_content_left do %> - <%= @page[Page.default_parts.first.to_sym] %> <h1><%= t('.blog_archive_for', :date => @archive_date.strftime('%B %Y')) %></h1> <% if @blog_posts.any? %> <section id="blog_posts"> @@ -11,8 +10,8 @@ <% end %> <% content_for :body_content_right do %> - <%= @page[Page.default_parts.second.to_sym] %> <%= render :partial => "/blog/shared/categories" %> + <%= render :partial => "/blog/shared/tags" %> <%= render :partial => "/blog/shared/rss_feed" %> <%= blog_archive_list %> <% end %> diff --git a/app/views/blog/posts/index.html.erb b/app/views/blog/posts/index.html.erb index 766d689..8c3801a 100644 --- a/app/views/blog/posts/index.html.erb +++ b/app/views/blog/posts/index.html.erb @@ -1,9 +1,10 @@ <% content_for :body_content_left do %> - <%= @page[Page.default_parts.first.to_sym].html_safe if Page.default_parts.any? %> + <%=raw @page[Page.default_parts.first.to_sym] if Page.default_parts.any? %> <% if @blog_posts.any? %> <section id="blog_posts"> <%= render :partial => "/blog/shared/post", :collection => @blog_posts %> + <%= will_paginate @blog_posts %> </section> <% else %> <p><%= t('.no_blog_articles_yet') %></p> @@ -11,9 +12,10 @@ <% end %> <% content_for :body_content_right do %> - <%= @page[Page.default_parts.second.to_sym].html_safe if Page.default_parts.many? %> + <%=raw @page[Page.default_parts.second.to_sym] if Page.default_parts.many? %> <%= render :partial => "/blog/shared/categories" %> + <%= render :partial => "/blog/shared/tags" %> <%= render :partial => "/blog/shared/rss_feed" %> <%= blog_archive_list %> <% end %> diff --git a/app/views/blog/posts/show.html.erb b/app/views/blog/posts/show.html.erb index 5ac4c76..92898a4 100644 --- a/app/views/blog/posts/show.html.erb +++ b/app/views/blog/posts/show.html.erb @@ -6,7 +6,6 @@ <% if BlogPost.comments_allowed? %> <aside id="comments"> <h2><%= t('.comments.title') %></h2> - <% if (comments = @blog_post.comments.approved).any? %> <%= render :partial => "comment", :collection => comments %> <% else %> @@ -50,6 +49,7 @@ <% content_for :body_content_right do %> <%= render :partial => "/blog/shared/categories" %> + <%= render :partial => "/blog/shared/tags" %> <%= render :partial => "/blog/shared/posts" %> <%= render :partial => "/blog/shared/rss_feed" %> <%= blog_archive_list %> @@ -61,7 +61,8 @@ <% content_for :head_libraries, jquery_include_tags(:jquery_ui => false) %> <% content_for :head do %> <%= stylesheet_link_tag 'refinerycms-blog' %> - <%= javascript_include_tag('refinerycms-blog') %> + <%# enable AJAX'd post nav at your own risk until html5 history API implemented. %> + <%#= javascript_include_tag('refinerycms-blog') %> <% if BlogPost::ShareThis.enabled? %> <script src="http://w.sharethis.com/button/buttons.js"></script> <script>stLight.options({publisher:'<%= BlogPost::ShareThis.key %>'});</script> @@ -71,7 +72,8 @@ <% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> <% content_for :before_javascript_libraries, jquery_include_tags(:jquery_ui => false) %> <% content_for :javascripts do %> - <%= javascript_include_tag 'refinerycms-blog' %> + <%# enable AJAX'd post nav at your own risk until html5 history API implemented. %> + <%#= javascript_include_tag('refinerycms-blog') %> <script src="http://w.sharethis.com/button/buttons.js"></script> <script>stLight.options({publisher:'<%= BlogPost::ShareThis.key %>'});</script> <% end if BlogPost::ShareThis.enabled? %> diff --git a/app/views/blog/posts/tagged.html.erb b/app/views/blog/posts/tagged.html.erb new file mode 100644 index 0000000..29de791 --- /dev/null +++ b/app/views/blog/posts/tagged.html.erb @@ -0,0 +1,22 @@ +<% content_for :body_content_title, "Posts tagged “#{@tag_name.titleize}”".html_safe -%> + +<% content_for :body_content_left do %> + <% if @blog_posts.any? %> + <section id="blog_posts"> + <%= render :partial => "/blog/shared/post", :collection => @blog_posts %> + <%= will_paginate @blog_posts %> + </section> + <% else %> + <p><%= t('.no_blog_articles_yet') %></p> + <% end %> +<% end %> + +<% content_for :body_content_right do %> + <%= render :partial => "/blog/shared/categories" %> + <%= render :partial => "/blog/shared/tags" %> + <%= render :partial => "/blog/shared/rss_feed" %> + <%= blog_archive_list %> +<% end %> + +<%= render :partial => "/shared/content_page" %> +<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> diff --git a/app/views/blog/shared/_categories.html.erb b/app/views/blog/shared/_categories.html.erb index 675271c..05cc53f 100644 --- a/app/views/blog/shared/_categories.html.erb +++ b/app/views/blog/shared/_categories.html.erb @@ -1,8 +1,10 @@ -<h2><%= t('.title') %></h2> -<ul id='categories'> - <% @blog_categories.each do |category| %> - <li<%= " class='selected'" if @category.present? and @category.id == category.id %>> - <%= link_to "#{category.title} (#{category.post_count})", blog_category_url(category) %> - </li> - <% end %> -</ul> +<% if @blog_categories.any? %> + <h2><%= t('.title') %></h2> + <ul id='categories'> + <% @blog_categories.each do |category| %> + <li<%= " class='selected'" if @category.present? and @category.id == category.id %>> + <%= link_to "#{category.title} (#{category.post_count})", blog_category_url(category) %> + </li> + <% end %> + </ul> +<% end %>
\ No newline at end of file diff --git a/app/views/blog/shared/_post.html.erb b/app/views/blog/shared/_post.html.erb index 16483a5..716c1ad 100644 --- a/app/views/blog/shared/_post.html.erb +++ b/app/views/blog/shared/_post.html.erb @@ -5,13 +5,17 @@ <details> <time datetime="<%=l post.published_at.to_date, :format => :default %>" class='posted_at'> <%= t('blog.shared.posts.created_at', :when => l(post.published_at.to_date, :format => :short)) %>. - </time> + </time><%= " by #{post.author.username}" if post.author.present? %> <% if (categories = post.categories).any? %> <aside class='filed_in'> <%= t('filed_in', :scope => 'blog.posts.show') %> - <% categories.each_with_index do |category, index| %> - <%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %> - <% end %> + <%=raw categories.collect { |category| link_to category.title, blog_category_url(category) }.to_sentence %> + </aside> + <% end %> + <% if (tags = post.tag_list).any? %> + <aside class='tagged'> + <%= t('tagged', :scope => 'blog.posts.show') %> + <%=raw tags.collect { |tag| link_to tag, tagged_posts_path(tag.parameterize) }.to_sentence %> </aside> <% end %> </details> @@ -24,15 +28,16 @@ <footer> <p> <%= link_to t('blog.shared.posts.read_more'), blog_post_url(post) %> - - <aside class='comment_count'> + </p> + <aside class='comment_count'> + <% if BlogPost.comments_allowed? %> <% if post.comments.any? %> (<%= pluralize(post.comments.approved.count, t('blog.shared.comments.singular')) %>) <% else %> - (<%= t('blog.shared.comments.none') %>) + (<%= t('blog.shared.comments.none') %>) <% end %> - </aside> - </p> + <% end %> + </aside> </footer> </article> <% end %> diff --git a/app/views/blog/shared/_posts.html.erb b/app/views/blog/shared/_posts.html.erb index cbf865f..24a8199 100644 --- a/app/views/blog/shared/_posts.html.erb +++ b/app/views/blog/shared/_posts.html.erb @@ -1,8 +1,10 @@ -<h2><%= t('.other') %></h2> -<ul id="blog_posts"> - <% @blog_posts.each do |blog_post| %> - <li class='clearfix'> - <%= link_to blog_post.title, blog_post_url(blog_post) %> - </li> - <% end %> -</ul> +<% if @blog_posts.many? %> + <h2><%= t('.other') %></h2> + <ul id="blog_posts"> + <% @blog_posts.each do |blog_post| %> + <li class='clearfix'> + <%= link_to blog_post.title, blog_post_url(blog_post) %> + </li> + <% end %> + </ul> +<% end %>
\ No newline at end of file diff --git a/app/views/blog/shared/_tags.html.erb b/app/views/blog/shared/_tags.html.erb new file mode 100644 index 0000000..f8833f1 --- /dev/null +++ b/app/views/blog/shared/_tags.html.erb @@ -0,0 +1,8 @@ +<% unless @tags.nil? %> + <h2><%= t('.title') %></h2> + <nav id='tags'> + <% tag_cloud(@tags, %w(tag1 tag2 tag3 tag4)) do |tag, css_class| %> + <%= link_to tag.name, tagged_posts_path(tag.name.parameterize), :class => css_class %> + <% end %> + </nav> +<% end %>
\ No newline at end of file |