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.1.1 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.1.0 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.167 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.166 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.165 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.164 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.163 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.162 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.161 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.160 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.159 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.158 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.157 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.156 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.155 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.153 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.152 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.151 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.149 app/assets/javascripts/renalware/components/forms.js
renalware-core-2.0.148 app/assets/javascripts/renalware/components/forms.js