[DE] refactoring
This commit is contained in:
parent
3784eb0717
commit
4a44c1f344
|
@ -477,7 +477,7 @@ define([
|
||||||
Common.UI.BaseView.prototype.initialize.call(this, options);
|
Common.UI.BaseView.prototype.initialize.call(this, options);
|
||||||
|
|
||||||
// this.store = this.options.store;
|
// this.store = this.options.store;
|
||||||
this.popoverChanges = this.options.popoverChanges;
|
// this.popoverChanges = this.options.popoverChanges;
|
||||||
|
|
||||||
this.btnPrev = new Common.UI.Button({
|
this.btnPrev = new Common.UI.Button({
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
|
@ -513,53 +513,10 @@ define([
|
||||||
});
|
});
|
||||||
this.btnsTurnReview = [this.btnTurnOn];
|
this.btnsTurnReview = [this.btnTurnOn];
|
||||||
|
|
||||||
var me = this;
|
|
||||||
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);
|
|
||||||
|
|
||||||
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'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
me.btnAccept.setDisabled(cfg.isReviewOnly);
|
|
||||||
me.btnReject.setDisabled(cfg.isReviewOnly);
|
|
||||||
|
|
||||||
setEvents.call(me);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function (el) {
|
render: function (el) {
|
||||||
|
@ -569,6 +526,56 @@ define([
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onAppReady: function (config) {
|
||||||
|
var me = this;
|
||||||
|
(new Promise(function (accept, reject) {
|
||||||
|
accept();
|
||||||
|
})).then(function(){
|
||||||
|
me.appConfig = config;
|
||||||
|
|
||||||
|
me.btnPrev.updateHint(me.hintPrev);
|
||||||
|
me.btnNext.updateHint(me.hintNext);
|
||||||
|
me.btnTurnOn.updateHint(me.textChangesOn);
|
||||||
|
me.btnDocLang.updateHint(me.tipSetDocLang);
|
||||||
|
me.btnSetSpelling.updateHint(me.tipSetSpelling);
|
||||||
|
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
me.btnAccept.setDisabled(config.isReviewOnly);
|
||||||
|
me.btnReject.setDisabled(config.isReviewOnly);
|
||||||
|
|
||||||
|
setEvents.call(me);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
getPanel: function () {
|
getPanel: function () {
|
||||||
var _html = $(_.template( template, {} ));
|
var _html = $(_.template( template, {} ));
|
||||||
|
|
||||||
|
@ -589,7 +596,7 @@ define([
|
||||||
getPopover: function (sdkViewName) {
|
getPopover: function (sdkViewName) {
|
||||||
if (_.isUndefined(this.popover)) {
|
if (_.isUndefined(this.popover)) {
|
||||||
this.popover = new Common.Views.ReviewChangesPopover({
|
this.popover = new Common.Views.ReviewChangesPopover({
|
||||||
store: this.popoverChanges,
|
store: this.options.popoverChanges,
|
||||||
delegate: this,
|
delegate: this,
|
||||||
renderTo: sdkViewName
|
renderTo: sdkViewName
|
||||||
});
|
});
|
||||||
|
|
|
@ -118,21 +118,20 @@ define([
|
||||||
})).then(function () {
|
})).then(function () {
|
||||||
me.bindViewEvents(me.statusbar, me.events);
|
me.bindViewEvents(me.statusbar, me.events);
|
||||||
|
|
||||||
function _process_changestip() {
|
|
||||||
var showTrackChangesTip = !Common.localStorage.getBool("de-track-changes-tip");
|
|
||||||
if ( showTrackChangesTip ) {
|
|
||||||
me.btnTurnReview.updateHint('');
|
|
||||||
if (me.changesTooltip === undefined)
|
|
||||||
me.changesTooltip = me.createChangesTip(me.textTrackChanges, 'de-track-changes-tip', false);
|
|
||||||
|
|
||||||
me.changesTooltip.show();
|
|
||||||
} else {
|
|
||||||
me.btnTurnReview.updateHint(me.tipReview);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var statusbarIsHidden = Common.localStorage.getBool("de-hidden-status");
|
var statusbarIsHidden = Common.localStorage.getBool("de-hidden-status");
|
||||||
if ( config.canReview && !statusbarIsHidden ) {
|
if ( config.canReview && !statusbarIsHidden ) {
|
||||||
|
var _process_changestip = function() {
|
||||||
|
var showTrackChangesTip = !Common.localStorage.getBool("de-track-changes-tip");
|
||||||
|
if ( showTrackChangesTip ) {
|
||||||
|
me.btnTurnReview.updateHint('');
|
||||||
|
if (me.changesTooltip === undefined)
|
||||||
|
me.changesTooltip = me.createChangesTip(me.textTrackChanges, 'de-track-changes-tip', false);
|
||||||
|
|
||||||
|
me.changesTooltip.show();
|
||||||
|
} else {
|
||||||
|
me.btnTurnReview.updateHint(me.tipReview);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( config.isReviewOnly ) {
|
if ( config.isReviewOnly ) {
|
||||||
_process_changestip();
|
_process_changestip();
|
||||||
|
|
Loading…
Reference in a new issue