diff --git a/app/controllers/admin/custom_announcements_controller.rb b/app/controllers/admin/custom_announcements_controller.rb index 1f722de..87b2009 100644 --- a/app/controllers/admin/custom_announcements_controller.rb +++ b/app/controllers/admin/custom_announcements_controller.rb @@ -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")) diff --git a/app/controllers/custom_announcements_controller.rb b/app/controllers/custom_announcements_controller.rb index b98a133..8b14d6e 100644 --- a/app/controllers/custom_announcements_controller.rb +++ b/app/controllers/custom_announcements_controller.rb @@ -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) diff --git a/app/models/custom_bulletin.rb b/app/models/custom_bulletin.rb index 14bacb7..953490b 100644 --- a/app/models/custom_bulletin.rb +++ b/app/models/custom_bulletin.rb @@ -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