From 53aad9901dba5ee1d5040a1f902c18177f82c377 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= <danxuliu@gmail.com>
Date: Thu, 4 Oct 2018 10:52:33 +0200
Subject: [PATCH] Make possible for tab views to add CSS classes to their
 container
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In general the style of the tabs container should not change depending
on which tab is the currently selected one. However, this could be
needed in some very specific cases, so now the tab views can specify the
extra CSS classes to be used in their container when they are selected.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
---
 apps/files/js/detailsview.js   |  3 +++
 apps/files/js/detailtabview.js | 15 +++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/apps/files/js/detailsview.js b/apps/files/js/detailsview.js
index aed1736693a..3b7a922c7c9 100644
--- a/apps/files/js/detailsview.js
+++ b/apps/files/js/detailsview.js
@@ -194,6 +194,9 @@
 			// hide other tabs
 			$tabsContainer.find('.tab').addClass('hidden');
 
+			$tabsContainer.attr('class', 'tabsContainer');
+			$tabsContainer.addClass(tabView.getTabsContainerExtraClasses());
+
 			// tab already rendered ?
 			if (!$tabEl.length) {
 				// render tab
diff --git a/apps/files/js/detailtabview.js b/apps/files/js/detailtabview.js
index 0bd34a88188..72b591a7b29 100644
--- a/apps/files/js/detailtabview.js
+++ b/apps/files/js/detailtabview.js
@@ -40,6 +40,21 @@
 			}
 		},
 
+		/**
+		 * Returns the extra CSS classes used by the tabs container when this
+		 * tab is the selected one.
+		 *
+		 * In general you should not extend this method, as tabs should not
+		 * modify the classes of its container; this is reserved as a last
+		 * resort for very specific cases in which there is no other way to get
+		 * the proper style or behaviour.
+		 *
+		 * @return {String} space-separated CSS classes
+		 */
+		getTabsContainerExtraClasses: function() {
+			return '';
+		},
+
 		/**
 		 * Returns the tab label
 		 *
-- 
GitLab