Added the ability to load plugin permissions from the plugin.yaml file. Minor improvement in the side panel behavior.

This commit is contained in:
alekseybobkov 2015-11-19 21:02:10 -08:00
parent 0e2e18af7f
commit 30eedebed9
3 changed files with 22 additions and 6 deletions

View File

@ -1133,7 +1133,8 @@ this.$fixButton=$('<a href="#" class="fix-button"><i class="icon-thumb-tack"></i
this.$fixButton.click(function(){self.fixPanel()
return false})
$('.fix-button-container',this.$el).append(this.$fixButton)
this.$sideNavItems.click(function(){if(Modernizr.touch&&$(window).width()<self.options.breakpoint){if($(this).data('menu-item')==self.visibleItemId&&self.panelVisible){self.hideSidePanel()
this.$sideNavItems.click(function(){if($(this).data('no-side-panel')){return}
if(Modernizr.touch&&$(window).width()<self.options.breakpoint){if($(this).data('menu-item')==self.visibleItemId&&self.panelVisible){self.hideSidePanel()
return}else
self.displaySidePanel()}
self.displayTab(this)
@ -1141,7 +1142,8 @@ 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)})
self.$el.mouseleave(function(){self.hideSidePanel()})
self.$sideNavItems.mouseenter(function(){if($(window).width()<self.options.breakpoint||!self.panelFixed()){var _this=this
self.$sideNavItems.mouseenter(function(){if($(window).width()<self.options.breakpoint||!self.panelFixed()){if($(this).data('no-side-panel')){return}
var _this=this
self.tabOpenTimeout=setTimeout(function(){self.displayTab(_this)},self.tabOpenDelay)}})
self.$sideNavItems.mouseleave(function(){clearTimeout(self.tabOpenTimeout)})
$(window).resize(function(){self.updatePanelPosition()

View File

@ -31,6 +31,10 @@
$('.fix-button-container', this.$el).append(this.$fixButton)
this.$sideNavItems.click(function(){
if ($(this).data('no-side-panel')) {
return
}
if (Modernizr.touch && $(window).width() < self.options.breakpoint) {
if ($(this).data('menu-item') == self.visibleItemId && self.panelVisible) {
self.hideSidePanel()
@ -46,11 +50,13 @@
if (!Modernizr.touch) {
self.$sideNav.mouseenter(function(){
if ($(window).width() < self.options.breakpoint || !self.panelFixed()) {
// 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)
}
}
})
self.$sideNav.mouseleave(function(){
@ -63,6 +69,10 @@
self.$sideNavItems.mouseenter(function(){
if ($(window).width() < self.options.breakpoint || !self.panelFixed()) {
if ($(this).data('no-side-panel')) {
return
}
var _this = this
self.tabOpenTimeout = setTimeout(function () {
self.displayTab(_this)
@ -74,7 +84,6 @@
clearTimeout(self.tabOpenTimeout)
})
$(window).resize(function() {
self.updatePanelPosition()
self.updateActiveTab()

View File

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