From 4666057748ebbfa5520fcad644860f0feb62e798 Mon Sep 17 00:00:00 2001 From: Bernie Chiu Date: Wed, 13 Nov 2013 15:03:03 +0800 Subject: [PATCH] Add RSS source link and site info --- vendor/built_in_modules/announcement/app/models/bulletin.rb | 1 + .../panel/announcement/front_end/bulletins/show.html.erb | 6 +++++- .../built_in_modules/announcement/config/locales/zh_tw.yml | 2 ++ .../announcement/lib/rss_ntu_ga_aggregate.rb | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index a3c1ab5cb..6b35e186f 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -42,6 +42,7 @@ class Bulletin field :public, :type => Boolean, :default => true field :rss_link + field :rss_resource scope :can_display, where(is_checked: true, is_rejected: false, is_pending: false) scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) } diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb index 6f10b3480..770d274f7 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb @@ -39,7 +39,11 @@ <% end %> <% unless @bulletin.rss_link.blank? %>
- <%= link_to t('ntu.rss_origin'), @bulletin.rss_link %> + <%= link_to t('announcement.rss_origin'), @bulletin.rss_link %> + <% unless @bulletin.rss_source.blank? %> +
+ <%= t('announcement.source') %>: <%= @bulletin.rss_source %> + <% end %>
<% end %> diff --git a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml index b3bf356f9..38a4ff433 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -1,6 +1,8 @@ zh_tw: announcement: + rss_origin: 回臺大校園公告 + source: 單位來源 add_new: 新建 all_articles: 文章列表 announcement: 公告 diff --git a/vendor/built_in_modules/announcement/lib/rss_ntu_ga_aggregate.rb b/vendor/built_in_modules/announcement/lib/rss_ntu_ga_aggregate.rb index b61333391..e9e3e0fc2 100644 --- a/vendor/built_in_modules/announcement/lib/rss_ntu_ga_aggregate.rb +++ b/vendor/built_in_modules/announcement/lib/rss_ntu_ga_aggregate.rb @@ -32,7 +32,7 @@ SITES.each do |name, url| if item.pubDate > yesterday recent_feed[item.title.strip] = { date: item.pubDate, description: item.description.gsub("\r\n", '
').strip, - link: item.link, category: category } + link: item.link, category: category, source: name } end end @@ -87,6 +87,7 @@ recent_feed.each do |title, bulletin| text: {:zh_tw => bulletin[:description]}, available_for_zh_tw: true, rss_link: bulletin[:link], + rss_source: bulletin[:source], is_top: false, is_hot: false, is_hidden: false }