Sha256: 806ceff2fc88e36800f1978ef7e15589834e800811bd7ce9fe72e932ecfee95f

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.147 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.146 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.145 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.144 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.143 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.142 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.141 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.140 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.139 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.138 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.137 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.136 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.135 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.134 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.133 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.132 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.131 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.130 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.129 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.128 app/assets/javascripts/renalware/components/forms.js