View mode: show buttons for listing review changes

This commit is contained in:
Julia Radzhabova 2019-01-22 16:47:19 +03:00
parent 5d7529fb63
commit 1cc43b4b84

View file

@ -99,14 +99,6 @@ define([
var me = this; var me = this;
if ( me.appConfig.canReview ) { if ( me.appConfig.canReview ) {
this.btnPrev.on('click', function (e) {
me.fireEvent('reviewchange:preview', [me.btnPrev, 'prev']);
});
this.btnNext.on('click', function (e) {
me.fireEvent('reviewchange:preview', [me.btnNext, 'next']);
});
this.btnAccept.on('click', function (e) { this.btnAccept.on('click', function (e) {
me.fireEvent('reviewchange:accept', [me.btnAccept, 'current']); me.fireEvent('reviewchange:accept', [me.btnAccept, 'current']);
}); });
@ -127,10 +119,19 @@ define([
button.on('click', _click_turnpreview.bind(me)); button.on('click', _click_turnpreview.bind(me));
}); });
} }
if (this.appConfig.canViewReview) if (this.appConfig.canViewReview) {
this.btnPrev.on('click', function (e) {
me.fireEvent('reviewchange:preview', [me.btnPrev, 'prev']);
});
this.btnNext.on('click', function (e) {
me.fireEvent('reviewchange:preview', [me.btnNext, 'next']);
});
this.btnReviewView.menu.on('item:click', function (menu, item, e) { this.btnReviewView.menu.on('item:click', function (menu, item, e) {
me.fireEvent('reviewchanges:view', [menu, item]); me.fireEvent('reviewchanges:view', [menu, item]);
}); });
}
this.btnsSpelling.forEach(function(button) { this.btnsSpelling.forEach(function(button) {
button.on('click', function (b, e) { button.on('click', function (b, e) {
@ -173,18 +174,6 @@ define([
this.appConfig = options.mode; this.appConfig = options.mode;
if ( this.appConfig.canReview ) { if ( this.appConfig.canReview ) {
this.btnPrev = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'review-prev',
caption: this.txtPrev
});
this.btnNext = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'review-next',
caption: this.txtNext
});
this.btnAccept = new Common.UI.Button({ this.btnAccept = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
caption: this.txtAccept, caption: this.txtAccept,
@ -208,6 +197,18 @@ define([
this.btnsTurnReview = [this.btnTurnOn]; this.btnsTurnReview = [this.btnTurnOn];
} }
if (this.appConfig.canViewReview) { if (this.appConfig.canViewReview) {
this.btnPrev = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'review-prev',
caption: this.txtPrev
});
this.btnNext = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'review-next',
caption: this.txtNext
});
this.btnReviewView = new Common.UI.Button({ this.btnReviewView = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-reviewview', iconCls: 'btn-ic-reviewview',
@ -276,8 +277,6 @@ define([
'<% } %></a>'); '<% } %></a>');
if ( config.canReview ) { if ( config.canReview ) {
me.btnPrev.updateHint(me.hintPrev);
me.btnNext.updateHint(me.hintNext);
me.btnTurnOn.updateHint(me.tipReview); me.btnTurnOn.updateHint(me.tipReview);
me.btnAccept.setMenu( me.btnAccept.setMenu(
@ -316,6 +315,9 @@ define([
me.btnReject.setDisabled(config.isReviewOnly); me.btnReject.setDisabled(config.isReviewOnly);
} }
if (me.appConfig.canViewReview) { if (me.appConfig.canViewReview) {
me.btnPrev.updateHint(me.hintPrev);
me.btnNext.updateHint(me.hintNext);
me.btnReviewView.setMenu( me.btnReviewView.setMenu(
new Common.UI.Menu({ new Common.UI.Menu({
cls: 'ppm-toolbar', cls: 'ppm-toolbar',
@ -431,12 +433,12 @@ define([
this.$el = $(_.template(template)( {} )); this.$el = $(_.template(template)( {} ));
if ( this.appConfig.canReview ) { if ( this.appConfig.canReview ) {
this.btnPrev.render(this.$el.find('#btn-change-prev'));
this.btnNext.render(this.$el.find('#btn-change-next'));
this.btnAccept.render(this.$el.find('#btn-change-accept')); this.btnAccept.render(this.$el.find('#btn-change-accept'));
this.btnReject.render(this.$el.find('#btn-change-reject')); this.btnReject.render(this.$el.find('#btn-change-reject'));
this.btnTurnOn.render(this.$el.find('#btn-review-on')); this.btnTurnOn.render(this.$el.find('#btn-review-on'));
} }
this.btnPrev && this.btnPrev.render(this.$el.find('#btn-change-prev'));
this.btnNext && this.btnNext.render(this.$el.find('#btn-change-next'));
this.btnReviewView && this.btnReviewView.render(this.$el.find('#btn-review-view')); this.btnReviewView && this.btnReviewView.render(this.$el.find('#btn-review-view'));
this.btnSharing && this.btnSharing.render(this.$el.find('#slot-btn-sharing')); this.btnSharing && this.btnSharing.render(this.$el.find('#slot-btn-sharing'));