Fix approval

This commit is contained in:
spen 2014-03-21 14:42:06 +08:00
parent d9dd08e678
commit 24ef9c848c
2 changed files with 5 additions and 2 deletions

View File

@ -42,6 +42,9 @@ class Bulletin
field :email_group, :type => Array field :email_group, :type => Array
field :other_mailaddress field :other_mailaddress
scope :can_display, where(is_checked: true, is_rejected: false, is_pending: false)
scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
mount_uploader :image, ImageUploader mount_uploader :image, ImageUploader
has_many :bulletin_links, :autosave => true, :dependent => :destroy has_many :bulletin_links, :autosave => true, :dependent => :destroy

View File

@ -28,13 +28,13 @@ module Announcement
data_count 1..10 data_count 1..10
authorizable authorizable
# approvable approvable
categorizable categorizable
taggable taggable
widgets do widgets do
default_widget do default_widget do
query 'Bulletin' query 'Bulletin.can_display.available_for_lang(I18n.locale).any_of( {deadline: nil,:postdate.lte => Time.now} , {:deadline.gte => Time.now,:postdate.lte => Time.now} )'
enable ["typeA", "typeB_style3", "typeC"] enable ["typeA", "typeB_style3", "typeC"]
image :image image :image
field :postdate field :postdate