Sha256: 511e4e6ad595f0812f3b9a866feffb4dd443aa4ea8dd6a2f79ebfea0b067a8f7

Contents?: true

Size: 990 Bytes

Versions: 1

Compression:

Stored size: 990 Bytes

Contents

function datetimepicker_init(){
  $(document).on('click', '.dpicker', function(e){
    e.stopPropagation();
    e.stopImmediatePropagation();
    $(this).datetimepicker({ format : 'DD/MM/YYYY', locale : 'en' }).on('dp.change', function(elt){
      var eltid = elt.currentTarget.dataset.id;
      $('#' + eltid + '_3i').val(elt.date.date());
      $('#' + eltid + '_2i').val(elt.date.month()+1);
      $('#' + eltid + '_1i').val(elt.date.year());
    });
    $(this).trigger('focus');
    $(this).trigger('select');
    return false;
  });
  $(document).on('click', '.tpicker', function(e){
    e.stopPropagation();
    e.stopImmediatePropagation();
    $(this).datetimepicker({ format : 'HH:mm', locale : 'en' }).on('dp.change', function(elt){
      var eltid = elt.currentTarget.dataset.id;
      $('#' + eltid + '_4i').val(elt.date.hour());
      $('#' + eltid + '_5i').val(elt.date.minute());
    });
    $(this).trigger('focus');
    $(this).trigger('select');
    return false;
  });
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beautiful_scaffold-1.0.1 lib/generators/templates/app/assets/javascripts/bootstrap-datetimepicker-for-beautiful-scaffold.js