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.53 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.52 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.51 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.50 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.48 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.47 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.46 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.45 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.44 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.43 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.42 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.41 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.40 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.39 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.38 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.37 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.36 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.35 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.34 app/assets/javascripts/renalware/forms.js
renalware-core-2.0.33 app/assets/javascripts/renalware/forms.js