Sha256: a5c2f46ffba9b9b08ce77a058f077f7d70e35060447958e3691b0676c1057584

Contents?: true

Size: 1.45 KB

Versions: 117

Compression:

Stored size: 1.45 KB

Contents

// Disable animations during tests to increase stability
<% reveal_animation = Rails.env.test? ? 'none' : 'fadeAndPop' %>

$(document).foundation({
    reveal: {
        animation: '<%= reveal_animation %>',
        animation_speed: 200,
        close_on_background_click: false,
        close_on_esc: true,
        dismiss_modal_class: "reveal-modal-close"
    }
});

// Honour any html autofocus attributes on inputs inside a modal dialog
$(document).on('opened.fndtn.reveal', '[data-reveal]', function () {
  var modal = $(this);
  modal.find('[autofocus]').focus();
  $('form[data-client-side-validations]').enableClientSideValidations();
  $('.searchable_select', modal).select2();
  // If a modal is launched again, ensure the submit button is re-enabled.
  $.rails.enableFormElement($('input[data-disable-with]'));
  // Refresh layout of foundation widgets
  $(document).foundation('reflow');

  var resizeSelect2DropDownsToFitModal = function(){
    $('.select2', modal).css('width', "100%");
    $('#tabs').on('tabsactivate', function(event, ui) {
      $('.select2').css('width', "100%");
    });
  };

  var layoutTabs = function() {
    // Layout any JQueryUI tabs
    $("#tabs").tabs();
    resizeSelect2DropDownsToFitModal();
  };

  layoutTabs();
});

// If there was an error submitting a modal form, be sure to re-enable the submit button
$(document).on('ajaxError', function(event, xhr, status, error) {
  $.rails.enableFormElement($('input[data-disable-with]'));
});

Version data entries

117 entries across 117 versions & 1 rubygems

Version Path
renalware-core-2.0.111 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.110 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.109 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.108 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.106 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.105 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.104 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.103 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.102 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.101 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.100 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.99 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.98 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.97 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.96 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.95 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.94 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.93 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.92 app/assets/javascripts/renalware/dialogs.js.erb
renalware-core-2.0.91 app/assets/javascripts/renalware/dialogs.js.erb