[DE] Turn on/off fill form mode from Forms tab

This commit is contained in:
Julia Radzhabova 2020-10-08 11:11:34 +03:00
parent d5875737ba
commit 0a9d8773cd
5 changed files with 44 additions and 12 deletions

View file

@ -739,7 +739,7 @@ define([
leftMenu.setPreviewMode(disable);
if (this.view) {
this.view.$el.find('.no-group-mask').css('opacity', 1);
this.view.$el.find('.no-group-mask.review').css('opacity', 1);
this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
if ( button ) {

View file

@ -57,7 +57,7 @@ define([
Common.Views.ReviewChanges = Common.UI.BaseView.extend(_.extend((function(){
var template =
'<section id="review-changes-panel" class="panel" data-tab="review">' +
'<div class="group no-group-mask">' +
'<div class="group no-group-mask review">' +
'<span id="slot-btn-sharing" class="btn-slot text x-huge"></span>' +
'<span id="slot-btn-coauthmode" class="btn-slot text x-huge"></span>' +
'</div>' +
@ -70,7 +70,7 @@ define([
'<div class="group">' +
'<span id="btn-review-on" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="group no-group-mask" style="padding-left: 0;">' +
'<div class="group no-group-mask review" style="padding-left: 0;">' +
'<span id="btn-review-view" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="group move-changes" style="padding-left: 0;">' +
@ -84,11 +84,11 @@ define([
'<span id="btn-compare" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="separator long compare"></div>' +
'<div class="group no-group-mask">' +
'<div class="group no-group-mask review form-view">' +
'<span id="slot-btn-chat" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="separator long chat"></div>' +
'<div class="group no-group-mask">' +
'<div class="group no-group-mask review form-view">' +
'<span id="slot-btn-history" class="btn-slot text x-huge"></span>' +
'</div>' +
'</section>';

View file

@ -220,7 +220,8 @@ define([
onModeClick: function(state) {
if (this.api) {
this.disableEditing(state);
this.api.asc_setRestriction(state ? Asc.c_oAscRestrictionType.OnlyForms : Asc.c_oAscRestrictionType.None);
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
@ -250,6 +251,28 @@ define([
this.api.asc_SetGlobalContentControlShowHighlight(true, clr.get_r(), clr.get_g(), clr.get_b());
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
disableEditing: function(disable) {
if (this._state.DisabledEditing != disable) {
this._state.DisabledEditing = disable;
var app = this.getApplication();
var rightMenuController = app.getController('RightMenu');
rightMenuController.getView('RightMenu').clearSelection();
rightMenuController.SetDisabled(disable);
app.getController('Toolbar').DisableToolbar(disable, false, false, true);
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
app.getController('DocumentHolder').getView().SetDisabled(disable);
app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
app.getController('LeftMenu').setPreviewMode(disable);
var comments = app.getController('Common.Controllers.Comments');
if (comments)
comments.setPreviewMode(disable);
if (this.view)
this.view.$el.find('.no-group-mask.form-view').css('opacity', 1);
}
}
}, DE.Controllers.FormsTab || {}));

View file

@ -2896,27 +2896,36 @@ define([
this.DisableToolbar(true, true);
},
DisableToolbar: function(disable, viewMode, reviewmode) {
DisableToolbar: function(disable, viewMode, reviewmode, fillformmode) {
if (viewMode!==undefined) this.editMode = !viewMode;
disable = disable || !this.editMode;
var toolbar_mask = $('.toolbar-mask'),
group_mask = $('.toolbar-group-mask'),
mask = reviewmode ? group_mask : toolbar_mask;
mask = (reviewmode || fillformmode) ? group_mask : toolbar_mask;
if (disable && mask.length>0 || !disable && mask.length==0) return;
var toolbar = this.toolbar;
if(disable) {
if (reviewmode) {
mask = $("<div class='toolbar-group-mask'>").appendTo(toolbar.$el.find('.toolbar section.panel .group:not(.no-mask):not(.no-group-mask)'));
mask = $("<div class='toolbar-group-mask'>").appendTo(toolbar.$el.find('.toolbar section.panel .group:not(.no-mask):not(.no-group-mask.review)'));
} else if (fillformmode) {
mask = $("<div class='toolbar-group-mask'>").appendTo(toolbar.$el.find('.toolbar section.panel .group:not(.no-mask):not(.no-group-mask.form-view)'));
} else
mask = $("<div class='toolbar-mask'>").appendTo(toolbar.$el.find('.toolbar'));
} else {
mask.remove();
}
$('.no-group-mask').css('opacity', (reviewmode || !disable) ? 1 : 0.4);
$('.no-group-mask').each(function(index, item){
var $el = $(item);
if ($el.find('.toolbar-group-mask').length>0)
$el.css('opacity', 0.4);
else {
$el.css('opacity', reviewmode || fillformmode || !disable ? 1 : 0.4);
}
});
disable = disable || (reviewmode ? toolbar_mask.length>0 : group_mask.length>0);
disable = disable || ((reviewmode || fillformmode) ? toolbar_mask.length>0 : group_mask.length>0);
toolbar.$el.find('.toolbar').toggleClass('masked', disable);
if ( toolbar.synchTooltip )
toolbar.synchTooltip.hide();

View file

@ -180,7 +180,7 @@
</div>
</div>
<div class="separator long"></div>
<div class="group">
<div class="group no-group-mask form-view">
<span class="btn-slot text x-huge" id="slot-btn-form-view"></span>
</div>
</section>