diff options
Diffstat (limited to 'app/views/blog')
-rw-r--r-- | app/views/blog/categories/show.html.erb | 20 | ||||
-rw-r--r-- | app/views/blog/posts/_comment.html.erb | 9 | ||||
-rw-r--r-- | app/views/blog/posts/index.html.erb | 16 | ||||
-rw-r--r-- | app/views/blog/posts/show.html.erb | 71 | ||||
-rw-r--r-- | app/views/blog/shared/_categories.html.erb | 8 | ||||
-rw-r--r-- | app/views/blog/shared/_post.html.erb | 20 | ||||
-rw-r--r-- | app/views/blog/shared/_posts.html.erb | 8 |
7 files changed, 152 insertions, 0 deletions
diff --git a/app/views/blog/categories/show.html.erb b/app/views/blog/categories/show.html.erb new file mode 100644 index 0000000..bd9f863 --- /dev/null +++ b/app/views/blog/categories/show.html.erb @@ -0,0 +1,20 @@ +<% content_for :body_content_title, @category.title %> + +<% content_for :body_content_left do %> + <% if @category.posts.any? %> + <ul id="blog_posts"> + <%= render :partial => "/blog/shared/post", :collection => @category.posts %> + </ul> + <% else %> + <p> + <%= t('.no_posts') %> + </p> + <% end %> +<% end %> + +<% content_for :body_content_right do %> + <%= render :partial => "/blog/shared/categories" %> +<% end %> + +<%= render :partial => "/shared/content_page" %> +<% content_for :head, stylesheet_link_tag('refinerycms-blog') %>
\ No newline at end of file diff --git a/app/views/blog/posts/_comment.html.erb b/app/views/blog/posts/_comment.html.erb new file mode 100644 index 0000000..559757b --- /dev/null +++ b/app/views/blog/posts/_comment.html.erb @@ -0,0 +1,9 @@ +<div class='blog_comment_message' id='<%= "comment-#{comment.to_param}" %>'> + <p> + <%= comment.message.to_s.gsub("\r\n\r\n", "</p><p>").gsub("\r\n", "<br/>") %> + </p> +</div> +<p class='blog_comment_author'> + <%= t('.by', :who => comment.name) %> + <%= t('.time_ago', :time => time_ago_in_words(comment.created_at)) %> +</p>
\ No newline at end of file diff --git a/app/views/blog/posts/index.html.erb b/app/views/blog/posts/index.html.erb new file mode 100644 index 0000000..f2ccbd8 --- /dev/null +++ b/app/views/blog/posts/index.html.erb @@ -0,0 +1,16 @@ +<% content_for :body_content_left do %> + <%= @page[Page.default_parts.first.to_sym] %> + + <ul id="blog_posts"> + <%= render :partial => "/blog/shared/post", :collection => @blog_posts %> + </ul> +<% end %> + +<% content_for :body_content_right do %> + <%= @page[Page.default_parts.second.to_sym] %> + + <%= render :partial => "/blog/shared/categories" %> +<% end %> + +<%= render :partial => "/shared/content_page" %> +<% content_for :head, stylesheet_link_tag('refinerycms-blog') %>
\ No newline at end of file diff --git a/app/views/blog/posts/show.html.erb b/app/views/blog/posts/show.html.erb new file mode 100644 index 0000000..5b897ad --- /dev/null +++ b/app/views/blog/posts/show.html.erb @@ -0,0 +1,71 @@ +<% content_for :body_content_title, @blog_post.title %> + +<% content_for :body_content_left do %> + <p class='posted_at'> + <%= t('blog.shared.posts.created_at', :when => @blog_post.created_at.strftime('%d %B %Y')) %>. + + <% if (categories = @blog_post.categories).any? %> + <span class='filed_in'> + <%= t('.filed_in') %> + <% categories.each_with_index do |category, index| %> + <%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %> + <% end %> + </span> + <% end %> + </p> + <%= @blog_post.body %> + + <% if BlogPost.comments_allowed? %> + <h2><%= t('.comments.title') %></h2> + + <% if (comments = @blog_post.comments.approved).any? %> + <%= render :partial => "comment", :collection => comments %> + <% else %> + <p> + <%= t('blog.shared.comments.none') %>. + </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| %> + <% if Rails.version < '3.0.0'%> + <%= f.error_messages %> + <% else %> + <%= render :partial => "/shared/admin/error_messages", + :locals => { + :object => f.object, + :include_object_name => true + } %> + <% end %> + <div class='field'> + <%= f.label :name %> + <%= f.text_field :name %> + </div> + <div class='field'> + <%= f.label :email %> + <%= f.text_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 %> + <% end %> +<% end %> + +<% content_for :body_content_right do %> + <%= render :partial => "/blog/shared/categories" %> + <%= render :partial => "/blog/shared/posts" %> +<% end %> + +<%= render :partial => "/shared/content_page" %> +<% content_for :head, stylesheet_link_tag('refinerycms-blog') %>
\ No newline at end of file diff --git a/app/views/blog/shared/_categories.html.erb b/app/views/blog/shared/_categories.html.erb new file mode 100644 index 0000000..fa26ceb --- /dev/null +++ b/app/views/blog/shared/_categories.html.erb @@ -0,0 +1,8 @@ +<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.posts.count})", blog_category_url(category) %> + </li> + <% end %> +</ul>
\ No newline at end of file diff --git a/app/views/blog/shared/_post.html.erb b/app/views/blog/shared/_post.html.erb new file mode 100644 index 0000000..d8194d3 --- /dev/null +++ b/app/views/blog/shared/_post.html.erb @@ -0,0 +1,20 @@ +<li> + <h2><%= link_to post.title, blog_post_url(post) %></h2> + <p class='posted_at'> + <%= t('blog.shared.posts.created_at', :when => post.created_at.strftime('%d %B %Y')) %> + </p> + <%= truncate(post.body, + :length => RefinerySetting.find_or_set(:blog_post_teaser_length, 250), + :preserve_html_tags => true) %> + <p> + <%= link_to t('blog.shared.posts.read_more'), blog_post_url(post) %> + + <span class='comment_count'> + <% if post.comments.any? %> + (<%= pluralize(post.comments.count, t('blog.shared.comments.singular')) %>) + <% else %> + (<%= t('blog.shared.comments.none') %>) + <% end %> + </span> + </p> +</li>
\ No newline at end of file diff --git a/app/views/blog/shared/_posts.html.erb b/app/views/blog/shared/_posts.html.erb new file mode 100644 index 0000000..4a78334 --- /dev/null +++ b/app/views/blog/shared/_posts.html.erb @@ -0,0 +1,8 @@ +<h2><%= t('.other') %></h2> +<ul id="blog_posts"> + <% @blog_posts.each do |blog_post| %> + <li> + <%= link_to blog_post.title, blog_post_url(blog_post) %> + </li> + <% end %> +</ul>
\ No newline at end of file |