Merge branch 'SPR-935' into 'master'

SPR-935, SPR-949

See merge request !43
This commit is contained in:
Jana Deutschländer 2017-04-20 15:11:26 +02:00
commit 931ed0511c
2 changed files with 51 additions and 25 deletions

View file

@ -27,6 +27,10 @@
bdi {
font-weight: bold;
max-width: 100%;
display: inline-block;
overflow: auto;
vertical-align: bottom;
}
}

View file

@ -1,6 +1,7 @@
jQuery(function () {
var $metaBox = jQuery('#spr__meta-box');
if (!$metaBox.length) return;
(function($) {
/**
* Register the click handler for the tabs
@ -8,9 +9,11 @@ jQuery(function () {
* Tabs can be added dynamically later on and this handler will still
* provide the open/close functionality
*/
var registerClickForTabsInMetaBox = function($metaBox) {
$metaBox.on('click', '.meta-tabs a', function (e) {
e.preventDefault();
var $tab = jQuery(this),
var $tab = $(this),
isopen = $tab.attr('aria-expanded') === 'true';
// disable all existing tabs
@ -35,5 +38,24 @@ jQuery(function () {
});
/**
* in admin templates show toc tab, if available
*/
if($('body').hasClass('do-admin')) {
var $tocLink = $metaBox.find('a[href="#spr__tab-toc"]');
if($tocLink.length === 1) {
$tocLink.trigger('click');
}
}
};
});
$(function(){
var $metaBox = $('#spr__meta-box');
if (!$metaBox.length) return;
registerClickForTabsInMetaBox($metaBox);
});
})(jQuery);