Sha256: d299d8f72e560895501c74bf2ad7c557532c3be7abdb29b676672f4b452da97f

Contents?: true

Size: 1.35 KB

Versions: 6

Compression:

Stored size: 1.35 KB

Contents

jQuery.fn.exists = function(){return this.length>0;}

Blacklight.onLoad(function () {
  // all activate-submit buttons are disabled by default
  $('.activate-submit').each(function() {
    $(this).prop('disabled', true);
  });
  // set up tooltip
  $('.activate-container').tooltip({
    'placement': 'bottom',
    'delay': {show: 500, hide: 100}
    });

  // when data-activate checkbox is clicked, change the
  // disable state of all activate-submit buttons
  $('input[data-activate]').on("click", function () {
    // get the checked state of the checkbox clicked and 
    // set  all other tos checkboxes to same state
    var bool = $(this).is(":checked");
    // if box is checked - enable submit, otherwise disable 
    var disable = (bool) ? false : true;
    $('input[data-activate]').attr('checked', bool);
    $('.activate-submit').attr('disabled', disable);
  })

  // show/hide the tooltip depending if the agreement is already checked
  $('.activate-container').mousemove(function(e){
    if ($('input[data-activate]').is(':checked')) {
      $('.activate-container').tooltip('hide')
    }
    else {
      $('.activate-container').tooltip('show')
    }
  });
  $('.activate-container').mouseout(function(e){
      $('.activate-container').tooltip('hide')
  });
  $('.activate-container').mouseleave(function(e){
      $('.activate-container').tooltip('hide')
  });
});

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sufia-4.0.0.rc2 app/assets/javascripts/terms_of_service.js
sufia-4.0.0.rc1 app/assets/javascripts/terms_of_service.js
sufia-4.0.0.beta4 app/assets/javascripts/terms_of_service.js
sufia-4.0.0.beta3 app/assets/javascripts/terms_of_service.js
sufia-4.0.0.beta2 app/assets/javascripts/terms_of_service.js
sufia-4.0.0.beta1 app/assets/javascripts/terms_of_service.js