Fix is_preview

This commit is contained in:
manson 2014-06-17 19:19:57 +08:00
parent cb7769ea4f
commit ae93ba9309
2 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@ class Admin::AnnouncementsController < OrbitAdminController
@filter_fields = filter_fields(@categories, @tags) @filter_fields = filter_fields(@categories, @tags)
@table_fields = [:status, :category, :title, :start_date, :end_date, :last_modified] @table_fields = [:status, :category, :title, :start_date, :end_date, :last_modified]
@bulletins = Bulletin.where(:is_preview=>false).order_by(sort).with_categories(filters("category")).with_tags(filters("tag")).with_status(filters("status")).page(params[:page]).per(10) @bulletins = Bulletin.where(:is_preview.in=>[false,nil]).order_by(sort).with_categories(filters("category")).with_tags(filters("tag")).with_status(filters("status")).page(params[:page]).per(10)
if request.xhr? if request.xhr?
render :partial => "index" render :partial => "index"

View File

@ -1,7 +1,7 @@
class AnnouncementsController < ApplicationController class AnnouncementsController < ApplicationController
def index def index
announcements = Bulletin.where(:is_preview=>false).can_display.order_by(:created_at=>'desc').filter_by_categories announcements = Bulletin.where(:is_preview.in=>[false,nil]).can_display.order_by(:created_at=>'desc').filter_by_categories
anns = announcements.collect do |a| anns = announcements.collect do |a|
statuses = a.statuses.collect do |status| statuses = a.statuses.collect do |status|
{ {
@ -28,7 +28,7 @@ class AnnouncementsController < ApplicationController
end end
def widget def widget
announcements = Bulletin.where(:is_preview=>false).can_display.order_by(:created_at=>'desc').filter_by_widget_categories announcements = Bulletin.where(:is_preview.in=>[false,nil]).can_display.order_by(:created_at=>'desc').filter_by_widget_categories
anns = announcements.collect do |a| anns = announcements.collect do |a|
statuses = a.statuses.collect do |status| statuses = a.statuses.collect do |status|
{ {