From c5b95e2e0f491d9055de7694716eef4d2b34096d Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 15 Aug 2012 16:17:28 +0800 Subject: [PATCH] Fix rss feed i18n --- .../panel/announcement/front_end/bulletins_controller.rb | 6 +++--- .../panel/announcement/front_end/bulletins/index.html.erb | 2 +- .../announcement/front_end/bulletins/index.rss.builder | 5 ++--- .../panel/announcement/front_end/bulletins/show.rss.builder | 2 +- .../panel/news/front_end/news_bulletins_controller.rb | 4 ++-- .../panel/news/front_end/news_bulletins/index.html.erb | 2 +- .../panel/news/front_end/news_bulletins/index.rss.builder | 6 +++--- .../panel/news/front_end/news_bulletins/show.rss.builder | 2 +- 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index 6c3aa066..a5cad78d 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -8,13 +8,13 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController # GET /bulletins # GET /bulletins.xml def index_bulletins_by_unit - @page = Page.find(params[:page_id]) + @page = Page.find(params[:page_id]) rescue nil @bulletins=Bulletin.all.available_for_lang(I18n.locale).can_display.where("cache_dept.#{I18n.locale.to_s.downcase}"=>params[:name]).page( params[:page_main]).per(15) render :index end def index - @page = Page.find(params[:page_id]) + @page = Page.find(params[:page_id]) rescue nil if !params[:search_query].blank? # search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending => false} # search_cond.merge!({:bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank? @@ -49,7 +49,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController end def show - @page = Page.find(params[:page_id]) + @page = Page.find(params[:page_id]) rescue nil if params[:preview] == "true" preview_content else diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb index 9ba18b9c..798ff517 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb @@ -2,7 +2,7 @@ <%= flash_messages %> -

<%= @page.title %>

+

<%= @page.title rescue nil %>

diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.rss.builder b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.rss.builder index c0dd32e0..9c224ece 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.rss.builder +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.rss.builder @@ -2,7 +2,7 @@ xml.instruct! :xml, :version => "1.0" xml.rss :version => "2.0" do xml.channel do if @current_category - xml.title @current_category.i18n_variable[I18n.locale] + xml.title @current_category.title_translations[I18n.locale.to_s] else xml.title t('announcement.announcement') end @@ -10,8 +10,7 @@ xml.rss :version => "2.0" do for bulletin in @bulletins xml.item do - xml.title bulletin.title[I18n.locale] - xml.description bulletin.subtitle[I18n.locale] + xml.title bulletin.title_translations[I18n.locale.to_s] xml.pubDate bulletin.postdate.to_s(:rfc822) xml.link panel_announcement_front_end_bulletin_path(bulletin, :rss) xml.guid panel_announcement_front_end_bulletin_path(bulletin, :rss) diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.rss.builder b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.rss.builder index 8fb929f5..e9df51f4 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.rss.builder +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.rss.builder @@ -2,7 +2,7 @@ xml.instruct! :xml, :version => "1.0" xml.rss :version => "2.0" do xml.channel do if @current_category - xml.title @current_category.i18n_variable[I18n.locale] + xml.title @current_category.title_translations[I18n.locale.to_s] else xml.title t('announcement.announcement') end diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb index 8b665b24..0e9f0ac3 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb @@ -9,13 +9,13 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController # GET /news_bulletins.xml def index_news_bulletins_by_unit - @page = Page.find(params[:page_id]) + @page = Page.find(params[:page_id]) rescue nil @news_bulletins=NewsBulletin.all.available_for_lang(I18n.locale).can_display.where("unit_list_for_anc_id"=>params[:name]).page( params[:page_main]).per(15).page( params[:page_main]).per(10) render :index end def index - @page = Page.find(params[:page_id]) + @page = Page.find(params[:page_id]) rescue nil if !params[:search_query].blank? # search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending=>false,:is_pending=>false} # search_cond.merge!({:news_bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank? diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb index 3324928c..fc232e8b 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb @@ -2,7 +2,7 @@ <%= flash_messages %> -

<%= @page.title %>

+

<%= @page.title rescue nil %>

<% if !params[:name].blank?%> <%= t("search.unit_get",:unit_name => UnitListForAnc.find(params[:name]).title,:item_num=>@news_bulletins.count) %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.rss.builder b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.rss.builder index b4901f70..058e296c 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.rss.builder +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.rss.builder @@ -2,7 +2,7 @@ xml.instruct! :xml, :version => "1.0" xml.rss :version => "2.0" do xml.channel do if @current_category - xml.title @current_category.i18n_variable[I18n.locale] + xml.title @current_category.title_translations[I18n.locale.to_s] else xml.title t('news.campus_news') end @@ -10,8 +10,8 @@ xml.rss :version => "2.0" do for news_bulletin in @news_bulletins xml.item do - xml.title news_bulletin.title[I18n.locale] - xml.description news_bulletin.text[I18n.locale] + xml.title news_bulletin.title_translations[I18n.locale.to_s] + xml.description news_bulletin.subtitle_translations[I18n.locale.to_s] xml.pubDate news_bulletin.postdate.to_s(:rfc822) xml.link panel_news_front_end_news_bulletin_path(news_bulletin, :rss) xml.guid panel_news_front_end_news_bulletin_path(news_bulletin, :rss) diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.rss.builder b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.rss.builder index ba01a48e..3def9abe 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.rss.builder +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.rss.builder @@ -2,7 +2,7 @@ xml.instruct! :xml, :version => "1.0" xml.rss :version => "2.0" do xml.channel do if @current_category - xml.title @current_category.i18n_variable[I18n.locale] + xml.title @current_category.title_translations[I18n.locale.to_s] else xml.title t('news.campus_news') end