From bb154f5be6975ed38334b7f8d1d81a5d75beb872 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Mon, 30 Jul 2012 16:38:02 +0800 Subject: [PATCH] fix error when creating bulletin and news --- .../panel/announcement/back_end/bulletins_controller.rb | 2 +- .../built_in_modules/announcement/app/models/bulletin.rb | 4 ++-- .../panel/news/back_end/news_bulletins_controller.rb | 7 ++++--- vendor/built_in_modules/news/app/models/news_bulletin.rb | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index c20b24a72..466ba1401 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -5,7 +5,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController layout 'new_admin' before_filter :authenticate_user! - before_filter :only => [ :new,:create,:edit,:update] do |controller| + before_filter :only => [ :new,:create,:edit,:update,:create] do |controller| controller.get_categorys('BulletinCategory') end # before_filter :for_admin_only,:only => [:] diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index 8da5452bd..b0be2996e 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -76,11 +76,11 @@ class Bulletin # end def s_title - self.title.zh_tw + self.title_translations[:zh_tw] end def s_title_en - self.title.en + self.title_translations[:en] end # def s_text_en diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb index 4d7a8ab5c..8ada0a012 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb @@ -5,7 +5,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController # before_filter :for_admin_only,:only => [:] # before_filter :for_app_manager,:only => [:index,:show,] before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_news_bulletins] - before_filter :only => [ :new,:edit,:update] do |controller| + before_filter :only => [ :new,:edit,:update,:create] do |controller| controller.get_categorys('NewsBulletinCategory') controller.get_unit_list end @@ -117,7 +117,8 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController # POST /news_bulletins # POST /news_bulletins.xml def create - + get_tags + if params[:news_bulletin_link] @news_bulletin_link = NewsBulletinLink.new(params[:news_bulletin_link]) @@ -142,7 +143,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController else @news_bulletin = NewsBulletin.new(params[:news_bulletin]) - @news_bulletin.deadline = nil if (@news_bulletin.deadline < @news_bulletin.postdate rescue nil) + @news_bulletin.deadline = nil if (@news_bulletin.deadline < @news_bulletin.postdate rescue nil) @news_bulletin.create_user_id = current_user.id @news_bulletin.update_user_id = current_user.id diff --git a/vendor/built_in_modules/news/app/models/news_bulletin.rb b/vendor/built_in_modules/news/app/models/news_bulletin.rb index 1f974e6ab..bf468f898 100644 --- a/vendor/built_in_modules/news/app/models/news_bulletin.rb +++ b/vendor/built_in_modules/news/app/models/news_bulletin.rb @@ -101,11 +101,11 @@ class NewsBulletin # end def s_title - self.title.zh_tw + self.title_translations[:zh_tw] end def s_title_en - self.title.en + self.title_translations[:en] end # def s_text_en