Hide plugins tab when no visible plugins (e.g., editor has only editing plugins but is opened in viewer mode)

This commit is contained in:
Julia Radzhabova 2019-01-15 17:05:13 +03:00
parent faf3cceeea
commit 2e322cf66f
2 changed files with 6 additions and 2 deletions

View file

@ -49,6 +49,10 @@ define([
'use strict'; 'use strict';
Common.Collections.Plugins = Backbone.Collection.extend({ Common.Collections.Plugins = Backbone.Collection.extend({
model: Common.Models.Plugin model: Common.Models.Plugin,
hasVisible: function() {
return !!this.findWhere({visible: true});
}
}); });
}); });

View file

@ -174,7 +174,7 @@ define([
arr.push(plugin); arr.push(plugin);
}); });
this.api.asc_pluginsRegister('', arr); this.api.asc_pluginsRegister('', arr);
if (storePlugins.length>0) if (storePlugins.hasVisible())
Common.NotificationCenter.trigger('tab:visible', 'plugins', true); Common.NotificationCenter.trigger('tab:visible', 'plugins', true);
}, },