From 8e199103d84d439a84327ac8bd154916da511183 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Wed, 4 Feb 2015 10:21:13 +0000 Subject: [PATCH] Issue #2412579 by idebr, geertvd: Tabledrag applies odd/even classes to tables with striping disabled --- core/includes/theme.inc | 3 +++ core/misc/tabledrag.js | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/includes/theme.inc b/core/includes/theme.inc index cccc4ccd5777..9ce21ff1b8a0 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1042,6 +1042,9 @@ function template_preprocess_table(&$variables) { } } } + if (empty($variables['no_striping'])) { + $variables['attributes']['data-striping'] = 1; + } } /** diff --git a/core/misc/tabledrag.js b/core/misc/tabledrag.js index 1e61eff8e9b1..0795e3046af6 100644 --- a/core/misc/tabledrag.js +++ b/core/misc/tabledrag.js @@ -60,6 +60,7 @@ this.changed = false; // Whether anything in the entire table has changed. this.maxDepth = 0; // Maximum amount of allowed parenting. this.rtl = $(this.table).css('direction') === 'rtl' ? -1 : 1; // Direction of the table. + this.striping = $(this.table).data('striping') === 1; // Configure the scroll settings. this.scrollSettings = {amount: 4, interval: 50, trigger: 70}; @@ -459,7 +460,9 @@ $(self.oldRowElement).removeClass('drag-previous'); } self.oldRowElement = item; - self.restripeTable(); + if (self.striping === true) { + self.restripeTable(); + } self.onDrag(); } @@ -556,7 +559,9 @@ else { self.rowObject.swap('before', currentRow, self); } - self.restripeTable(); + if (self.striping === true) { + self.restripeTable(); + } } } -- GitLab