parent
308370c4df
commit
497dc63351
|
@ -11,6 +11,7 @@ class Admin::BulletinsController < ApplicationController
|
||||||
per_page = params[:per_page].blank? ? 10 : params[:per_page].to_i
|
per_page = params[:per_page].blank? ? 10 : params[:per_page].to_i
|
||||||
per_page = per_page > 0 ? per_page : 10
|
per_page = per_page > 0 ? per_page : 10
|
||||||
|
|
||||||
|
I18n.locale = :zh_tw
|
||||||
if !params[:keyword].blank?
|
if !params[:keyword].blank?
|
||||||
keyword = Regexp.new(".*"+params[:keyword]+".*")
|
keyword = Regexp.new(".*"+params[:keyword]+".*")
|
||||||
bulletins = Bulletin.any_of({:title=>keyword},{:subtitle=>keyword},{:text=>keyword})
|
bulletins = Bulletin.any_of({:title=>keyword},{:subtitle=>keyword},{:text=>keyword})
|
||||||
|
@ -18,6 +19,15 @@ class Admin::BulletinsController < ApplicationController
|
||||||
bulletins = Bulletin.all
|
bulletins = Bulletin.all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if !params[:category].blank?
|
||||||
|
module_id = ModuleApp.where(:key=>"announcement").first.id
|
||||||
|
category = Regexp.new(".*"+params[:category]+".*")
|
||||||
|
category_id = Category.where(:title => category, :module_app_id => module_id).first.id
|
||||||
|
bulletins = bulletins.where(:category_id => category_id)
|
||||||
|
else
|
||||||
|
bulletins = bulletins
|
||||||
|
end
|
||||||
|
|
||||||
bulletins = bulletins.where(:is_preview.in=>[false,nil])
|
bulletins = bulletins.where(:is_preview.in=>[false,nil])
|
||||||
bulletins = bulletins.where(:approved.ne => false , :rejected.ne => true)
|
bulletins = bulletins.where(:approved.ne => false , :rejected.ne => true)
|
||||||
bulletins = bulletins.where(:postdate.lt=>Time.now)
|
bulletins = bulletins.where(:postdate.lt=>Time.now)
|
||||||
|
|
Loading…
Reference in New Issue