Change for date

This commit is contained in:
Christophe Vilayphiou 2012-08-14 15:11:52 +08:00
parent fb53ad524a
commit efaed060d9
4 changed files with 10 additions and 7 deletions

View File

@ -300,13 +300,14 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
protected
def delete_out_invalid_date_from_params()
def delete_out_invalid_date_from_params
if(params[:bulletin]["deadline(1i)"].blank? or params[:bulletin]["deadline(2i)"].blank? or params[:bulletin]["deadline(3i)"].blank?)
params[:bulletin].delete("deadline(1i)")
params[:bulletin].delete("deadline(2i)")
params[:bulletin].delete("deadline(3i)")
params[:bulletin].delete("deadline(4i)")
params[:bulletin].delete("deadline(5i)")
@bulletin.deadline = nil
end rescue nil
end

View File

@ -25,13 +25,13 @@
<div class="control-group">
<label class="control-label"><%= t(:start) %></label>
<div class="controls">
<%= f.datetime_select :postdate, {}, :class => 'input-small' %>
<%= f.datetime_select :postdate, { :use_month_numbers => true, :order => [:day, :month, :year] }, :class => 'input-small' %>
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t(:end) %></label>
<div class="controls">
<%= f.datetime_select :deadline, {}, :class => 'input-small' %>
<%= f.datetime_select :deadline, { :use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, :class => 'input-small' %>
</div>
</div>
</div>

View File

@ -335,12 +335,14 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
end
protected
def delete_out_invalid_date_from_params()
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)")
@news_bulletin.deadline = nil
end rescue nil
end

View File

@ -25,13 +25,13 @@
<div class="control-group">
<label class="control-label"><%= t(:start) %></label>
<div class="controls">
<%= f.date_select :postdate, {}, :class => 'input-small' %>
<%= f.date_select :postdate, { :use_month_numbers => true, :order => [:day, :month, :year] }, :class => 'input-small' %>
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t(:end) %></label>
<div class="controls">
<%= f.date_select :deadline, {}, :class => 'input-small' %>
<%= f.date_select :deadline, { :use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, :class => 'input-small' %>
</div>
</div>
</div>