Projet

Général

Profil

Paste
Télécharger (1,73 ko) Statistiques
| Branche: | Révision:

root / drupal7 / modules / taxonomy / taxonomy.js @ 6d8023f2

1 85ad3d82 Assos Assos
(function ($) {
2
3
/**
4
 * Move a block in the blocks table from one region to another via select list.
5
 *
6
 * This behavior is dependent on the tableDrag behavior, since it uses the
7
 * objects initialized in that behavior to update the row.
8
 */
9
Drupal.behaviors.termDrag = {
10
  attach: function (context, settings) {
11
    var table = $('#taxonomy', context);
12
    var tableDrag = Drupal.tableDrag.taxonomy; // Get the blocks tableDrag object.
13
    var rows = $('tr', table).length;
14
15
    // When a row is swapped, keep previous and next page classes set.
16
    tableDrag.row.prototype.onSwap = function (swappedRow) {
17
      $('tr.taxonomy-term-preview', table).removeClass('taxonomy-term-preview');
18
      $('tr.taxonomy-term-divider-top', table).removeClass('taxonomy-term-divider-top');
19
      $('tr.taxonomy-term-divider-bottom', table).removeClass('taxonomy-term-divider-bottom');
20
21
      if (settings.taxonomy.backStep) {
22
        for (var n = 0; n < settings.taxonomy.backStep; n++) {
23
          $(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
24
        }
25
        $(table[0].tBodies[0].rows[settings.taxonomy.backStep - 1]).addClass('taxonomy-term-divider-top');
26
        $(table[0].tBodies[0].rows[settings.taxonomy.backStep]).addClass('taxonomy-term-divider-bottom');
27
      }
28
29
      if (settings.taxonomy.forwardStep) {
30
        for (var n = rows - settings.taxonomy.forwardStep - 1; n < rows - 1; n++) {
31
          $(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
32
        }
33
        $(table[0].tBodies[0].rows[rows - settings.taxonomy.forwardStep - 2]).addClass('taxonomy-term-divider-top');
34
        $(table[0].tBodies[0].rows[rows - settings.taxonomy.forwardStep - 1]).addClass('taxonomy-term-divider-bottom');
35
      }
36
    };
37
  }
38
};
39
40
})(jQuery);