diff options
author | Uģis Ozols <ugis.ozolss@gmail.com> | 2011-07-27 17:28:09 +0300 |
---|---|---|
committer | Uģis Ozols <ugis.ozolss@gmail.com> | 2011-07-27 17:28:09 +0300 |
commit | 06071e558008477e1b8dbb376d6693af97eeff32 (patch) | |
tree | 0ed1e765b37975fbbd054b058a45712ee7464c73 /app/views/refinery/blog/posts | |
parent | 3fa8937b95a4d90000ad1be9c588424052136455 (diff) | |
download | refinerycms-blog-06071e558008477e1b8dbb376d6693af97eeff32.tar.gz refinerycms-blog-06071e558008477e1b8dbb376d6693af97eeff32.tar.bz2 refinerycms-blog-06071e558008477e1b8dbb376d6693af97eeff32.zip |
Wip.
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/_nav.html.erb | 11 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/_post.html.erb | 31 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/archive.html.erb | 20 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/index.html.erb | 24 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/index.rss.builder | 17 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/show.html.erb | 67 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/tagged.html.erb | 22 |
8 files changed, 202 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..5503826 --- /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 => 'blog.posts.comments', :who => comment.name) %>, + <%= t('time_ago', :scope => 'blog.posts.comments', :time => time_ago_in_words(comment.created_at)) %> + </p> + </footer> +</article> 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..df4b435 --- /dev/null +++ b/app/views/refinery/blog/posts/_nav.html.erb @@ -0,0 +1,11 @@ +<nav id="next_prev_article"> + <% if @blog_post.next.present? -%> + <%= link_to (truncate(@blog_post.next.title) + " »").html_safe, @blog_post.next, :class => 'next' %> + <% end -%> + + <%= link_to t('blog_home', :scope => 'blog.posts.show'), blog_root_path, :class => 'home' %> + + <% if @blog_post.prev.present? -%> + <%= link_to ("« " + truncate(@blog_post.prev.title)).html_safe, @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..12978d3 --- /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 => 'blog.shared.posts', :when => l(@blog_post.published_at.to_date, :format => :short)) %> + </time> + <%= "#{t('by', :scope => '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 => 'blog.posts.show') %> + <% categories.each_with_index do |category, index| %> + <%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %> + <% end %> + </aside> + <% end %> + </section> + </header> + <%= @blog_post.body.html_safe %> + + <% if BlogPost::ShareThis.enabled? %> + <span class="st_sharethis" displayText="ShareThis"></span> + <% end %> +</article> +<%= render :partial => '/shared/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..a2044e8 --- /dev/null +++ b/app/views/refinery/blog/posts/archive.html.erb @@ -0,0 +1,20 @@ +<% 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 => "/blog/shared/post", :collection => @blog_posts %> + </section> + <% else %> + <p><%= t('.no_blog_articles_posted', :date => @archive_date.strftime('%B %Y')) %></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/refinery/blog/posts/index.html.erb b/app/views/refinery/blog/posts/index.html.erb new file mode 100644 index 0000000..8c3801a --- /dev/null +++ b/app/views/refinery/blog/posts/index.html.erb @@ -0,0 +1,24 @@ +<% content_for :body_content_left do %> + <%=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> + <% end %> +<% end %> + +<% content_for :body_content_right do %> + <%=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 %> + +<%= render :partial => "/shared/content_page" %> +<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> 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..51fa4da --- /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 RefinerySetting.find_or_set(:site_name, "Company Name") + xml.description RefinerySetting.find_or_set(:site_name, "Company Name") + " Blog Posts" + xml.link 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 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..cc763a8 --- /dev/null +++ b/app/views/refinery/blog/posts/show.html.erb @@ -0,0 +1,67 @@ +<% content_for :body_content_left do %> + <div id="show_blog_post"> + <%= render 'post' %> + </div> + + <% 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 %> + <p> + <%= t('none', :scope => 'blog.shared.comments') %>. + </p> + <% end %> + + <% flash.each do |key, value| %> + <div id='flash' class="flash flash_<%= key %>"> + <%= value %> + </div> + <% end %> + + <h2><%= t('.comments.add') %></h2> + <%= form_for [:blog_post, @blog_comment] do |f| %> + <%= render :partial => "/shared/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') %> + </div> + <% end %> + </aside> + <% end %> +<% end %> + +<% 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 %> +<% end %> + +<%= render :partial => "/shared/content_page", :locals => { :remove_automatic_sections => true } %> + +<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> +<% content_for :before_javascript_libraries, jquery_include_tags(:jquery_ui => false) %> +<% content_for :javascripts do %> + <%# 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/refinery/blog/posts/tagged.html.erb b/app/views/refinery/blog/posts/tagged.html.erb new file mode 100644 index 0000000..904150f --- /dev/null +++ b/app/views/refinery/blog/posts/tagged.html.erb @@ -0,0 +1,22 @@ +<% 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 => "/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') %> |