Updated.
This commit is contained in:
parent
ca1a85929d
commit
6d14f05e15
|
@ -38,7 +38,7 @@ class Admin::CustomAnnouncementsController < OrbitAdminController
|
|||
if current_user_is_sub_manager
|
||||
@categories = current_user.approved_categories.select{|c| c.module_app_id == @module_app.id} rescue []
|
||||
@filter_fields = filter_fields(@categories, @tags)
|
||||
@custom_bulletins = CustomBulletin.where(:create_user_id=>current_user.id,:title.ne => "",:is_preview.in=>[false,nil])
|
||||
@custom_bulletins = CustomBulletin.where(:create_user_id=>current_user.id,:is_preview.in=>[false,nil])
|
||||
.order_by(sort)
|
||||
.with_categories(filters("category"))
|
||||
.with_tags(filters("tag"))
|
||||
|
@ -51,7 +51,7 @@ class Admin::CustomAnnouncementsController < OrbitAdminController
|
|||
else
|
||||
@categories = @module_app.categories.enabled
|
||||
@filter_fields = filter_fields(@categories, @tags)
|
||||
@custom_bulletins = CustomBulletin.where(:title.ne => "",:is_preview.in=>[false,nil])
|
||||
@custom_bulletins = CustomBulletin.where(:is_preview.in=>[false,nil])
|
||||
.order_by(sort)
|
||||
.with_categories(filters("category"))
|
||||
.with_tags(filters("tag"))
|
||||
|
|
|
@ -98,7 +98,10 @@ class CustomAnnouncementsController < ApplicationController
|
|||
def self.custom_widget_data
|
||||
@custom_configs = CustomBulletinConfig.all.to_a
|
||||
ac = ActionController::Base.new
|
||||
ac.render_to_string("custom_announcements/custom_widget_data",:locals=>{:@custom_data_field=>@custom_data_field,:@custom_configs=>@custom_configs,:@field_name=>@field_name})
|
||||
ac.instance_variable_set(:@custom_data_field, @custom_data_field)
|
||||
ac.instance_variable_set(:@custom_configs, @custom_configs)
|
||||
ac.instance_variable_set(:@field_name, @field_name)
|
||||
ac.render_to_string("custom_announcements/custom_widget_data")
|
||||
end
|
||||
def random_custom_announcement_widget
|
||||
pack_data(true)
|
||||
|
|
|
@ -98,7 +98,7 @@ class CustomBulletin
|
|||
target_model = custom_bulletin_config.bind_model.constantize rescue nil
|
||||
if target_model
|
||||
target_record = target_model.where(custom_bulletin_config.uid_field=>self.bind_uid).first
|
||||
target_record.send(custom_bulletin_config.custom_record_callback,num)
|
||||
target_record.send(custom_bulletin_config.custom_record_callback,num) if target_record
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue