summaryrefslogtreecommitdiff
path: root/modules/taxonomy/taxonomy.js
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-11-26 19:46:52 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-11-26 19:46:52 +0000
commite6a88be5d127f41837137a0d00980c8d8115ab1e (patch)
treea32f57bcd84cc290d0203c850d5b1c5ae676a3a4 /modules/taxonomy/taxonomy.js
parent9a96837b89a0f6b2b5b2c99063e5faeda53d88c6 (diff)
downloadbrdo-e6a88be5d127f41837137a0d00980c8d8115ab1e.tar.gz
brdo-e6a88be5d127f41837137a0d00980c8d8115ab1e.tar.bz2
#193333 by quicksketch et al: taxonomy drag and drop support
Diffstat (limited to 'modules/taxonomy/taxonomy.js')
-rw-r--r--modules/taxonomy/taxonomy.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/modules/taxonomy/taxonomy.js b/modules/taxonomy/taxonomy.js
new file mode 100644
index 000000000..fab014ac7
--- /dev/null
+++ b/modules/taxonomy/taxonomy.js
@@ -0,0 +1,36 @@
+// $Id $
+
+/**
+ * Move a block in the blocks table from one region to another via select list.
+ *
+ * This behavior is dependent on the tableDrag behavior, since it uses the
+ * objects initialized in that behavior to update the row.
+ */
+Drupal.behaviors.termDrag = function(context) {
+ var table = $('#taxonomy', context);
+ var tableDrag = Drupal.tableDrag.taxonomy; // Get the blocks tableDrag object.
+ var rows = $('tr', table).size();
+
+ // When a row is swapped, keep previous and next page classes set.
+ tableDrag.row.prototype.onSwap = function(swappedRow) {
+ $('tr.taxonomy-term-preview', table).removeClass('taxonomy-term-preview');
+ $('tr.taxonomy-term-divider-top', table).removeClass('taxonomy-term-divider-top');
+ $('tr.taxonomy-term-divider-bottom', table).removeClass('taxonomy-term-divider-bottom');
+
+ if (Drupal.settings.taxonomy.backPeddle) {
+ for (var n = 0; n < Drupal.settings.taxonomy.backPeddle; n++) {
+ $(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
+ }
+ $(table[0].tBodies[0].rows[Drupal.settings.taxonomy.backPeddle - 1]).addClass('taxonomy-term-divider-top');
+ $(table[0].tBodies[0].rows[Drupal.settings.taxonomy.backPeddle]).addClass('taxonomy-term-divider-bottom');
+ }
+
+ if (Drupal.settings.taxonomy.forwardPeddle) {
+ for (var n = rows - Drupal.settings.taxonomy.forwardPeddle - 1; n < rows - 1; n++) {
+ $(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
+ }
+ $(table[0].tBodies[0].rows[rows - Drupal.settings.taxonomy.forwardPeddle - 2]).addClass('taxonomy-term-divider-top');
+ $(table[0].tBodies[0].rows[rows - Drupal.settings.taxonomy.forwardPeddle - 1]).addClass('taxonomy-term-divider-bottom');
+ }
+ };
+};