Author: yasuhiro
Date: Sun Apr 5 04:35:01 2009
New Revision: 397
Modified:
trunk/ChangeLog
trunk/app/controllers/notes_controller.rb
trunk/app/helpers/application_helper.rb
trunk/app/views/notes/category_tree_list_a.rhtml
trunk/donrails/tool/update-custom.sh
Log:
some change
Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Sun Apr 5 04:35:01 2009
@@ -1,3 +1,10 @@
+2009-04-05 ARAKI Yasuhiro <
a...@debian.org>
+
+ * app/helpers/application_helper.rb
(ApplicationHelper#display_categories_roots_description): New method.
+ (ApplicationHelper#display_categories_roots_description_sub): New method.
+
+ * app/controllers/notes_controller.rb (NotesController): Change to show
10 articles at once. (Change from 30 to 10.)
+
2008-12-31 ARAKI Yasuhiro <
a...@debian.org>
* app/models/article_sweeper.rb: Small fix.
Modified: trunk/app/controllers/notes_controller.rb
==============================================================================
--- trunk/app/controllers/notes_controller.rb (original)
+++ trunk/app/controllers/notes_controller.rb Sun Apr 5 04:35:01 2009
@@ -238,9 +238,9 @@
if params['trigger'] == 'recents'
@articles = Article.find(:all, :order => "id DESC", :limit =>
10, :conditions => ["articles.hidden IS NULL OR articles.hidden = 0"])
elsif params['trigger'] == 'trackbacks'
- @articles = Article.find(:all, :order => "articles.article_date
DESC", :limit => 30, :joins => "JOIN trackbacks on
(trackbacks.article_id=
articles.id)", :conditions => ["articles.hidden IS
NULL OR articles.hidden = 0"])
+ @articles = Article.find(:all, :order => "articles.article_date
DESC", :limit => 10, :joins => "JOIN trackbacks on
(trackbacks.article_id=
articles.id)", :conditions => ["articles.hidden IS
NULL OR articles.hidden = 0"])
elsif params['trigger'] == 'comments'
- @articles = Article.find(:all, :order => "articles.article_date
DESC", :limit => 30, :joins => "JOIN comments on
(comments.article_id=
articles.id)", :conditions => ["articles.hidden IS
NULL OR articles.hidden = 0"])
+ @articles = Article.find(:all, :order => "articles.article_date
DESC", :limit => 10, :joins => "JOIN comments on
(comments.article_id=
articles.id)", :conditions => ["articles.hidden IS
NULL OR articles.hidden = 0"])
elsif params['trigger'] == 'long'
@articles = Article.find(:all, :order => "size DESC", :limit =>
10, :conditions => ["articles.hidden IS NULL OR articles.hidden = 0"])
end
@@ -485,12 +485,12 @@
@noindex = true
get_ymd
if @ymd
- @articles = Article.find(:all, :limit => 30,
+ @articles = Article.find(:all, :limit => 10,
:conditions => ["article_date >= ? AND
(articles.hidden IS NULL OR articles.hidden = 0)", @ymd])
if @articles.first
a = don_get_object(@articles.first, 'html')
@heading = don_chomp_tags(a.title_to_html)
- flash[:notice] = "#{@articles.first.article_date.to_date} 以降 30件
の記事を表示します。"
+ flash[:notice] = "#{@articles.first.article_date.to_date} 以降 10件
の記事を表示します。"
unless @articles.empty?
@lm = @articles.first.article_mtime.gmtime if
@articles.first.article_mtime
end
Modified: trunk/app/helpers/application_helper.rb
==============================================================================
--- trunk/app/helpers/application_helper.rb (original)
+++ trunk/app/helpers/application_helper.rb Sun Apr 5 04:35:01 2009
@@ -313,6 +313,7 @@
f.close
end
+
def display_categories_roots_ul(categories, manage=nil)
content = ''
if categories.size > 0
@@ -351,6 +352,45 @@
end
return content
end
+
+ def display_categories_roots_description(categories)
+ content = ''
+ i = 0
+
+ if categories.size > 0
+ categories.each do |category|
+ i += 1
+ content += link_to(
category.name, {:controller => 'notes', :action
=> :show_category, :id =>
category.id})
+ content += '(' + category.articles.size.to_s
+ content += ': ' + category.description if
category.description.size > 1
+ content += ') '
+ if category.direct_children.size >= 1
+ content += ' > '
+ content +=
display_categories_roots_description_sub(category.all_children)
+ end
+ end
+ end
+ return content
+ end
+
+ def display_categories_roots_description_sub(categories)
+ content = ''
+ i = 0
+ if categories.size > 0
+
+ categories.each do |category|
+ i += 1
+ content += link_to(
category.name, {:controller => 'notes', :action
=> :show_category, :id =>
category.id})
+ content += '(' + category.articles.size.to_s
+ content += ': ' + category.description if
category.description.size > 1
+ content += ') '
+
+ end
+ content += '<br>'
+ end
+ return content
+ end
+
def display_article_date(article)
if article and article.article_date
Modified: trunk/app/views/notes/category_tree_list_a.rhtml
==============================================================================
--- trunk/app/views/notes/category_tree_list_a.rhtml (original)
+++ trunk/app/views/notes/category_tree_list_a.rhtml Sun Apr 5 04:35:01
2009
@@ -1,5 +1,5 @@
<body>
<div id='roots_ul'>
-<%= display_categories_roots_ul(@roots) %>
+<%= display_categories_roots_description(@roots) %>
</div>
</body>
Modified: trunk/donrails/tool/update-custom.sh
==============================================================================
--- trunk/donrails/tool/update-custom.sh (original)
+++ trunk/donrails/tool/update-custom.sh Sun Apr 5 04:35:01 2009
@@ -35,7 +35,7 @@
#
# dist��ɬ�פʥե������ tar ball�������ޤ���
# dist��Ÿ��������DONRAILS_DIR�����ꤷ�� clean ���� deploy���ޤ���
-DONRAILS_DIR=$HOME/playground/donrails-trunk
+DONRAILS_DIR=$HOME/playground/donrails
DERIVED=default
SCRIPTNAME=update-custom.sh
DOTDONRAILS=$HOME/.donrails
@@ -46,8 +46,8 @@
cd custom/views && cp -rvi * $DONRAILS_DIR/app/views
cd $DOTDONRAILS
cd custom/stylesheets && cp -rvi * $DONRAILS_DIR/public/stylesheets
- cd $DONRAILS_DIR/app/views/notes && install -d custom && cp -viu
$DERIVED/*.rhtml custom
- cd $DONRAILS_DIR/app/views/shared && install -d custom && cp -viu
$DERIVED/*.rhtml custom
+ cd $DONRAILS_DIR/app/views/notes && install -d custom && cp -vi
$DERIVED/*.rhtml custom
+ cd $DONRAILS_DIR/app/views/shared && install -d custom && cp -vi
$DERIVED/*.rhtml custom
;;
clean)
@@ -58,10 +58,10 @@
mv $DOTDONRAILS/custom $DOTDONRAILS/custom.`date +%s`
cd $DOTDONRAILS
install -d custom/views/layouts/custom
- cd custom/views/layouts/custom && cp -rviub
$DONRAILS_DIR/app/views/layouts/custom/*.rhtml .
+ cd custom/views/layouts/custom && cp -rvi
$DONRAILS_DIR/app/views/layouts/custom/*.rhtml .
cd $DOTDONRAILS
install -d custom/stylesheets/custom
- cd custom/stylesheets/custom && cp -rviub
$DONRAILS_DIR/public/stylesheets/custom/* .
+ cd custom/stylesheets/custom && cp -rvi
$DONRAILS_DIR/public/stylesheets/custom/* .
;;
dist)
tar zcvf $DOTDONRAILS/update-custom-`date +%s`.tar.gz $DOTDONRAILS/custom
$SCRIPTNAME