small fix

This commit is contained in:
Harry Bomrah 2016-04-27 19:28:30 +08:00
parent 8e9e1f1609
commit 8490db6992
1 changed files with 6 additions and 7 deletions

View File

@ -18,11 +18,10 @@ class AnnouncementsController < ApplicationController
end
end
if !params["source"].present?
if (OrbitHelper.page_number == 1 or OrbitHelper.page_number.nil?)
top_anns = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil], :is_top => true).and(:title.ne => nil).can_display.filter_by_categories([],false).to_a
end
if (OrbitHelper.page_number == 1 or OrbitHelper.page_number.nil?) && !params["source"].present?
top_anns = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil], :is_top => true).and(:title.ne => nil).can_display.filter_by_categories([],false).to_a
end
if !feeds_anns.blank?
announcements = announcements.concat(feeds_anns)
sorted = announcements.sort{ |k,v| v["postdate"] <=> k["postdate"] }
@ -80,7 +79,7 @@ class AnnouncementsController < ApplicationController
"view_count" => a.view_count
}
else
anns << a if a["source-site-title"] == params["source"]
anns << a
end
end
#If no data , hide title&table
@ -111,12 +110,12 @@ class AnnouncementsController < ApplicationController
end
def get_feed_announcements(type,source=nil)
def get_feed_announcements(type,site_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"]
next if !site_source.nil? && site_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"