check deadline for news
This commit is contained in:
parent
e57b429398
commit
77224bcc8f
|
@ -205,10 +205,9 @@ class Bulletin
|
|||
protected
|
||||
|
||||
def check_deadline
|
||||
if(!self.deadline.nil? and (self.deadline<= self.postdate ))
|
||||
if(!self.deadline.nil? and (self.deadline < self.postdate ))
|
||||
self.deadline = nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
|
|
|
@ -267,7 +267,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
|||
# @news_bulletin.image_del = nil
|
||||
# params[:news_bulletin][:image_del] = nil
|
||||
# end
|
||||
|
||||
delete_out_invalid_date_from_params
|
||||
respond_to do |format|
|
||||
if @news_bulletin.update_attributes(params[:news_bulletin])
|
||||
if(is_manager? || is_admin?)
|
||||
|
@ -335,7 +335,14 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
|||
end
|
||||
|
||||
|
||||
protected
|
||||
protected
|
||||
def delete_out_invalid_date_from_params()
|
||||
if(params[:news_bulletin]["deadline(1i)"].blank? or params[:news_bulletin]["deadline(2i)"].blank? or params[:news_bulletin]["deadline(3i)"].blank?)
|
||||
params[:news_bulletin].delete("deadline(1i)")
|
||||
params[:news_bulletin].delete("deadline(2i)")
|
||||
params[:news_bulletin].delete("deadline(3i)")
|
||||
end
|
||||
end
|
||||
|
||||
# def get_categories_for_index(id = nil)
|
||||
# @news_bulletin_categories = []
|
||||
|
|
|
@ -61,6 +61,7 @@ class NewsBulletin
|
|||
|
||||
validates :title, :at_least_one => true
|
||||
|
||||
before_save :check_deadline
|
||||
before_save :update_avliable_language
|
||||
|
||||
after_save :save_news_bulletin_links
|
||||
|
@ -248,4 +249,11 @@ class NewsBulletin
|
|||
end
|
||||
end
|
||||
|
||||
def check_deadline
|
||||
if(!self.deadline.nil? and (self.deadline < self.postdate ))
|
||||
self.deadline = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue