Minor update in the sidebar navigation client-side code. Plugins now can load navigation menus from plugin.yaml file.

This commit is contained in:
alekseybobkov 2015-11-28 19:18:08 -08:00
parent e358bb4b57
commit 5e454ee069
3 changed files with 21 additions and 16 deletions

View File

@ -1142,12 +1142,13 @@ return}else
self.displaySidePanel()}
self.displayTab(this)
return false})
if(!Modernizr.touch){self.$sideNav.mouseenter(function(){if($(window).width()<self.options.breakpoint||!self.panelFixed()){self.panelOpenTimeout=setTimeout(function(){self.displaySidePanel()},self.tabOpenDelay)}})
self.$sideNav.mouseleave(function(){clearTimeout(self.panelOpenTimeout)})
if(!Modernizr.touch){self.$sideNav.mouseleave(function(){clearTimeout(self.panelOpenTimeout)})
self.$el.mouseleave(function(){self.hideSidePanel()})
self.$sideNavItems.mouseenter(function(){if($(window).width()<self.options.breakpoint||!self.panelFixed()){if($(this).data('no-side-panel')){return}
self.$sideNavItems.mouseenter(function(){if($(window).width()<self.options.breakpoint||!self.panelFixed()){if($(this).data('no-side-panel')){self.hideSidePanel()
return}
var _this=this
self.tabOpenTimeout=setTimeout(function(){self.displayTab(_this)},self.tabOpenDelay)}})
self.tabOpenTimeout=setTimeout(function(){self.displaySidePanel()
self.displayTab(_this)},self.tabOpenDelay)}})
self.$sideNavItems.mouseleave(function(){clearTimeout(self.tabOpenTimeout)})
$(window).resize(function(){self.updatePanelPosition()
self.updateActiveTab()})}else{$('#layout-body').click(function(){if(self.panelVisible){self.hideSidePanel()

View File

@ -49,15 +49,16 @@
})
if (!Modernizr.touch) {
self.$sideNav.mouseenter(function(){
// TODO: The side panel opens regardless of whether
// the hovered item has a side panel (data-no-side-panel attribute).
if ($(window).width() < self.options.breakpoint || !self.panelFixed()) {
self.panelOpenTimeout = setTimeout(function () {
self.displaySidePanel()
}, self.tabOpenDelay)
}
})
// The side panel now opens only when a menu item is hovered and
// when the item doesn't have the "data-no-side-panel" attribute.
// TODO: remove the comment and the code below if no issues noticed.
// self.$sideNav.mouseenter(function(){
// if ($(window).width() < self.options.breakpoint || !self.panelFixed()) {
// self.panelOpenTimeout = setTimeout(function () {
// self.displaySidePanel()
// }, self.tabOpenDelay)
// }
// })
self.$sideNav.mouseleave(function(){
clearTimeout(self.panelOpenTimeout)
@ -70,11 +71,13 @@
self.$sideNavItems.mouseenter(function(){
if ($(window).width() < self.options.breakpoint || !self.panelFixed()) {
if ($(this).data('no-side-panel')) {
self.hideSidePanel()
return
}
var _this = this
self.tabOpenTimeout = setTimeout(function () {
self.displaySidePanel()
self.displayTab(_this)
}, self.tabOpenDelay)
}

View File

@ -99,7 +99,10 @@ class PluginBase extends ServiceProviderBase
*/
public function registerNavigation()
{
return [];
$configuration = $this->getConfigurationFromYaml();
if (array_key_exists('navigation', $configuration)) {
return $configuration['navigation'];
}
}
/**
@ -109,8 +112,6 @@ class PluginBase extends ServiceProviderBase
*/
public function registerPermissions()
{
$thisClass = get_class($this);
$configuration = $this->getConfigurationFromYaml();
if (array_key_exists('permissions', $configuration)) {
return $configuration['permissions'];