Revert "Do not show announcement in json and rss if no title in I18n.locale"

This reverts commit 03189092d3.
This commit is contained in:
chris 2013-09-17 20:47:03 +08:00 committed by saurabhbhatia
parent faabedad55
commit 5b60e389ec
2 changed files with 18 additions and 23 deletions

View File

@ -332,7 +332,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
respond_to do |format| respond_to do |format|
format.json { format.json {
custom_bulletins = @bulletins.inject([]) do |data, bulletin| custom_bulletins = @bulletins.inject([]) do |data, bulletin|
unless bulletin.title_translations[I18n.locale.to_s].blank?
deadline = bulletin.deadline.nil? ? t(:no_deadline) : display_date_time(bulletin.deadline) deadline = bulletin.deadline.nil? ? t(:no_deadline) : display_date_time(bulletin.deadline)
image_url = "#{'/' unless bulletin.image.url.start_with?('/')}#{bulletin.image.url}" image_url = "#{'/' unless bulletin.image.url.start_with?('/')}#{bulletin.image.url}"
data << { data << {
@ -346,8 +345,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
tag: bulletin.sorted_tags.map{|tag| tag.name} tag: bulletin.sorted_tags.map{|tag| tag.name}
} }
end end
data
end
render json: JSON.pretty_generate(custom_bulletins) render json: JSON.pretty_generate(custom_bulletins)
} }
format.rss { format.rss {

View File

@ -9,7 +9,6 @@ xml.rss :version => "2.0" do
xml.link "#{request.protocol}#{request.host_with_port}#{get_bulletins_panel_announcement_back_end_bulletins_path(bulletin_category_id: @category.try(:id))}.rss" xml.link "#{request.protocol}#{request.host_with_port}#{get_bulletins_panel_announcement_back_end_bulletins_path(bulletin_category_id: @category.try(:id))}.rss"
@bulletins.each do |bulletin| @bulletins.each do |bulletin|
unless bulletin.title_translations[I18n.locale.to_s].blank?
xml.item do xml.item do
xml.title bulletin.title xml.title bulletin.title
xml.pubDate bulletin.postdate.to_s(:rfc822) xml.pubDate bulletin.postdate.to_s(:rfc822)
@ -19,5 +18,4 @@ xml.rss :version => "2.0" do
end end
end end
end end
end
end end