Sha256: 7d3e852030deb18915b444017d83075c066c86702460ec833c501281684f4188

Contents?: true

Size: 1.52 KB

Versions: 88

Compression:

Stored size: 1.52 KB

Contents

// On forms with more than one submit button, apply the disable-with label to
// only the clicked button, and just disable the other buttons.
// See for instance the HD Session form.
$(document).on('click', '.form-with-multiple-submit-buttons :submit', function () {
    var buttons = $('.form-with-multiple-submit-buttons :submit').not($(this));
    buttons.removeAttr('data-disable-with');
    buttons.attr('disabled', true);
});

function initDatePicker(container, elem, pickerOptions) {
  $(container + ' ' + elem).fdatepicker(pickerOptions);

  $(container + ' ' + elem + '-wrapper .prefix i').on('click', function() {
    $(this).closest(elem + '-wrapper')
      .find(elem)
      .fdatepicker('show');
  });
}

function initDatepickersIn(container) {
  initDatePicker(container, '.datepicker', {format: "dd-M-yyyy"});
}

function initDateTimepickersIn(container) {
  initDatePicker(container, '.datetimepicker', {
    format: "dd-M-yyyy hh:ii", pickTime: true, minuteStep: 1
  });
}

function initClockpickersIn(container) {
  var elem = ".clockpicker";
  var pickerOptions = {
    placement: "right", align: "left", donetext: "Set", autoclose: "true"
  };

  $(container + ' ' + elem).clockpicker(pickerOptions);

  // Clicking on the clock icon should display the clocpicker
  $(container + ' ' + elem + '-wrapper .input-group-addon').on('click', function() {
    $(this).closest(elem + '-wrapper').find(elem).clockpicker("show");
  });
}

$(function() {
  initDatepickersIn("body");
  initDateTimepickersIn("body");
  initClockpickersIn("body");
});

Version data entries

88 entries across 88 versions & 1 rubygems

Version Path
renalware-core-2.0.76 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.75 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.74 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.73 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.72 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.71 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.70 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.69 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.68 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.67 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.64 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.63 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.62 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.61 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.60 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.58 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.57 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.56 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.55 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.54 app/assets/javascripts/renalware/forms.js