[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/grade/grading/form/rubric/js/ -> rubric.js (source)

   1  M.gradingform_rubric = {};
   2  
   3  /**
   4   * This function is called for each rubric on page.
   5   */
   6  M.gradingform_rubric.init = function(Y, options) {
   7      Y.on('click', M.gradingform_rubric.levelclick, '#rubric-'+options.name+' .level', null, Y, options.name);
   8      // Capture also space and enter keypress.
   9      Y.on('key', M.gradingform_rubric.levelclick, '#rubric-' + options.name + ' .level', 'space', Y, options.name);
  10      Y.on('key', M.gradingform_rubric.levelclick, '#rubric-' + options.name + ' .level', 'enter', Y, options.name);
  11  
  12      Y.all('#rubric-'+options.name+' .radio').setStyle('display', 'none')
  13      Y.all('#rubric-'+options.name+' .level').each(function (node) {
  14        if (node.one('input[type=radio]').get('checked')) {
  15          node.addClass('checked');
  16        }
  17      });
  18  };
  19  
  20  M.gradingform_rubric.levelclick = function(e, Y, name) {
  21      var el = e.target
  22      while (el && !el.hasClass('level')) el = el.get('parentNode')
  23      if (!el) return
  24      e.preventDefault();
  25      el.siblings().removeClass('checked');
  26  
  27      // Set aria-checked attribute for siblings to false.
  28      el.siblings().setAttribute('aria-checked', 'false');
  29      chb = el.one('input[type=radio]')
  30      if (!chb.get('checked')) {
  31          chb.set('checked', true)
  32          el.addClass('checked')
  33          // Set aria-checked attribute to true if checked.
  34          el.setAttribute('aria-checked', 'true');
  35      } else {
  36          el.removeClass('checked');
  37          // Set aria-checked attribute to false if unchecked.
  38          el.setAttribute('aria-checked', 'false');
  39          el.get('parentNode').all('input[type=radio]').set('checked', false)
  40      }
  41  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1