[Common] changed plugin's button

This commit is contained in:
Maxim Kadushkin 2017-03-23 16:02:19 +03:00
parent 7a2b4dab48
commit 71595d781c
3 changed files with 34 additions and 6 deletions

View file

@ -64,8 +64,8 @@ define([
}
},
'Common.Views.Plugins': {
'plugin:select': function(guid) {
me.api.asc_pluginRun(guid, 0, '');
'plugin:select': function(guid, type) {
me.api.asc_pluginRun(guid, type, '');
}
}
});

View file

@ -157,7 +157,8 @@ define([
iconCls: 'img-commonctrl review-prev',
iconImg: _icon_url,
caption: model.get('name'),
// menu: modes && modes.length > 1,
menu: modes && modes.length > 1,
split: modes && modes.length > 1,
value: guid,
hint: model.get('name')
});
@ -253,8 +254,29 @@ define([
if ( _plugin_btn ) {
_plugin_btn.on('click', function(b, e) {
me.fireEvent('plugin:select', [b.options.value]);
me.fireEvent('plugin:select', [b.options.value, 0]);
});
if ( _plugin_btn.split ) {
var _menu_items = [];
_.each(model.get('variations'), function(version, index) {
_menu_items.push({
caption : index > 0 ? version.get('description') : me.textStart,
value : parseInt(version.get('index'))
});
});
_plugin_btn.setMenu(
new Common.UI.Menu({
items: _menu_items,
pluginGuid: model.get('guid')
})
);
_plugin_btn.menu.on('item:click', function(menu, item, e) {
me.fireEvent('plugin:select', [menu.options.pluginGuid, item.value]);
});
}
}
});
},

View file

@ -125,7 +125,7 @@
#plugins-panel {
.x-huge.icon-top {
img {
height: 27px;
height: 20px;
}
.caption {
@ -133,7 +133,13 @@
max-width: 60px;
overflow: hidden;
}
}
width: 60px;
.slot:not(:first-child) {
margin-left: 2px;
}
.dropdown-menu {
min-width: 100px;
}
}