Consistent whitespace.

This commit is contained in:
Philip Arndt 2010-11-23 09:34:11 +13:00
parent 8b1fd44831
commit 97101633ca
39 changed files with 61 additions and 61 deletions

View file

@ -3,5 +3,5 @@ class Blog::CategoriesController < BlogController
def show def show
@category = BlogCategory.find(params[:id]) @category = BlogCategory.find(params[:id])
end end
end end

View file

@ -1,8 +1,8 @@
class Blog::PostsController < BlogController class Blog::PostsController < BlogController
before_filter :find_all_blog_posts, :except => [:archive] before_filter :find_all_blog_posts, :except => [:archive]
before_filter :find_blog_post, :only => [:show, :comment, :update_nav] before_filter :find_blog_post, :only => [:show, :comment, :update_nav]
respond_to :html, :js, :rss if Rails.version >= '3.0.0' respond_to :html, :js, :rss if Rails.version >= '3.0.0'
def index def index
@ -18,7 +18,7 @@ class Blog::PostsController < BlogController
def show def show
@blog_comment = BlogComment.new @blog_comment = BlogComment.new
if Rails.version < '3.0.0' if Rails.version < '3.0.0'
# TODO: respond_to block # TODO: respond_to block
else else
@ -55,7 +55,7 @@ class Blog::PostsController < BlogController
render :action => 'show' render :action => 'show'
end end
end end
def archive def archive
date = "#{params[:month]}/#{params[:year]}" date = "#{params[:month]}/#{params[:year]}"
@archive_date = Time.parse(date) @archive_date = Time.parse(date)

View file

@ -1,5 +1,5 @@
class BlogController < ApplicationController class BlogController < ApplicationController
helper :blog_posts helper :blog_posts
before_filter :find_page, :find_all_blog_categories before_filter :find_page, :find_all_blog_categories
@ -13,4 +13,4 @@ protected
@blog_categories = BlogCategory.all @blog_categories = BlogCategory.all
end end
end end

View file

@ -4,10 +4,10 @@ module BlogPostsHelper
return nil if posts.blank? return nil if posts.blank?
html = '<section id="blog_archive_list"><h1>Archives</h1><nav>' html = '<section id="blog_archive_list"><h1>Archives</h1><nav>'
links = [] links = []
posts.each do |e| posts.each do |e|
links << e.published_at.strftime('%m/%Y') links << e.published_at.strftime('%m/%Y')
end end
links.uniq! links.uniq!
links.each do |l| links.each do |l|
year = l.split('/')[1] year = l.split('/')[1]
@ -19,7 +19,7 @@ module BlogPostsHelper
html += '</nav></section>' html += '</nav></section>'
html.html_safe html.html_safe
end end
def next_or_previous?(post) def next_or_previous?(post)
post.next.present? or post.prev.present? post.next.present? or post.prev.present?
end end

View file

@ -1 +1 @@
require File.expand_path('../../../mailers/blog/comment_mailer', __FILE__) require File.expand_path('../../../mailers/blog/comment_mailer', __FILE__)

View file

@ -8,16 +8,16 @@ class BlogCategory < ActiveRecord::Base
validates_uniqueness_of :title validates_uniqueness_of :title
has_friendly_id :title, :use_slug => true has_friendly_id :title, :use_slug => true
# this might be able to be optimised a little more # this might be able to be optimised a little more
def post_count def post_count
count = 0 count = 0
self.posts.each do |p| self.posts.each do |p|
count += 1 if p.live? count += 1 if p.live?
end end
count count
end end
end end

View file

@ -119,4 +119,4 @@ class BlogComment < ActiveRecord::Base
end end
end end
end end

View file

@ -86,4 +86,4 @@
<% end %> <% end %>
<% else %> <% else %>
<% content_for :stylesheets, stylesheet_link_tag('refinery/refinerycms-blog')%> <% content_for :stylesheets, stylesheet_link_tag('refinery/refinerycms-blog')%>
<% end %> <% end %>

View file

@ -8,7 +8,7 @@
:include_object_name => true :include_object_name => true
} %> } %>
<% end %> <% end %>
<div class='field'> <div class='field'>
<%= f.label :title -%> <%= f.label :title -%>
<%= f.text_field :title, :class => 'larger widest' -%> <%= f.text_field :title, :class => 'larger widest' -%>
@ -20,4 +20,4 @@
:continue_editing => false, :continue_editing => false,
:delete_title => t('admin.blog.categories.category.delete') :delete_title => t('admin.blog.categories.category.delete')
} %> } %>
<% end %> <% end %>

View file

@ -1 +1 @@
<%= render :partial => "form" %> <%= render :partial => "form" %>

View file

@ -27,4 +27,4 @@
</p> </p>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

View file

@ -1 +1 @@
<%= render :partial => "form" %> <%= render :partial => "form" %>

View file

@ -10,10 +10,10 @@
:target => "_blank" unless comment.unmoderated? %> :target => "_blank" unless comment.unmoderated? %>
<%= link_to refinery_icon_tag('zoom.png'), admin_blog_comment_path(comment), <%= link_to refinery_icon_tag('zoom.png'), admin_blog_comment_path(comment),
:title => t('.read') %> :title => t('.read') %>
<%= link_to refinery_icon_tag("cross.png"), <%= link_to refinery_icon_tag("cross.png"),
rejected_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), rejected_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')),
:title => t('.reject') unless comment.rejected? %> :title => t('.reject') unless comment.rejected? %>
<%= link_to refinery_icon_tag("tick.png"), <%= link_to refinery_icon_tag("tick.png"),
approved_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), approved_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')),
:title => t('.approve') unless comment.approved? %> :title => t('.approve') unless comment.approved? %>
</span> </span>

View file

@ -3,7 +3,7 @@
<% if searching? %> <% if searching? %>
<h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2> <h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2>
<% if @blog_comments.any? %> <% if @blog_comments.any? %>
<%=# will_paginate @blog_comments <%=# will_paginate @blog_comments
%> %>
<ul> <ul>
@ -11,19 +11,19 @@
:collection => @blog_comments %> :collection => @blog_comments %>
</ul> </ul>
<%=# will_paginate @blog_comments <%=# will_paginate @blog_comments
%> %>
<% else %> <% else %>
<p><%= t('admin.search_no_results') %></p> <p><%= t('admin.search_no_results') %></p>
<% end %> <% end %>
<% else %> <% else %>
<% if @blog_comments.any? %> <% if @blog_comments.any? %>
<%=# will_paginate @blog_comments <%=# will_paginate @blog_comments
%> %>
<%= render :partial => "sortable_list" %> <%= render :partial => "sortable_list" %>
<%=# will_paginate @blog_comments <%=# will_paginate @blog_comments
%> %>
<% else %> <% else %>
<h3> <h3>
@ -32,4 +32,4 @@
</h3> </h3>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

View file

@ -63,4 +63,4 @@
<% content_for :head, stylesheet_link_tag('refinery/refinerycms-blog') %> <% content_for :head, stylesheet_link_tag('refinery/refinerycms-blog') %>
<% else %> <% else %>
<% content_for :stylesheets, stylesheet_link_tag('refinery/refinerycms-blog') %> <% content_for :stylesheets, stylesheet_link_tag('refinery/refinerycms-blog') %>
<% end %> <% end %>

View file

@ -4,4 +4,4 @@
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
} }
</style> </style>

View file

@ -10,4 +10,4 @@
}, 250); }, 250);
}); });
}); });
</script> </script>

View file

@ -27,4 +27,4 @@
</p> </p>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

View file

@ -17,4 +17,4 @@
<% end %> <% end %>
<%= render :partial => "/shared/content_page" %> <%= render :partial => "/shared/content_page" %>
<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> <% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %>

View file

@ -10,4 +10,4 @@
<%= link_to "&#171;&nbsp;".html_safe + truncate(@blog_post.prev.title), @blog_post.prev, :class => 'prev', :"data-nav-url" => update_blog_nav_path(@blog_post.prev) %> <%= link_to "&#171;&nbsp;".html_safe + truncate(@blog_post.prev.title), @blog_post.prev, :class => 'prev', :"data-nav-url" => update_blog_nav_path(@blog_post.prev) %>
<% end -%> <% end -%>
</nav><!-- /next_prev_article --> </nav><!-- /next_prev_article -->
<% end -%> <% end -%>

View file

@ -8,7 +8,7 @@
<h1><%= @blog_post.title %></h1> <h1><%= @blog_post.title %></h1>
<details> <details>
<time datetime="<%= @blog_post.published_at.strftime('%Y-%m-%d') %>" class='posted_at'> <time datetime="<%= @blog_post.published_at.strftime('%Y-%m-%d') %>" class='posted_at'>
<%= t('blog.shared.posts.created_at', :when => @blog_post.published_at.strftime('%d %B %Y')) %>. <%= t('blog.shared.posts.created_at', :when => @blog_post.published_at.strftime('%d %B %Y')) %>.
</time> </time>
<% if (categories = @blog_post.categories).any? %> <% if (categories = @blog_post.categories).any? %>
<aside class='filed_in'> <aside class='filed_in'>
@ -30,4 +30,4 @@
<nav id="next_prev_article"> <nav id="next_prev_article">
<%= render 'nav' %> <%= render 'nav' %>
</nav><!-- /next_prev_article --> </nav><!-- /next_prev_article -->
<% end -%> <% end -%>

View file

@ -16,4 +16,4 @@
<% end %> <% end %>
<%= render :partial => "/shared/content_page" %> <%= render :partial => "/shared/content_page" %>
<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> <% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %>

View file

@ -17,4 +17,4 @@
<% end %> <% end %>
<%= render :partial => "/shared/content_page" %> <%= render :partial => "/shared/content_page" %>
<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> <% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %>

View file

@ -83,4 +83,4 @@
<script src="http://w.sharethis.com/button/buttons.js"></script> <script src="http://w.sharethis.com/button/buttons.js"></script>
<script>stLight.options({publisher:'<%= BlogPost::ShareThis.key %>'});</script> <script>stLight.options({publisher:'<%= BlogPost::ShareThis.key %>'});</script>
<% end if BlogPost::ShareThis.enabled? %> <% end if BlogPost::ShareThis.enabled? %>
<% end %> <% end %>

View file

@ -5,4 +5,4 @@
<%= link_to "#{category.title} (#{category.post_count})", blog_category_url(category) %> <%= link_to "#{category.title} (#{category.post_count})", blog_category_url(category) %>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View file

@ -35,4 +35,4 @@
</p> </p>
</footer> </footer>
</article> </article>
<% end %> <% end %>

View file

@ -5,4 +5,4 @@
<%= link_to blog_post.title, blog_post_url(blog_post) %> <%= link_to blog_post.title, blog_post_url(blog_post) %>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View file

@ -1,2 +1,2 @@
<h2><%= t('.title') %></h2> <h2><%= t('.title') %></h2>
<%= link_to "Subscribe", blog_rss_feed_url, :id => "rss_feed_subscribe"%> <%= link_to "Subscribe", blog_rss_feed_url, :id => "rss_feed_subscribe"%>

View file

@ -73,4 +73,4 @@ else
end end
end end
end end
end end

View file

@ -1,4 +1,4 @@
Factory.define(:blog_category) do |f| Factory.define(:blog_category) do |f|
f.title "Shopping" f.title "Shopping"
f.posts {|p| [p.association(:post)]} f.posts {|p| [p.association(:post)]}
end end

View file

@ -7,4 +7,4 @@ Factory.define(:blog_comment) do |f|
f.email { Factory.next(:email) } f.email { Factory.next(:email) }
f.body "Which one is the best for picking up new shoes?" f.body "Which one is the best for picking up new shoes?"
f.association :post f.association :post
end end

View file

@ -1,4 +1,4 @@
Factory.define(:post, :class => BlogPost) do |f| Factory.define(:post, :class => BlogPost) do |f|
f.title "Top Ten Shopping Centers in Chicago" f.title "Top Ten Shopping Centers in Chicago"
f.body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it." f.body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it."
end end

View file

@ -66,4 +66,4 @@ class RefinerycmsBlogGenerator < Rails::Generator::NamedBase
end end
end end
end if defined?(Rails::Generator::NamedBase) end if defined?(Rails::Generator::NamedBase)

View file

@ -29,4 +29,4 @@ Gem::Specification.new do |s|
end end
EOF EOF
File.open(File.expand_path("../../refinerycms-blog.gemspec", __FILE__), 'w').puts(gemspec) File.open(File.expand_path("../../refinerycms-blog.gemspec", __FILE__), 'w').puts(gemspec)

View file

@ -77,4 +77,4 @@ module ActiveRecord
end end
end end
end end
end end

View file

@ -46,4 +46,4 @@ module Refinery
end end
end end
end end
end end

View file

@ -18,4 +18,4 @@ describe BlogCategory do
end end
end end

View file

@ -2,20 +2,20 @@ require 'spec_helper'
Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
describe BlogComment do describe BlogComment do
context "wiring up" do context "wiring up" do
before(:each) do before(:each) do
@comment = Factory(:blog_comment) @comment = Factory(:blog_comment)
end end
it "saves" do it "saves" do
@comment.should_not be_nil @comment.should_not be_nil
end end
it "has a blog post" do it "has a blog post" do
@comment.post.should_not be_nil @comment.post.should_not be_nil
end end
end end
end end

View file

@ -13,4 +13,4 @@ describe BlogPost do
end end
end end
end end