Sha256: 35e247e416b067d26930da3b387c251288d4031c567adacee0ac570139f0856e

Contents?: true

Size: 1.88 KB

Versions: 42

Compression:

Stored size: 1.88 KB

Contents

Spotlight.onLoad(function() {

  // auto-fill the exhibit slug on the new exhibit form
  $('#new_exhibit').each(function() {
    $('#exhibit_title').on('change keyup', function() {
      $('#exhibit_slug').attr('placeholder', URLify($(this).val(), $(this).val().length));
    });

    $('#exhibit_slug').on('focus', function() {
      if ($(this).val() === '') {
        $(this).val($(this).attr('placeholder'));
      }
    });
  });

  $("#another-email").on("click", function() {
    var container = $(this).closest('.form-group');
    var contacts = container.find('.contact');
    var inputContainer = contacts.first().clone();

    // wipe out any values from the inputs
    inputContainer.find('input').each(function() {
      $(this).val('');
      $(this).attr('id', $(this).attr('id').replace('0', contacts.length));
      $(this).attr('name', $(this).attr('name').replace('0', contacts.length));
    });

    inputContainer.find('.contact-email-delete-wrapper').remove();
    inputContainer.find('.confirmation-status').remove();

    // bootstrap does not render input-groups with only one value in them correctly.
    inputContainer.find('.input-group input:only-child').closest('.input-group').removeClass('input-group');

    $(inputContainer).insertAfter(contacts.last());
  });

  $('.contact-email-delete').on('ajax:success', function() {
    $(this).closest('.contact').fadeOut(250, function() { $(this).remove(); });
  });

  $('.contact-email-delete').on('ajax:error', function(event, _xhr, _status, error) {
    var errSpan = $(this).closest('.contact').find('.contact-email-delete-error');
    errSpan.show();
    errSpan.find('.error-msg').first().text(error || event.detail[1]);
  });

  $('.btn-with-tooltip').tooltip();

  // Put focus in saved search title input when Save this search modal is shown
  $('#save-modal').on('shown.bs.modal', function () {
      $('#search_title').focus();
  });
});

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.alpha.2 app/assets/javascripts/spotlight/admin/exhibits.js
blacklight-spotlight-3.0.0.alpha.1 app/assets/javascripts/spotlight/admin/exhibits.js
blacklight-spotlight-2.13.0 app/assets/javascripts/spotlight/admin/exhibits.js
blacklight-spotlight-2.12.1 app/assets/javascripts/spotlight/admin/exhibits.js
blacklight-spotlight-2.12.0 app/assets/javascripts/spotlight/admin/exhibits.js
blacklight-spotlight-2.11.0 app/assets/javascripts/spotlight/admin/exhibits.js
blacklight-spotlight-2.10.0 app/assets/javascripts/spotlight/admin/exhibits.js
blacklight-spotlight-2.9.0 app/assets/javascripts/spotlight/admin/exhibits.js
blacklight-spotlight-2.8.0 app/assets/javascripts/spotlight/admin/exhibits.js
blacklight-spotlight-2.7.2 app/assets/javascripts/spotlight/exhibits.js
blacklight-spotlight-2.7.1 app/assets/javascripts/spotlight/exhibits.js
blacklight-spotlight-2.7.0 app/assets/javascripts/spotlight/exhibits.js
blacklight-spotlight-2.6.1.1 app/assets/javascripts/spotlight/exhibits.js
blacklight-spotlight-2.6.1 app/assets/javascripts/spotlight/exhibits.js
blacklight-spotlight-2.6.0 app/assets/javascripts/spotlight/exhibits.js
blacklight-spotlight-2.5.2 app/assets/javascripts/spotlight/exhibits.js
blacklight-spotlight-2.5.1 app/assets/javascripts/spotlight/exhibits.js
blacklight-spotlight-2.5.0 app/assets/javascripts/spotlight/exhibits.js
blacklight-spotlight-2.4.1 app/assets/javascripts/spotlight/exhibits.js
blacklight-spotlight-2.4.0 app/assets/javascripts/spotlight/exhibits.js