Added:
trunk/public/images/feed-icon-14x14.png (contents, props changed)
trunk/public/images/feed-icon-28x28.png (contents, props changed)
Modified:
trunk/ChangeLog
trunk/app/controllers/application.rb
trunk/app/controllers/notes_controller.rb
trunk/app/controllers/rdf_controller.rb
trunk/app/helpers/rdf_helper.rb
trunk/app/views/notes/default/show_enrollment.rhtml
trunk/app/views/notes/default/show_title.rhtml
trunk/app/views/notes/show_category.rhtml
Log:
Change to include sub categories at viewing.
Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Wed Dec 24 06:11:05 2008
@@ -1,3 +1,8 @@
+2008-12-24 ARAKI Yasuhiro <a...@debian.org>
+
+ * Change to include sub categories at viewing.
+ * Add rss link image.
+
2008-12-22 ARAKI Yasuhiro <a...@debian.org>
* This version is running with rails2.2.2. (checked by rake test).
However, following feature is disabled.
Modified: trunk/app/controllers/application.rb
==============================================================================
--- trunk/app/controllers/application.rb (original)
+++ trunk/app/controllers/application.rb Wed Dec 24 06:11:05 2008
@@ -244,5 +244,16 @@
end
response.headers["X-donrails"] = "login"
end
+
+ private
+ def collect_category_ids(category, ccs = Array.new)
+ ccs.push category.id
+ category.direct_children.each do |cc|
+ if cc.direct_children
+ ccs = collect_category_ids(cc, ccs)
+ end
+ end
+ return ccs
+ end
end
Modified: trunk/app/controllers/notes_controller.rb
==============================================================================
--- trunk/app/controllers/notes_controller.rb (original)
+++ trunk/app/controllers/notes_controller.rb Wed Dec 24 06:11:05 2008
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
## TODO: migrate classic_pagination to will_pagenate
require 'kconv'
@@ -170,7 +171,6 @@
@articles = Article.paginate(:page => params[:page], :order
=> 'article_date DESC, id DESC', :conditions => ["hidden IS NULL OR hidden
= 0"])
-
unless @articles.empty?
@lm = @articles.first.article_mtime.gmtime if
@articles.first.article_mtime
else
@@ -444,12 +444,15 @@
end
if @category and @category.id
- @articles = Article.paginate(:page => params[:page],
- :conditions => ["articles.hidden IS
NULL OR articles.hidden = 0"],
- :joins => "JOIN dona_cas on
(dona_cas.article_id=articles.id AND dona_cas.category_id=#{@category.id})",
- :order => 'articles.article_date DESC'
- )
-
+ ccs = collect_category_ids(@category)
+ @articles = Array.new
+ ccs.each do |cid|
+ @articles = @articles | Article.paginate(:page => params[:page],
+ :conditions => ["articles.hidden IS
NULL OR articles.hidden = 0"],
+ :joins => "JOIN dona_cas on
(dona_cas.article_id=articles.id AND dona_cas.category_id=#{cid})",
+ :order => 'articles.article_date
DESC'
+ )
+ end
@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 06:11:05 2008
@@ -67,11 +67,16 @@
params["q"] = params["category"]
redirect_to :action => 'rdf_search', :q => params["category"]
else
- @recent_articles = Article.paginate(:page =>
params[:page], :per_page => 20,
- :order => 'articles.id DESC',
- :joins => "JOIN dona_cas on
(dona_cas.article_id=articles.id and dona_cas.category_id=#{@category.id})",
- :conditions => ["articles.hidden IS NULL
OR articles.hidden = 0"]
- )
+ ccs = collect_category_ids(@category)
+ @recent_articles = Array.new
+ ccs.each do |cid|
+ @recent_articles = @recent_articles |
+ Article.paginate(:page => params[:page], :per_page => 20,
+ :order => 'articles.id DESC',
+ :joins => "JOIN dona_cas on
(dona_cas.article_id=articles.id and dona_cas.category_id=#{cid})",
+ :conditions => ["articles.hidden IS NULL OR
articles.hidden = 0"]
+ )
+ end
@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/helpers/rdf_helper.rb
==============================================================================
--- trunk/app/helpers/rdf_helper.rb (original)
+++ trunk/app/helpers/rdf_helper.rb Wed Dec 24 06:11:05 2008
@@ -45,18 +45,25 @@
def rdf_parts31(xmlorig, item, action)
xml = Builder::XmlMarkup.new(:target => xmlorig)
- xml.title(item.title_to_xml)
if action == "show_enrollment"
xml.link(request.protocol + request.host_with_port +
url_for(:controller => 'notes', :action => action, :id =>
item.enrollment_id))
elsif action == "show_title"
xml.link(request.protocol + request.host_with_port +
url_for(:controller => 'notes', :action => action, :id => item.id))
end
+ categories = Array.new
item.categories.each do |cat|
+ categories.push cat.name
xml.tag!("dc:subject") do
xml.text! cat.name
end
end
+ title_line = ''
+ categories.each do |cn|
+ title_line += '[' + cn + ']'
+ end
+ title_line += ' ' + item.title_to_xml
+ xml.title(title_line)
begin
ce = item.body_to_xml
@@ -103,7 +110,6 @@
def rss2_parts31(xmlorig, item, action)
xml = Builder::XmlMarkup.new(:target => xmlorig)
- xml.title(item.title_to_xml)
if action == "show_enrollment"
xml.link(request.protocol + request.host_with_port +
url_for(:controller => 'notes', :action => action, :id =>
item.enrollment_id))
xml.guid(request.protocol + request.host_with_port +
url_for(:controller => 'notes', :action => action, :id =>
item.enrollment_id))
@@ -115,6 +121,20 @@
item.categories.each do |cat|
xml.category cat.name
end
+
+ categories = Array.new
+ item.categories.each do |cat|
+ categories.push cat.name
+ xml.tag!("dc:subject") do
+ xml.text! cat.name
+ end
+ end
+ title_line = ''
+ categories.each do |cn|
+ title_line += '[' + cn + ']'
+ end
+ title_line += ' ' + item.title_to_xml
+ xml.title(title_line)
begin
ce = item.body_to_xml
Modified: trunk/app/views/notes/default/show_enrollment.rhtml
==============================================================================
--- trunk/app/views/notes/default/show_enrollment.rhtml (original)
+++ trunk/app/views/notes/default/show_enrollment.rhtml Wed Dec 24 06:11:05
2008
@@ -16,20 +16,20 @@
<%= display_enrollment_images(@enrollment) %>
<%= article.body_to_html if article.body %>
</div>
- <%= render :inline =>
don_get_theme("shared/comment-enrollment"), :locals => {:enrollment =>
@enrollment, :article => article} %>
+ <%= render :file => don_get_theme("shared/comment-enrollment"), :locals
=> {:enrollment => @enrollment, :article => article} %>
<div class="nndate">
- <%= render :inline => don_get_theme("shared/authorhead"), :locals =>
{:article => article} %>
+ <%= render :file => don_get_theme("shared/authorhead"), :locals =>
{:article => article} %>
</div>
</div> <!-- end section -->
</div> <!-- end numsection -->
<div class="linktitle">
<% if (@enrollment_l && @enrollment_l.articles.first && @enrollment_r &&
@enrollment_r.articles.first) %>
-<%= render :inline => don_get_theme("shared/linktitle"), :locals =>
{:lastarticle =>
don_get_object(@enrollment_l.articles.first, 'html'), :nextarticle =>
don_get_object(@enrollment_r.articles.first, 'html')} %>
+<%= render :file => don_get_theme("shared/linktitle"), :locals =>
{:lastarticle =>
don_get_object(@enrollment_l.articles.first, 'html'), :nextarticle =>
don_get_object(@enrollment_r.articles.first, 'html')} %>
<% elsif (@enrollment_l && @enrollment_l.articles.first && @enrollment_r
== nil) %>
-<%= render :inline => don_get_theme("shared/linktitle"), :locals =>
{:lastarticle => don_get_object(@enrollment_l.articles.first, 'html')} %>
+<%= render :file => don_get_theme("shared/linktitle"), :locals =>
{:lastarticle => don_get_object(@enrollment_l.articles.first, 'html')} %>
<% elsif (@enrollment_l == nil && @enrollment_r &&
@enrollment_r.articles.first) %>
-<%= render :inline => don_get_theme("shared/linktitle"), :locals =>
{:nextarticle => don_get_object(@enrollment_r.articles.first, 'html')} %>
+<%= render :file => don_get_theme("shared/linktitle"), :locals =>
{:nextarticle => don_get_object(@enrollment_r.articles.first, 'html')} %>
<% else %>
(sorry, I can not link previous and next articles)
<% end %>
Modified: trunk/app/views/notes/default/show_title.rhtml
==============================================================================
--- trunk/app/views/notes/default/show_title.rhtml (original)
+++ trunk/app/views/notes/default/show_title.rhtml Wed Dec 24 06:11:05 2008
@@ -41,7 +41,7 @@
<div class="linktitle">
<% if (@lastarticle and @nextarticle) %>
-<%= render :inline => don_get_theme("shared/linktitle"), :locals =>
{:lastarticle => don_get_object(@lastarticle, 'html'), :nextarticle =>
don_get_object(@nextarticle, 'html')} %>
+<%= render :file => don_get_theme("shared/linktitle"), :locals =>
{:lastarticle => don_get_object(@lastarticle, 'html'), :nextarticle =>
don_get_object(@nextarticle, 'html')} %>
<% else %>
(sorry, I can not link previous and next articles)
<% end %>
Modified: trunk/app/views/notes/show_category.rhtml
==============================================================================
--- trunk/app/views/notes/show_category.rhtml (original)
+++ trunk/app/views/notes/show_category.rhtml Wed Dec 24 06:11:05 2008
@@ -1,10 +1,8 @@
<h3>カテゴリ: <%= @category.name %>(<%= @category.articles.size.to_s %>) の
リスト
[<%= link_to "記事", {:action => "show_category_noteslist", :id =>
@category.id} %>]
+<%= link_to image_tag("feed-icon-14x14.png", :size =>"14x14", :border =>
0, :style => "margin: 0px;", :alt => "#{@category.name}の登録"),
{:controller => 'rdf', :action => 'rdf_category', :id => @category.id} %>
</h3>
<%=h @category.description %>
-<div id='roots_ul'>
-<%= display_categories_roots_ul_description(@category.direct_children,
1) %>
-</div>
<% begin %>
<%= will_paginate @articles %>
Added: trunk/public/images/feed-icon-14x14.png
==============================================================================
Binary file. No diff available.
Added: trunk/public/images/feed-icon-28x28.png
==============================================================================
Binary file. No diff available.