added source filter
This commit is contained in:
parent
e0d0a2aaa6
commit
e0b0ffcd09
|
@ -8,9 +8,14 @@ class AnnouncementsController < ApplicationController
|
|||
if !params['tags'].blank?
|
||||
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).and(:title.ne => nil).can_display.is_approved.filter_by_tags(params['tags']).page(OrbitHelper.page_number).per(OrbitHelper.page_data_count).to_a
|
||||
else
|
||||
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).and(:title.ne => nil, :is_top.ne => true).can_display.is_approved.filter_by_categories([],false).filter_by_tags.to_a
|
||||
|
||||
feeds_anns = get_feed_announcements("index")
|
||||
|
||||
if !params["source"].present?
|
||||
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).and(:title.ne => nil, :is_top.ne => true).can_display.is_approved.filter_by_categories([],false).filter_by_tags.to_a
|
||||
feeds_anns = get_feed_announcements("index")
|
||||
else
|
||||
announcements = []
|
||||
feeds_anns = get_feed_announcements("index",params["source"])
|
||||
end
|
||||
end
|
||||
|
||||
if OrbitHelper.page_number == 1 or OrbitHelper.page_number.nil?
|
||||
|
@ -73,7 +78,7 @@ class AnnouncementsController < ApplicationController
|
|||
"view_count" => a.view_count
|
||||
}
|
||||
else
|
||||
anns << a
|
||||
anns << a if a["source-site-title"] == params["source"]
|
||||
end
|
||||
end
|
||||
#If no data , hide title&table
|
||||
|
@ -104,11 +109,12 @@ class AnnouncementsController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
def get_feed_announcements(type)
|
||||
def get_feed_announcements(type,source=nil)
|
||||
feed_anns = OrbitHelper.get_feed_for_module(type)
|
||||
fans = []
|
||||
locale = OrbitHelper.get_site_locale.to_s
|
||||
feed_anns.each do |fa|
|
||||
next if !source.nil? && source != fa["source-site-title"]
|
||||
status = {
|
||||
"status" => "<a href='#{fa["source-site"]}' target='_blank' class='feed-source'>#{fa["source-site-title"]}</a>",
|
||||
"status-class" => "status-source"
|
||||
|
|
Loading…
Reference in New Issue