fix tag & category
This commit is contained in:
parent
4a257f7590
commit
12a692d886
|
@ -1,11 +1,26 @@
|
||||||
class AnnouncementsController < ApplicationController
|
class AnnouncementsController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
if !OrbitHelper.params['tags'].blank?
|
params = OrbitHelper.params
|
||||||
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).can_display.is_approved.order_by(:postdate=>'desc').filter_by_tags(OrbitHelper.params['tags']).page(OrbitHelper.page_number).per(OrbitHelper.page_data_count)
|
announcements = nil
|
||||||
|
|
||||||
|
if params[:tag]
|
||||||
|
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"}
|
||||||
|
announcements = Bulletin.where(:title.ne => "" ,:is_preview.in=>[false,nil]).is_approved.order_by(sort).filter_by_categories(["all"]).filter_by_tags([params[:tag]])
|
||||||
else
|
else
|
||||||
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).can_display.is_approved.order_by(:postdate=>'desc').filter_by_categories.filter_by_tags
|
sort = ( !params[:sort].blank? ? {params[:sort].to_sym=>params[:order]} : {:postdate=>"desc"})
|
||||||
|
|
||||||
|
if OrbitHelper.page_categories.first == "all"
|
||||||
|
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).can_display.is_approved.order_by(sort).filter_by_tags.page(params[:page_no]).per(OrbitHelper.page_data_count)
|
||||||
|
else
|
||||||
|
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).can_display.is_approved.order_by(sort).filter_by_categories.filter_by_tags.page(params[:page_no]).per(OrbitHelper.page_data_count)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
# if !OrbitHelper.params['tags'].blank?
|
||||||
|
# announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).can_display.is_approved.order_by(:postdate=>'desc').filter_by_tags(OrbitHelper.params['tags']).page(OrbitHelper.page_number).per(OrbitHelper.page_data_count)
|
||||||
|
# else
|
||||||
|
# announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).can_display.is_approved.order_by(:postdate=>'desc').filter_by_categories.filter_by_tags
|
||||||
|
# end
|
||||||
|
|
||||||
anns = announcements.collect do |a|
|
anns = announcements.collect do |a|
|
||||||
statuses = a.statuses_with_classname.collect do |status|
|
statuses = a.statuses_with_classname.collect do |status|
|
||||||
|
|
Loading…
Reference in New Issue