From 62288a71ca8008fa2c2f94e6494a43edcbe0e221 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 16 Jul 2013 11:41:22 +0800 Subject: [PATCH] Fix category_id in forms Fix statuses list --- app/controllers/orbit_backend_controller.rb | 8 +++++--- lib/orbit_category/categorizable.rb | 6 +++++- .../panel/announcement/back_end/bulletins/_form.html.erb | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index 510b09eb8..2d220cfab 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -21,9 +21,11 @@ class OrbitBackendController < ApplicationController status << 'is_top' status << 'is_hot' status << 'is_hidden' unless is_guest? - status << 'is_pending' if is_manager? - status << 'is_checked' if is_manager? - status << 'is_rejected' if is_manager? + if @module_app.is_approvable && is_manager? + status << 'is_pending' + status << 'is_checked' + status << 'is_rejected' + end status end diff --git a/lib/orbit_category/categorizable.rb b/lib/orbit_category/categorizable.rb index 3cd295447..1d23fba93 100644 --- a/lib/orbit_category/categorizable.rb +++ b/lib/orbit_category/categorizable.rb @@ -31,7 +31,11 @@ module OrbitCategory def category=(id) self.buffer_category.destroy if self.buffer_category self.build_buffer_category(category_id: id) - self.category_id = id + self.write_attribute(:category_id, id) + end + + def category_id=(id) + category = id end def disable? diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 80f80b60c..14bdb653f 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -51,7 +51,7 @@
- <%= f.select :category, @categories.collect{|t| [ t.title, t.id ]} %> + <%= f.select :category_id, @categories.collect{|t| [ t.title, t.id ]} %>