diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-10-04 10:52:33 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-10-04 17:56:23 +0200 |
commit | 53aad9901dba5ee1d5040a1f902c18177f82c377 (patch) | |
tree | e55c6712f69b0a5bd4d36deda207ae7a0ccfdaa8 | |
parent | 5aa0ad92a4c4c9ca458c0275f7869e67a211ed68 (diff) | |
download | nextcloud-server-53aad9901dba5ee1d5040a1f902c18177f82c377.tar.gz nextcloud-server-53aad9901dba5ee1d5040a1f902c18177f82c377.zip |
Make possible for tab views to add CSS classes to their container
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>
-rw-r--r-- | apps/files/js/detailsview.js | 3 | ||||
-rw-r--r-- | apps/files/js/detailtabview.js | 15 |
2 files changed, 18 insertions, 0 deletions
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 @@ -41,6 +41,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 * * @return {String} label |