[donrails commit] r392 - in trunk: . app/controllers app/models

0 views
Skip to first unread message

codesite...@google.com

unread,
Dec 24, 2008, 8:57:53 PM12/24/08
to donr...@googlegroups.com
Author: yasuhiro
Date: Wed Dec 24 17:56:13 2008
New Revision: 392

Modified:
trunk/ChangeLog
trunk/app/controllers/notes_controller.rb
trunk/app/controllers/rdf_controller.rb
trunk/app/models/article.rb

Log:
* Change article order at showing category and subcategories. Now shows
reverse id.


Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Wed Dec 24 17:56:13 2008
@@ -1,3 +1,7 @@
+2008-12-25 ARAKI Yasuhiro <a...@debian.org>
+
+ * Change article order at showing category and subcategories. Now shows
reverse id.
+
2008-12-24 ARAKI Yasuhiro <a...@debian.org>

* Change to include sub categories at viewing.

Modified: trunk/app/controllers/notes_controller.rb
==============================================================================
--- trunk/app/controllers/notes_controller.rb (original)
+++ trunk/app/controllers/notes_controller.rb Wed Dec 24 17:56:13 2008
@@ -108,10 +108,6 @@
end

def articles_long
-# @articles_pages, @articles = paginate(:article, :per_page => 10,
-# :order => 'size DESC, id DESC',
-# :conditions => ["hidden IS NULL OR hidden = 0"]
-# )
@articles = Article.paginate(:page => params[:page], :per_page => 10,
:order => 'size DESC, id DESC',
:conditions => ["hidden IS NULL OR hidden = 0"]
@@ -127,10 +123,6 @@

def articles_author
begin
-# @articles_pages, @articles = paginate(:article, :per_page => 10,
-# :order => 'id DESC',
-# :conditions => ["author_id
= ? AND ( hidden IS NULL OR hidden = 0 )", params['id']]
-# )
@articles = Article.paginate(:page => params[:page], :per_page => 10,
:order => 'id DESC',
:conditions => ["author_id = ?
AND ( hidden IS NULL OR hidden = 0 )", params['id']]
@@ -453,6 +445,7 @@
:order => 'articles.article_date
DESC'
)
end
+ @articles = @articles.sort.reverse
@heading = "カテゴリ:#{params['category']}"
@heading += '(' + @category.articles.size.to_s + ')'


Modified: trunk/app/controllers/rdf_controller.rb
==============================================================================
--- trunk/app/controllers/rdf_controller.rb (original)
+++ trunk/app/controllers/rdf_controller.rb Wed Dec 24 17:56:13 2008
@@ -77,6 +77,7 @@
:conditions => ["articles.hidden IS NULL OR
articles.hidden = 0"]
)
end
+ @recent_articles = @recent_articles.sort.reverse
@rdf_category = @category.name
unless @recent_articles.empty? then
@lm = @recent_articles.first.article_mtime.gmtime if
@recent_articles.first.article_mtime

Modified: trunk/app/models/article.rb
==============================================================================
--- trunk/app/models/article.rb (original)
+++ trunk/app/models/article.rb Wed Dec 24 17:56:13 2008
@@ -26,6 +26,10 @@
before_save :renew_mtime
after_destroy :enrollclean

+ def <=>(other)
+ self.id <=> other.id
+ end
+
# Fulltext searches the body of published articles
# this function original from "typo" models/article.rb
def self.search(query)

Reply all
Reply to author
Forward
0 new messages