<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -46,9 +46,6 @@ class PostsController &lt; BaseController
     end
   end
   
-  def popular
-    @posts = Post.find(:all, :conditions =&gt; &quot;published_at &gt; '#{1.days.ago.to_s :db}'&quot;, :order =&gt; &quot;view_count DESC&quot;)
-  end
     
   # GET /posts/1
   # GET /posts/1.xml
@@ -207,7 +204,7 @@ class PostsController &lt; BaseController
   end
   
   def featured
-    @pages, @posts = paginate :posts, :order =&gt; &quot;posts.published_at DESC&quot;, :conditions =&gt; [&quot;users.featured_writer = ?&quot;, true], :include =&gt; :user
+    @pages, @posts = paginate :posts, :order =&gt; &quot;posts.published_at DESC&quot;, :conditions =&gt; [&quot;users.featured_writer = ?&quot;, 1], :include =&gt; :user
     @featured_writers = User.find_featured    
         
     @rss_title = &quot;#{AppConfig.community_name} Featured Posts&quot;</diff>
      <filename>app/controllers/posts_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -34,6 +34,14 @@ class Post &lt; ActiveRecord::Base
     
   attr_accessor :invalid_emails
   
+  #Named scopes
+  named_scope :by_featured_writers, :conditions =&gt; [&quot;users.featured_writer = ?&quot;, 1], :include =&gt; :user
+  named_scope :recent, :order =&gt; 'published_at DESC'
+  named_scope :popular, :order =&gt; 'view_count DESC'
+  named_scope :since, lambda { |days|
+    {:conditions =&gt; &quot;published_at &gt; '#{days.ago.to_s :db}'&quot; }
+  }
+  
   def self.find_related_to(post, options = {})
     merged_options = options.merge({:limit =&gt; 8, 
         :order =&gt; 'published_at DESC', 
@@ -50,16 +58,17 @@ class Post &lt; ActiveRecord::Base
   end
   
   def self.find_recent(options = {:limit =&gt; 5})
-    find(:all, :order =&gt; &quot;published_at desc&quot;, :limit =&gt; options[:limit], :include =&gt; :user)
+    self.recent.find :all, :limit =&gt; options[:limit]
   end
   
   def self.find_popular(options = {} )
     options.reverse_merge! :limit =&gt; 5, :since =&gt; 7.days
-    find(:all, :conditions =&gt; &quot;published_at &gt; '#{options[:since].ago.to_s :db}'&quot;, :order =&gt; &quot;view_count desc&quot;, :limit =&gt; options[:limit])
+    
+    self.popular.since(options[:since]).find :all, :limit =&gt; options[:limit]
   end
 
   def self.find_featured(options = {:limit =&gt; 10})
-    find(:all, :order =&gt; &quot;posts.published_at desc&quot;, :conditions =&gt; [&quot;users.featured_writer = ?&quot;, true], :limit =&gt; options[:limit], :include =&gt; :user)    
+    self.recent.by_featured_writers.find(:all, :limit =&gt; options[:limit] )    
   end
 
   def self.find_most_commented(limit = 10, since = 7.days.ago)</diff>
      <filename>app/models/post.rb</filename>
    </modified>
    <modified>
      <diff>@@ -132,7 +132,7 @@ class User &lt; ActiveRecord::Base
   end  
     
   def self.find_featured
-    self.find(:all, :conditions =&gt; &quot;featured_writer = 1&quot;)
+    self.find(:all, :conditions =&gt; [&quot;featured_writer = ?&quot;, 1])
   end
   
   def this_months_posts</diff>
      <filename>app/models/user.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,14 +3,14 @@
 .yui-b
 
   .box.alt.first_alt
-    %h3 Featured Writers
+    %h3=:staff_writers.l
     - @featured_writers.each do |user|
       = render :partial =&gt; &quot;users/sidebar_user&quot;, :locals =&gt; {:user =&gt; user}
 
 #yui-main
   .yui-b
     .box.hfeed
-      %h3 Featured Posts
+      %h3=&quot;Featured Posts&quot;.l
 
       .pagination
         =pagination_links</diff>
      <filename>app/views/posts/featured.haml</filename>
    </modified>
    <modified>
      <diff>@@ -19,7 +19,7 @@
   .yui-b
     .box.hfeed
       %h3
-        =:recent_posts.l
+        =:recent_posts.l &quot;Recent Posts&quot;
         %ul.subnav
           %li= &quot;(looking for {link}?)&quot;.l :looking_for_most_x, :link =&gt; link_to(&quot;popular&quot;.l, popular_path)
 </diff>
      <filename>app/views/posts/recent.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@ var Lightbox = {
 	/* hideAll - closes all open lightbox windows */
 	hideAll: function(){
 		lboxes = document.getElementsByClassName('lbox')
-		lboxes.each(function(box){
+		$A(lboxes).each(function(box){
 				Element.hide(box)
 			}
 		)</diff>
      <filename>assets/javascripts/lightbox.js</filename>
    </modified>
    <modified>
      <diff>@@ -10,6 +10,8 @@ all_clippings_tagged: All clippings tagged {tag_name}
 all_photos_tagged: All photos tagged {tag_name}
 #en: all_posts_tagged: All posts tagged {tag_name}
 all_posts_tagged: All posts tagged {tag_name}
+#en: all_tags: All tags
+all_tags: All tags
 #en: all_users_tagged: All users tagged {tag_name}
 all_users_tagged: All users tagged {tag_name}
 #en: comments_count: &quot;{count} pluralize{{count}, comment}&quot;</diff>
      <filename>lang/ui/en-US.yml</filename>
    </modified>
    <modified>
      <diff>@@ -10,6 +10,8 @@ all_clippings_tagged: All clippings tagged {tag_name}
 all_photos_tagged: All photos tagged {tag_name}
 #en: all_posts_tagged: All posts tagged {tag_name}
 all_posts_tagged: All posts tagged {tag_name}
+#en: all_tags: All tags
+all_tags: All tags
 #en: all_users_tagged: All users tagged {tag_name}
 all_users_tagged: All users tagged {tag_name}
 #en: comments_count: &quot;{count} pluralize{{count}, comment}&quot;</diff>
      <filename>lang/ui/en.yml</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
 how_to:
   id: 1
-  name: How To
+  name: How to
 inspiration:
   id: 2
   name: Inspiration</diff>
      <filename>test/fixtures/categories.yml</filename>
    </modified>
    <modified>
      <diff>@@ -16,7 +16,7 @@ class CommentTest &lt; Test::Unit::TestCase
   end
 
   def test_should_generate_commetable_url
-    assert_equal &quot;http://localhost:3000/quentin/posts/1-Building-communities-is-all-about-love-#comment_1&quot;, comments(:quentins_comment_on_his_own_post).generate_commentable_url
+    assert_equal &quot;http://#{APP_URL}/quentin/posts/1-Building-communities-is-all-about-love-#comment_1&quot;, comments(:quentins_comment_on_his_own_post).generate_commentable_url
   end
 
 end</diff>
      <filename>test/unit/comment_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a3f6244dd412a1574d8550cb1752e388a48bf30e</id>
    </parent>
  </parents>
  <author>
    <name>Bruno Bornsztein</name>
    <email>bruno@otis.local</email>
  </author>
  <url>http://github.com/bborn/communityengine/commit/7c513ce9fb5abe1c5e89d84842a8bb3767731156</url>
  <id>7c513ce9fb5abe1c5e89d84842a8bb3767731156</id>
  <committed-date>2008-08-14T13:13:18-07:00</committed-date>
  <authored-date>2008-08-14T13:13:18-07:00</authored-date>
  <message>javascript fix to clipping create page (lightbox wasn't working), starting to use some nice named scoped on the post model (yay named scope!)</message>
  <tree>b0a929b1b2df9f51c85bc75c1ef69665ee2b30e9</tree>
  <committer>
    <name>Bruno Bornsztein</name>
    <email>bruno@otis.local</email>
  </committer>
</commit>
