Fix rss feed i18n

This commit is contained in:
Christophe Vilayphiou 2012-08-15 16:17:28 +08:00
parent 4e3dc7c438
commit c5b95e2e0f
8 changed files with 14 additions and 15 deletions

View File

@ -8,13 +8,13 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
# GET /bulletins # GET /bulletins
# GET /bulletins.xml # GET /bulletins.xml
def index_bulletins_by_unit 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) @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 render :index
end end
def index def index
@page = Page.find(params[:page_id]) @page = Page.find(params[:page_id]) rescue nil
if !params[:search_query].blank? if !params[:search_query].blank?
# search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending => false} # 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? # 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 end
def show def show
@page = Page.find(params[:page_id]) @page = Page.find(params[:page_id]) rescue nil
if params[:preview] == "true" if params[:preview] == "true"
preview_content preview_content
else else

View File

@ -2,7 +2,7 @@
<%= flash_messages %> <%= flash_messages %>
<h1 class="h1"><%= @page.title %></h1> <h1 class="h1"><%= @page.title rescue nil %></h1>
<table class="table table-bordered"> <table class="table table-bordered">

View File

@ -2,7 +2,7 @@ xml.instruct! :xml, :version => "1.0"
xml.rss :version => "2.0" do xml.rss :version => "2.0" do
xml.channel do xml.channel do
if @current_category if @current_category
xml.title @current_category.i18n_variable[I18n.locale] xml.title @current_category.title_translations[I18n.locale.to_s]
else else
xml.title t('announcement.announcement') xml.title t('announcement.announcement')
end end
@ -10,8 +10,7 @@ xml.rss :version => "2.0" do
for bulletin in @bulletins for bulletin in @bulletins
xml.item do xml.item do
xml.title bulletin.title[I18n.locale] xml.title bulletin.title_translations[I18n.locale.to_s]
xml.description bulletin.subtitle[I18n.locale]
xml.pubDate bulletin.postdate.to_s(:rfc822) xml.pubDate bulletin.postdate.to_s(:rfc822)
xml.link panel_announcement_front_end_bulletin_path(bulletin, :rss) xml.link panel_announcement_front_end_bulletin_path(bulletin, :rss)
xml.guid panel_announcement_front_end_bulletin_path(bulletin, :rss) xml.guid panel_announcement_front_end_bulletin_path(bulletin, :rss)

View File

@ -2,7 +2,7 @@ xml.instruct! :xml, :version => "1.0"
xml.rss :version => "2.0" do xml.rss :version => "2.0" do
xml.channel do xml.channel do
if @current_category if @current_category
xml.title @current_category.i18n_variable[I18n.locale] xml.title @current_category.title_translations[I18n.locale.to_s]
else else
xml.title t('announcement.announcement') xml.title t('announcement.announcement')
end end

View File

@ -9,13 +9,13 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
# GET /news_bulletins.xml # GET /news_bulletins.xml
def index_news_bulletins_by_unit 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) @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 render :index
end end
def index def index
@page = Page.find(params[:page_id]) @page = Page.find(params[:page_id]) rescue nil
if !params[:search_query].blank? if !params[:search_query].blank?
# search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending=>false,:is_pending=>false} # 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? # search_cond.merge!({:news_bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?

View File

@ -2,7 +2,7 @@
<%= flash_messages %> <%= flash_messages %>
<h1 class="h1"><%= @page.title %></h1> <h1 class="h1"><%= @page.title rescue nil %></h1>
<% if !params[:name].blank?%> <% if !params[:name].blank?%>
<%= t("search.unit_get",:unit_name => UnitListForAnc.find(params[:name]).title,:item_num=>@news_bulletins.count) %> <%= t("search.unit_get",:unit_name => UnitListForAnc.find(params[:name]).title,:item_num=>@news_bulletins.count) %>

View File

@ -2,7 +2,7 @@ xml.instruct! :xml, :version => "1.0"
xml.rss :version => "2.0" do xml.rss :version => "2.0" do
xml.channel do xml.channel do
if @current_category if @current_category
xml.title @current_category.i18n_variable[I18n.locale] xml.title @current_category.title_translations[I18n.locale.to_s]
else else
xml.title t('news.campus_news') xml.title t('news.campus_news')
end end
@ -10,8 +10,8 @@ xml.rss :version => "2.0" do
for news_bulletin in @news_bulletins for news_bulletin in @news_bulletins
xml.item do xml.item do
xml.title news_bulletin.title[I18n.locale] xml.title news_bulletin.title_translations[I18n.locale.to_s]
xml.description news_bulletin.text[I18n.locale] xml.description news_bulletin.subtitle_translations[I18n.locale.to_s]
xml.pubDate news_bulletin.postdate.to_s(:rfc822) xml.pubDate news_bulletin.postdate.to_s(:rfc822)
xml.link panel_news_front_end_news_bulletin_path(news_bulletin, :rss) xml.link panel_news_front_end_news_bulletin_path(news_bulletin, :rss)
xml.guid panel_news_front_end_news_bulletin_path(news_bulletin, :rss) xml.guid panel_news_front_end_news_bulletin_path(news_bulletin, :rss)

View File

@ -2,7 +2,7 @@ xml.instruct! :xml, :version => "1.0"
xml.rss :version => "2.0" do xml.rss :version => "2.0" do
xml.channel do xml.channel do
if @current_category if @current_category
xml.title @current_category.i18n_variable[I18n.locale] xml.title @current_category.title_translations[I18n.locale.to_s]
else else
xml.title t('news.campus_news') xml.title t('news.campus_news')
end end