Modification in rss feed for announcement:

- subtitle instead of text
	- add rss link in the json for categories
This commit is contained in:
chris 2013-09-17 23:11:23 +08:00 committed by saurabhbhatia
parent 93424e1972
commit 5c0d16c22e
3 changed files with 6 additions and 5 deletions

View File

@ -61,8 +61,9 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo
custom_categories = @categories.inject([]) do |data, category|
data << {
title: category.title,
link: "#{request.protocol}#{request.host_with_port}#{panel_announcement_front_end_bulletins_path(bulletin_category_id: category.id, locale: I18n.locale)}",
link_json: "#{request.protocol}#{request.host_with_port}#{get_bulletins_panel_announcement_back_end_bulletins_path(category_id: category.id, locale: I18n.locale)}"
link_html: "#{request.protocol}#{request.host_with_port}#{panel_announcement_front_end_bulletins_path(bulletin_category_id: category.id, locale: I18n.locale)}",
link_json: "#{request.protocol}#{request.host_with_port}#{get_bulletins_panel_announcement_back_end_bulletins_path(category_id: category.id, locale: I18n.locale, format: 'json')}",
link_rss: "#{request.protocol}#{request.host_with_port}#{get_bulletins_panel_announcement_back_end_bulletins_path(category_id: category.id, locale: I18n.locale, format: 'rss')}"
}
end
render json: JSON.pretty_generate(custom_categories)

View File

@ -340,7 +340,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
link: "#{request.protocol}#{request.host_with_port}#{panel_announcement_front_end_bulletin_path(bulletin, category_id: bulletin.bulletin_category.id, locale: I18n.locale)}",
image: "#{request.protocol}#{request.host_with_port}#{image_url}",
category: bulletin.bulletin_category.title,
content: bulletin.text,
description: bulletin.subtitle,
postdate: display_date_time(bulletin.postdate),
deadline: deadline,
tag: bulletin.sorted_tags.map{|tag| tag.name}

View File

@ -6,13 +6,13 @@ xml.rss :version => "2.0" do
else
xml.title t('announcement.announcement')
end
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), format: 'rss')}"
@bulletins.each do |bulletin|
xml.item do
xml.title bulletin.title
xml.pubDate bulletin.postdate.to_s(:rfc822)
xml.description bulletin.text
xml.description bulletin.subtitle
xml.link "#{request.protocol}#{request.host_with_port}#{panel_announcement_front_end_bulletin_path(bulletin, category_id: bulletin.bulletin_category.id, locale: I18n.locale)}"
xml.guid "#{request.protocol}#{request.host_with_port}#{panel_announcement_front_end_bulletin_path(bulletin)}"
end