[Common] refacted 'ReviewChanges'
This commit is contained in:
parent
5ed32d082c
commit
ac79eacb35
|
@ -109,10 +109,6 @@ define([
|
|||
|
||||
var toolbar = this.getApplication().getController('Toolbar').getView('Toolbar');
|
||||
toolbar.addTab(tab, $panel, 3);
|
||||
|
||||
this.view.isReviewOnly = mode.isReviewOnly;
|
||||
this.view.btnAccept.setDisabled(mode.isReviewOnly);
|
||||
this.view.btnReject.setDisabled(mode.isReviewOnly);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
@ -138,7 +134,7 @@ define([
|
|||
|
||||
this.getPopover().show(animate, lock, lockUser);
|
||||
|
||||
if (!this.view.isReviewOnly && this._state.lock !== lock) {
|
||||
if (!this.view.appConfig.isReviewOnly && this._state.lock !== lock) {
|
||||
this.view.btnAccept.setDisabled(lock==true);
|
||||
this.view.btnReject.setDisabled(lock==true);
|
||||
this._state.lock = lock;
|
||||
|
@ -411,10 +407,10 @@ define([
|
|||
return (date.getMonth() + 1) + '/' + (date.getDate()) + '/' + date.getFullYear() + ' ' + format(date);
|
||||
},
|
||||
|
||||
onBtnPreviewClick: function(btn, eOpts){
|
||||
switch (btn.options.value) {
|
||||
case 1: this.api.asc_GetPrevRevisionsChange(); break;
|
||||
case 2: this.api.asc_GetNextRevisionsChange(); break;
|
||||
onBtnPreviewClick: function(btn, opts){
|
||||
switch (opts) {
|
||||
case 'prev': this.api.asc_GetPrevRevisionsChange(); break;
|
||||
case 'next': this.api.asc_GetNextRevisionsChange(); break;
|
||||
}
|
||||
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
|
@ -457,6 +453,11 @@ define([
|
|||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
|
||||
getView: function(name) {
|
||||
return !name && this.view ?
|
||||
this.view : Backbone.Controller.prototype.getView.call(this, name);
|
||||
},
|
||||
textInserted: '<b>Inserted:</b>',
|
||||
textDeleted: '<b>Deleted:</b>',
|
||||
textParaInserted: '<b>Paragraph Inserted</b> ',
|
||||
|
|
|
@ -430,11 +430,11 @@ define([
|
|||
function setEvents() {
|
||||
var me = this;
|
||||
this.btnPrev.on('click', function (e) {
|
||||
me.fireEvent('reviewchange:preview', [me.btnPrev]);
|
||||
me.fireEvent('reviewchange:preview', [me.btnPrev, 'prev']);
|
||||
});
|
||||
|
||||
this.btnNext.on('click', function (e) {
|
||||
me.fireEvent('reviewchange:preview', [me.btnNext]);
|
||||
me.fireEvent('reviewchange:preview', [me.btnNext, 'next']);
|
||||
});
|
||||
|
||||
this.btnAccept.on('click', function (e) {
|
||||
|
@ -468,53 +468,27 @@ define([
|
|||
this.btnPrev = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'img-commonctrl review-prev',
|
||||
caption: this.txtPrev,
|
||||
value: 1
|
||||
caption: this.txtPrev
|
||||
});
|
||||
|
||||
this.btnNext = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'img-commonctrl review-next',
|
||||
caption: this.txtNext,
|
||||
value: 2
|
||||
caption: this.txtNext
|
||||
});
|
||||
|
||||
this.btnAccept = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
caption: this.txtAccept,
|
||||
split: true,
|
||||
iconCls: 'img-commonctrl review-close',
|
||||
menu: new Common.UI.Menu({
|
||||
items: [
|
||||
this.mnuAcceptCurrent = new Common.UI.MenuItem({
|
||||
caption: this.txtAcceptCurrent,
|
||||
value: 'current'
|
||||
}),
|
||||
this.mnuAcceptAll = new Common.UI.MenuItem({
|
||||
caption: this.txtAcceptAll,
|
||||
value: 'all'
|
||||
})
|
||||
]
|
||||
})
|
||||
iconCls: 'img-commonctrl review-close'
|
||||
});
|
||||
|
||||
this.btnReject = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
caption: this.txtReject,
|
||||
split: true,
|
||||
iconCls: 'img-commonctrl review-close',
|
||||
menu: new Common.UI.Menu({
|
||||
items: [
|
||||
this.mnuRejectCurrent = new Common.UI.MenuItem({
|
||||
caption: this.txtRejectCurrent,
|
||||
value: 'current'
|
||||
}),
|
||||
this.mnuRejectAll = new Common.UI.MenuItem({
|
||||
caption: this.txtRejectAll,
|
||||
value: 'all'
|
||||
})
|
||||
]
|
||||
})
|
||||
iconCls: 'img-commonctrl review-close'
|
||||
});
|
||||
|
||||
this.btnTurnOn = new Common.UI.Button({
|
||||
|
@ -524,15 +498,47 @@ define([
|
|||
});
|
||||
|
||||
var me = this;
|
||||
(new Promise(function (resolve) {
|
||||
Common.NotificationCenter.on('app:ready', function () { resolve(); });
|
||||
})).then(function(){
|
||||
var promise = new Promise( function(resolve) { resolve(); });
|
||||
|
||||
Common.NotificationCenter.on('app:ready', function (cfg) {
|
||||
promise.then(function(){
|
||||
me.appConfig = cfg;
|
||||
me.btnPrev.updateHint(me.hintPrev);
|
||||
me.btnNext.updateHint(me.hintNext);
|
||||
me.btnTurnOn.updateHint(me.textChangesOn);
|
||||
setEvents.call(me);
|
||||
|
||||
me.btnAccept.setMenu(
|
||||
new Common.UI.Menu({
|
||||
items: [
|
||||
{
|
||||
caption: me.txtAcceptCurrent,
|
||||
value: 'current'
|
||||
},
|
||||
{
|
||||
caption: me.txtAcceptAll,
|
||||
value: 'all'
|
||||
}
|
||||
]
|
||||
})
|
||||
);
|
||||
|
||||
me.btnReject.setMenu(
|
||||
new Common.UI.Menu({
|
||||
items: [
|
||||
{
|
||||
caption: me.txtRejectCurrent,
|
||||
value: 'current'
|
||||
},
|
||||
{
|
||||
caption: me.txtRejectAll,
|
||||
value: 'all'
|
||||
}
|
||||
]
|
||||
})
|
||||
);
|
||||
setEvents.call(me);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
render: function (el) {
|
||||
|
|
Loading…
Reference in a new issue