Update disable time when separated picker new or reset date

This commit is contained in:
chris 2013-01-09 18:00:38 +08:00
parent b49251afee
commit 48ce2278d0
2 changed files with 5 additions and 5 deletions

View File

@ -13,15 +13,14 @@ $(document).ready(function(){
$('.separated_picker div').on("changeDate",function(){ $('.separated_picker div').on("changeDate",function(){
if ($(this).hasClass('date_picker')) if ($(this).hasClass('date_picker'))
{ {
if ($(this).find('input').val()) if ($(this).find('input').val() && $(this).siblings('div').css('pointer-events'))
{ {
$(this).siblings('div').css('pointer-events', '');
} }
else else
{ {
$(this).siblings('div').find('input').val(null); $(this).siblings('div').find('input').val(null);
$(this).siblings('div').disabled = true; $(this).siblings('div').css('pointer-events', 'none');
$(this).siblings('div').unbind('click');
} }
} }
$(this).siblings('input').val($(this).find('input').val() + ' ' + $(this).siblings('div').find('input').val()); $(this).siblings('input').val($(this).find('input').val() + ' ' + $(this).siblings('div').find('input').val());

View File

@ -65,6 +65,7 @@ module OrbitFormHelper
def separated_picker(object_name, method, options) def separated_picker(object_name, method, options)
custom = {} custom = {}
custom[:no_label] = true custom[:no_label] = true
custom[:separated] = true
date_picker(nil, nil, options.merge(custom)) + time_picker(nil, nil, options.merge(custom)) date_picker(nil, nil, options.merge(custom)) + time_picker(nil, nil, options.merge(custom))
end end
@ -80,7 +81,7 @@ module OrbitFormHelper
end end
def picker(object_name, method, options) def picker(object_name, method, options)
content_tag :div, :class => "#{options[:picker_class]} input-append" do content_tag :div, :class => "#{options[:picker_class]} input-append", :style => "#{(options[:picker_class].eql?('time_picker') && options[:value].blank? && options[:separated]) ? 'pointer-events:none' : nil}" do
concat label_tag options[:label] unless options[:no_label] concat label_tag options[:label] unless options[:no_label]
concat text_field object_name, method, :placeholder => options[:placeholder], :class => options[:input_class], 'data-format' => options[:format], :value => options[:value] concat text_field object_name, method, :placeholder => options[:placeholder], :class => options[:input_class], 'data-format' => options[:format], :value => options[:value]
concat (content_tag :span, :class => 'add-on clearDate' do concat (content_tag :span, :class => 'add-on clearDate' do