[DE] processed toolbar's [Comments] button
This commit is contained in:
parent
55e48173ce
commit
98b1168c06
|
@ -107,6 +107,7 @@ define([
|
|||
});
|
||||
|
||||
Common.NotificationCenter.on('comments:updatefilter', _.bind(this.onUpdateFilter, this));
|
||||
Common.NotificationCenter.on('app:comment:add', _.bind(this.onAppAddComment, this));
|
||||
},
|
||||
onLaunch: function () {
|
||||
this.collection = this.getApplication().getCollection('Common.Collections.Comments');
|
||||
|
@ -582,6 +583,11 @@ define([
|
|||
}
|
||||
}
|
||||
},
|
||||
onAppAddComment: function () {
|
||||
if ( this.api.can_AddQuotedComment() !== false ) {
|
||||
this.addDummyComment();
|
||||
}
|
||||
},
|
||||
|
||||
// SDK
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ define([
|
|||
});
|
||||
|
||||
Common.NotificationCenter.on('leftmenu:change', _.bind(this.onMenuChange, this));
|
||||
Common.NotificationCenter.on('app:comment:add', _.bind(this.onAppAddComment, this));
|
||||
},
|
||||
|
||||
onLaunch: function() {
|
||||
|
@ -503,6 +504,22 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
onAppAddComment: function(sender) {
|
||||
var me = this;
|
||||
if ( this.api.can_AddQuotedComment() === false ) {
|
||||
(new Promise(function(resolve, reject) {
|
||||
resolve();
|
||||
})).then(function () {
|
||||
Common.UI.Menu.Manager.hideAll();
|
||||
me.leftMenu.showMenu('comments');
|
||||
|
||||
var ctrl = DE.getController('Common.Controllers.Comments');
|
||||
ctrl.getView().showEditContainer(true);
|
||||
ctrl.onAfterShow();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
commentsShowHide: function(mode) {
|
||||
var value = Common.localStorage.getItem("de-settings-livecomment");
|
||||
if (value !== null && 0 === parseInt(value)) {
|
||||
|
|
|
@ -174,12 +174,8 @@ define([
|
|||
me.toolbar.on('render:before', function (cmp) {
|
||||
});
|
||||
|
||||
Common.NotificationCenter.on('app:ready', function () {
|
||||
// me.setToolbarFolding(true);
|
||||
});
|
||||
|
||||
Common.NotificationCenter.on('app:ready', me.onAppReady.bind(me));
|
||||
Common.NotificationCenter.on('app:face', function (config) {
|
||||
var _btnsComment = [];
|
||||
if ( config.canReview ) {
|
||||
var tab = {action: 'review', caption: 'Review'};
|
||||
var $panel = DE.getController('Common.Controllers.ReviewChanges').createToolbarPanel();
|
||||
|
@ -2807,6 +2803,35 @@ define([
|
|||
Common.NotificationCenter.trigger('layout:changed', 'toolbar');
|
||||
},
|
||||
|
||||
onAppReady: function (config) {
|
||||
var me = this;
|
||||
// me.setToolbarFolding(true);
|
||||
|
||||
if (config.canComments) {
|
||||
var _btnsComment = [];
|
||||
var slots = me.toolbar.$el.find('.slot-comment');
|
||||
slots.each(function(index, el) {
|
||||
var _cls = 'btn-toolbar';
|
||||
/x-huge/.test(el.className) &&
|
||||
(_cls += ' x-huge icon-top');
|
||||
|
||||
var button = new Common.UI.Button({
|
||||
cls: _cls,
|
||||
iconCls: 'btn-menu-comments',
|
||||
caption: 'Comment'
|
||||
}).render( slots.eq(index) );
|
||||
|
||||
_btnsComment.push(button);
|
||||
});
|
||||
|
||||
_btnsComment.forEach(function(btn) {
|
||||
btn.on('click', function (btn, e) {
|
||||
Common.NotificationCenter.trigger('app:comment:add', 'toolbar');
|
||||
});
|
||||
}, this);
|
||||
}
|
||||
},
|
||||
|
||||
textEmptyImgUrl : 'You need to specify image URL.',
|
||||
textWarning : 'Warning',
|
||||
textFontSizeErr : 'The entered value is incorrect.<br>Please enter a numeric value between 1 and 100',
|
||||
|
|
Loading…
Reference in a new issue