diff options
Diffstat (limited to 'app/views/refinery/blog/posts')
-rw-r--r-- | app/views/refinery/blog/posts/_comment.html.erb | 10 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/_comments.html.erb | 40 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/_nav.html.erb | 17 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/_post.html.erb | 31 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/archive.html.erb | 15 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/index.html.erb | 20 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/index.rss.builder | 17 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/show.html.erb | 21 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/tagged.html.erb | 17 |
9 files changed, 188 insertions, 0 deletions
diff --git a/app/views/refinery/blog/posts/_comment.html.erb b/app/views/refinery/blog/posts/_comment.html.erb new file mode 100644 index 0000000..659f433 --- /dev/null +++ b/app/views/refinery/blog/posts/_comment.html.erb @@ -0,0 +1,10 @@ +<article class='blog_comment_message' id='<%= "comment-#{comment.to_param}" %>'> + <%= image_tag comment.avatar_url, :alt => comment.name, :class => 'avatar' %> + <%= simple_format auto_link(comment.message.to_s) %> + <footer class='blog_comment_author'> + <p> + <%= t('by', :scope => 'refinery.blog.posts.comments', :who => comment.name) %>, + <%= t('time_ago', :scope => 'refinery.blog.posts.comments', :time => time_ago_in_words(comment.created_at)) %> + </p> + </footer> +</article> diff --git a/app/views/refinery/blog/posts/_comments.html.erb b/app/views/refinery/blog/posts/_comments.html.erb new file mode 100644 index 0000000..9bc0a13 --- /dev/null +++ b/app/views/refinery/blog/posts/_comments.html.erb @@ -0,0 +1,40 @@ +<aside id="comments"> + <h2><%= t('title', :scope => 'refinery.blog.posts.show.comments') %></h2> + <% if (comments = @blog_post.comments.approved).any? %> + <%= render :partial => "comment", :collection => comments %> + <% else %> + <p> + <%= t('none', :scope => 'refinery.blog.shared.comments') %>. + </p> + <% end %> + + <% flash.each do |key, value| %> + <div id='flash' class="flash flash_<%= key %>"> + <%= value %> + </div> + <% end %> + + <h2><%= t('add', :scope => 'refinery.blog.posts.show.comments') %></h2> + <%= form_for [main_app, :blog_post, @blog_comment] do |f| %> + <%= render :partial => "/refinery/admin/error_messages", + :locals => { + :object => f.object, + :include_object_name => true + } %> + <div class='field'> + <%= f.label :name %> + <%= f.text_field :name %> + </div> + <div class='field'> + <%= f.label :email %> + <%= f.email_field :email %> + </div> + <div class='field message_field'> + <%= f.label :message %> + <%= f.text_area :message, :rows => 6 %> + </div> + <div class='field form-actions'> + <%= f.submit t('submit', :scope => 'refinery.blog.posts.show') %> + </div> + <% end %> +</aside> diff --git a/app/views/refinery/blog/posts/_nav.html.erb b/app/views/refinery/blog/posts/_nav.html.erb new file mode 100644 index 0000000..67aed14 --- /dev/null +++ b/app/views/refinery/blog/posts/_nav.html.erb @@ -0,0 +1,17 @@ +<nav id="next_prev_article"> + <% if @blog_post.next.present? -%> + <%= link_to (truncate(@blog_post.next.title) + " »").html_safe, + main_app.url_for(@blog_post.next), + :class => 'next' %> + <% end -%> + + <%= link_to t('blog_home', :scope => 'refinery.blog.posts.show'), + main_app.blog_root_path, + :class => 'home' %> + + <% if @blog_post.prev.present? -%> + <%= link_to ("« " + truncate(@blog_post.prev.title)).html_safe, + main_app.url_for(@blog_post.prev), + :class => 'prev' %> + <% end -%> +</nav><!-- /next_prev_article --> diff --git a/app/views/refinery/blog/posts/_post.html.erb b/app/views/refinery/blog/posts/_post.html.erb new file mode 100644 index 0000000..cbecc5f --- /dev/null +++ b/app/views/refinery/blog/posts/_post.html.erb @@ -0,0 +1,31 @@ +<% flash.each do |key, value| %> + <div id='flash' class="flash flash_<%= key %>"> + <%= value %> + </div> +<% end %> +<article id="blog_post"> + <header> + <h1><%= @blog_post.title %></h1> + <section class='details'> + <time datetime="<%=l @blog_post.published_at.to_date, :format => :default %>" class='posted_at'> + <%= t('created_at', :scope => 'refinery.blog.shared.posts', :when => l(@blog_post.published_at.to_date, :format => :short)) %> + </time> + <%= "#{t('by', :scope => 'refinery.blog.posts.show')} #{@blog_post.author.username}" if @blog_post.author.present? %>. + <% if (categories = @blog_post.categories).any? %> + <aside class='filed_in'> + <%= t('filed_in', :scope => 'refinery.blog.posts.show') %> + <% categories.each_with_index do |category, index| %> + <%= link_to category.title, main_app.blog_category_path(category) -%><%= ',' if index < ((categories.length) - 1) %> + <% end %> + </aside> + <% end %> + </section> + </header> + <%= @blog_post.body.html_safe %> + + <% if Refinery::Blog::Post::ShareThis.enabled? %> + <span class="st_sharethis" displayText="ShareThis"></span> + <% end %> +</article> +<%= render :partial => '/refinery/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%> +<%= render 'nav' if next_or_previous?(@blog_post) %> diff --git a/app/views/refinery/blog/posts/archive.html.erb b/app/views/refinery/blog/posts/archive.html.erb new file mode 100644 index 0000000..c7a2c92 --- /dev/null +++ b/app/views/refinery/blog/posts/archive.html.erb @@ -0,0 +1,15 @@ +<% content_for :body_content_left do %> + <h1><%= t('.blog_archive_for', :date => @archive_date.strftime('%B %Y')) %></h1> + <% if @blog_posts.any? %> + <section id="blog_posts"> + <%= render :partial => "/refinery/blog/shared/post", :collection => @blog_posts %> + </section> + <% else %> + <p><%= t('.no_blog_articles_posted', :date => @archive_date.strftime('%B %Y')) %></p> + <% end %> +<% end %> + +<%= render :partial => '/refinery/blog/shared/body_content_right' %> + +<%= render :partial => "/refinery/content_page" %> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> diff --git a/app/views/refinery/blog/posts/index.html.erb b/app/views/refinery/blog/posts/index.html.erb new file mode 100644 index 0000000..4eef04f --- /dev/null +++ b/app/views/refinery/blog/posts/index.html.erb @@ -0,0 +1,20 @@ +<% content_for :body_content_left do %> + <%=raw @page[::Refinery::Page.default_parts.first.to_sym] if ::Refinery::Page.default_parts.any? %> + + <% if @blog_posts.any? %> + <section id="blog_posts"> + <%= render :partial => "/refinery/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_prepend do -%> + <%= raw @page[::Refinery::Page.default_parts.second.to_sym] if ::Refinery::Page.default_parts.many? %> +<% end -%> +<%= render :partial => '/refinery/blog/shared/body_content_right' %> + +<%= render :partial => "/refinery/content_page" %> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> diff --git a/app/views/refinery/blog/posts/index.rss.builder b/app/views/refinery/blog/posts/index.rss.builder new file mode 100644 index 0000000..8cd89b7 --- /dev/null +++ b/app/views/refinery/blog/posts/index.rss.builder @@ -0,0 +1,17 @@ +xml.instruct! :xml, :version => "1.0" +xml.rss :version => "2.0" do + xml.channel do + xml.title ::Refinery::Setting.find_or_set(:site_name, "Company Name") + xml.description ::Refinery::Setting.find_or_set(:site_name, "Company Name") + " Blog Posts" + xml.link main_app.blog_root_url + + @blog_posts.each do |post| + xml.item do + xml.title post.title + xml.description post.body + xml.pubDate post.published_at.to_s(:rfc822) + xml.link main_app.blog_post_url(post) + end + end + end +end
\ No newline at end of file diff --git a/app/views/refinery/blog/posts/show.html.erb b/app/views/refinery/blog/posts/show.html.erb new file mode 100644 index 0000000..2ca168e --- /dev/null +++ b/app/views/refinery/blog/posts/show.html.erb @@ -0,0 +1,21 @@ +<% content_for :body_content_left do %> + <div id="show_blog_post"> + <%= render 'post' %> + </div> + + <% if Refinery::Blog::Post.comments_allowed? %> + <%= render 'comments'%> + <% end %> +<% end %> + +<%= render :partial => '/refinery/blog/shared/body_content_right' %> + +<%= render :partial => "/refinery/content_page", :locals => { :remove_automatic_sections => true } %> + +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> +<% content_for :javascripts do %> + <%# enable AJAX'd post nav at your own risk until html5 history API implemented. %> + <%#= javascript_include_tag('refinery/blog/frontend') %> + <script src="http://w.sharethis.com/button/buttons.js"></script> + <script>stLight.options({publisher:'<%= Blog::Post::ShareThis.key %>'});</script> +<% end if Refinery::Blog::Post::ShareThis.enabled? %> diff --git a/app/views/refinery/blog/posts/tagged.html.erb b/app/views/refinery/blog/posts/tagged.html.erb new file mode 100644 index 0000000..477d2b7 --- /dev/null +++ b/app/views/refinery/blog/posts/tagged.html.erb @@ -0,0 +1,17 @@ +<% content_for :body_content_title, "#{t('.posts_tagged')} “#{@tag_name.titleize}”".html_safe -%> + +<% content_for :body_content_left do %> + <% if @blog_posts.any? %> + <section id="blog_posts"> + <%= render :partial => "/refinery/blog/shared/post", :collection => @blog_posts %> + <%= will_paginate @blog_posts %> + </section> + <% else %> + <p><%= t('.no_blog_articles_yet') %></p> + <% end %> +<% end %> + +<%= render :partial => '/refinery/blog/shared/body_content_right' %> + +<%= render :partial => "/refinery/content_page" %> +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> |