Add RSS source link and site info

This commit is contained in:
Bernie Chiu 2013-11-13 15:03:03 +08:00
parent d10b647661
commit 4666057748
4 changed files with 10 additions and 2 deletions

View File

@ -42,6 +42,7 @@ class Bulletin
field :public, :type => Boolean, :default => true field :public, :type => Boolean, :default => true
field :rss_link field :rss_link
field :rss_resource
scope :can_display, where(is_checked: true, is_rejected: false, is_pending: false) 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) } scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }

View File

@ -39,7 +39,11 @@
<% end %> <% end %>
<% unless @bulletin.rss_link.blank? %> <% unless @bulletin.rss_link.blank? %>
<div> <div>
<%= link_to t('ntu.rss_origin'), @bulletin.rss_link %> <%= link_to t('announcement.rss_origin'), @bulletin.rss_link %>
<% unless @bulletin.rss_source.blank? %>
<br />
<%= t('announcement.source') %>: <%= @bulletin.rss_source %>
<% end %>
</div> </div>
<% end %> <% end %>
</div> </div>

View File

@ -1,6 +1,8 @@
zh_tw: zh_tw:
announcement: announcement:
rss_origin: 回臺大校園公告
source: 單位來源
add_new: 新建 add_new: 新建
all_articles: 文章列表 all_articles: 文章列表
announcement: 公告 announcement: 公告

View File

@ -32,7 +32,7 @@ SITES.each do |name, url|
if item.pubDate > yesterday if item.pubDate > yesterday
recent_feed[item.title.strip] = { date: item.pubDate, description: item.description.gsub("\r\n", '<br/>').strip, recent_feed[item.title.strip] = { date: item.pubDate, description: item.description.gsub("\r\n", '<br/>').strip,
link: item.link, category: category } link: item.link, category: category, source: name }
end end
end end
@ -87,6 +87,7 @@ recent_feed.each do |title, bulletin|
text: {:zh_tw => bulletin[:description]}, text: {:zh_tw => bulletin[:description]},
available_for_zh_tw: true, available_for_zh_tw: true,
rss_link: bulletin[:link], rss_link: bulletin[:link],
rss_source: bulletin[:source],
is_top: false, is_top: false,
is_hot: false, is_hot: false,
is_hidden: false } is_hidden: false }