From 663bb7776b9b8b36dba6d1b70adbab7b5c957752 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 17 Sep 2013 23:11:23 +0800 Subject: [PATCH] Modification in rss feed for announcement: - subtitle instead of text - add rss link in the json for categories --- .../announcement/back_end/bulletin_categorys_controller.rb | 5 +++-- .../panel/announcement/back_end/bulletins_controller.rb | 2 +- .../back_end/bulletins/get_bulletins.rss.builder | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb index 4e33dcd23..9560b5165 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb @@ -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) diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index 4e12455d0..ac19b4687 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -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} diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/get_bulletins.rss.builder b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/get_bulletins.rss.builder index aa7c1e5be..ca8df5c6c 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/get_bulletins.rss.builder +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/get_bulletins.rss.builder @@ -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