fix error when creating bulletin and news

This commit is contained in:
Matthew K. Fu JuYuan 2012-07-30 16:38:02 +08:00
parent 4e1a91ed90
commit bb154f5be6
4 changed files with 9 additions and 8 deletions

View File

@ -5,7 +5,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
layout 'new_admin' layout 'new_admin'
before_filter :authenticate_user! 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') controller.get_categorys('BulletinCategory')
end end
# before_filter :for_admin_only,:only => [:] # before_filter :for_admin_only,:only => [:]

View File

@ -76,11 +76,11 @@ class Bulletin
# end # end
def s_title def s_title
self.title.zh_tw self.title_translations[:zh_tw]
end end
def s_title_en def s_title_en
self.title.en self.title_translations[:en]
end end
# def s_text_en # def s_text_en

View File

@ -5,7 +5,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
# before_filter :for_admin_only,:only => [:] # before_filter :for_admin_only,:only => [:]
# before_filter :for_app_manager,:only => [:index,:show,] # 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 :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_categorys('NewsBulletinCategory')
controller.get_unit_list controller.get_unit_list
end end
@ -117,6 +117,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
# POST /news_bulletins # POST /news_bulletins
# POST /news_bulletins.xml # POST /news_bulletins.xml
def create def create
get_tags
if params[:news_bulletin_link] if params[:news_bulletin_link]
@ -142,7 +143,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
else else
@news_bulletin = NewsBulletin.new(params[:news_bulletin]) @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.create_user_id = current_user.id
@news_bulletin.update_user_id = current_user.id @news_bulletin.update_user_id = current_user.id

View File

@ -101,11 +101,11 @@ class NewsBulletin
# end # end
def s_title def s_title
self.title.zh_tw self.title_translations[:zh_tw]
end end
def s_title_en def s_title_en
self.title.en self.title_translations[:en]
end end
# def s_text_en # def s_text_en