Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DE] Change submit button #3019

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions apps/common/main/resources/less/buttons.less
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,48 @@
background-color: @highlight-fill-button-pressed !important;
}
}
&.back-color {
.font-weight-bold();
border: 1px solid @text-toolbar-header-ie;
border: 1px solid @text-toolbar-header;
color: @text-toolbar-header-ie;
color: @text-toolbar-header;
background-color: transparent;

.style-off-tabs & {
border: 1px solid @text-normal-ie;
border: 1px solid @text-normal;
color: @text-normal-ie;
color: @text-normal;
}

&:not(:disabled) {
opacity: @header-component-normal-icon-opacity;
}

&:hover:not(.disabled),
.over:not(.disabled) {
background-color: @highlight-header-button-hover-ie !important;
background-color: @highlight-header-button-hover !important;

.style-off-tabs & {
background-color: @highlight-button-hover-ie !important;
background-color: @highlight-button-hover !important;
}
}

&:active:not(.disabled),
&.active:not(.disabled) {
background-color: @highlight-header-button-pressed-ie !important;
background-color: @highlight-header-button-pressed !important;

.style-off-tabs & {
background-color: @highlight-button-pressed-ie !important;
background-color: @highlight-button-pressed !important;
}
}

}
}

.btn-text-menu-default {
Expand Down
79 changes: 39 additions & 40 deletions apps/documenteditor/forms/app/controller/ApplicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,33 @@ define([
me.api.asc_ClearAllSpecialForms();
});
me.view.btnSubmit.on('click', function(){
if (!me.api.asc_IsAllRequiredFormsFilled()) {
me.api.asc_MoveToFillingForm(true, true, true);
if (!me.requiredTooltip) {
me.requiredTooltip = new Common.UI.SynchronizeTip({
extCls: 'colored',
placement: 'bottom-left',
target: me.view.btnSubmit.$el,
text: me.textRequired,
showLink: false,
closable: false,
showButton: true,
textButton: me.textGotIt
});
me.requiredTooltip.on('buttonclick', function () {
me.requiredTooltip.hide();
});
}
!me.requiredTooltip.isVisible() && me.requiredTooltip.show();

// Common.UI.warning({
// msg: me.textRequired,
// callback: function() {
// me.api.asc_MoveToFillingForm(true, true, true);
// }
// });
return;
}
me.api.asc_SendForm();
});
me.view.btnDownload.on('click', function(){
Expand Down Expand Up @@ -879,7 +906,7 @@ define([
this.view.btnSubmit.cmpEl.css("pointer-events", "auto");
if (!_submitFail) {
this.view.btnSubmit.setCaption(this.textFilled);
this.view.btnSubmit.cmpEl.addClass('gray');
this.view.btnSubmit.cmpEl.removeClass('yellow').removeClass('back-color').addClass('gray');
if (!this.submitedTooltip) {
this.submitedTooltip = new Common.UI.SynchronizeTip({
text: this.textSubmitOk,
Expand Down Expand Up @@ -1088,8 +1115,10 @@ define([
},

onFillRequiredFields: function(isFilled) {
this.view.btnSubmit.setDisabled(!isFilled);
this.view.btnSubmit.cmpEl.css("pointer-events", isFilled ? "auto" : "none");
// this.view.btnSubmit.setDisabled(!isFilled);
// this.view.btnSubmit.cmpEl.css("pointer-events", isFilled ? "auto" : "none");
this.view.btnSubmit.cmpEl.removeClass(isFilled ? 'back-color' : 'yellow').addClass(isFilled ? 'yellow' : 'back-color');
isFilled && this.requiredTooltip && this.requiredTooltip.hide();
},

onProcessMouse: function(data) {
Expand Down Expand Up @@ -1783,43 +1812,13 @@ define([

// TODO: add asc_hasRequiredFields to sdk

if (this.appOptions.canSubmitForms && !this.api.asc_IsAllRequiredFormsFilled()) {
this.view.btnSubmit.setDisabled(true);
this.view.btnSubmit.cmpEl.css("pointer-events", "none");
var sgroup = $('#id-submit-group');
if (!Common.localStorage.getItem("de-embed-hide-submittip")) {
var requiredTooltip = new Common.UI.SynchronizeTip({
extCls: 'colored',
placement: 'bottom-left',
target: this.view.btnSubmit.$el,
text: this.textRequired,
showLink: false,
closable: false,
showButton: true,
textButton: this.textGotIt
});
var onclose = function () {
requiredTooltip.hide();
me.api.asc_MoveToFillingForm(true, true, true);
sgroup.attr('data-toggle', 'tooltip');
sgroup.tooltip({
title : me.textRequired,
placement : 'bottom'
});
};
requiredTooltip.on('buttonclick', function () {
onclose();
Common.localStorage.setItem("de-embed-hide-submittip", 1);
});
requiredTooltip.on('closeclick', onclose);
requiredTooltip.show();
} else {
sgroup.attr('data-toggle', 'tooltip');
sgroup.tooltip({
title : me.textRequired,
placement : 'bottom'
});
}
if (this.appOptions.canSubmitForms) {
if (this.api.asc_IsAllRequiredFormsFilled())
this.view.btnSubmit.cmpEl.removeClass('back-color').addClass('yellow');
// else {
// this.view.btnSubmit.setDisabled(true);
// this.view.btnSubmit.cmpEl.css("pointer-events", "none");
// }
}

var documentMoveTimer;
Expand Down
8 changes: 5 additions & 3 deletions apps/documenteditor/forms/app/view/ApplicationView.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ define([
this.btnRedo.render($('#id-btn-redo'));

this.btnSubmit = new Common.UI.Button({
cls: 'btn-text-default auto colored yellow margin-left-small margin-right-small',
caption: this.textSubmit
cls: 'btn-text-default auto colored back-color margin-left-small margin-right-small',
caption: this.textSubmit,
hint: this.tipSubmit
});
this.btnSubmit.render($('#id-submit-group'));

Expand Down Expand Up @@ -223,7 +224,8 @@ define([
tipUndo: 'Undo',
tipRedo: 'Redo',
textClearField: 'Clear field',
textClose: 'Close file'
textClose: 'Close file',
tipSubmit: 'Submit form'

}, DE.Views.ApplicationView || {}));
});
2 changes: 1 addition & 1 deletion apps/documenteditor/forms/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
</ul>
</div>

<div class="toolbar" id="toolbar">
<div class="toolbar style-off-tabs" id="toolbar">
<div class="group left">
<div class="margin-right-large"><a id="header-logo" class="brand-logo" href="http://www.onlyoffice.com/" target="_blank"></a></div>
<span id="id-btn-undo" class="margin-right-small big-resolution"></span>
Expand Down
2 changes: 1 addition & 1 deletion apps/documenteditor/forms/index.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
</ul>
</div>

<div class="toolbar" id="toolbar">
<div class="toolbar style-off-tabs" id="toolbar">
<div class="group left">
<div class="margin-right-large"><a id="header-logo" class="brand-logo" href="http://www.onlyoffice.com/" target="_blank"></a></div>
<span id="id-btn-undo" class="margin-right-small big-resolution"></span>
Expand Down
3 changes: 2 additions & 1 deletion apps/documenteditor/forms/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,6 @@
"DE.Views.ApplicationView.txtPrint": "Print",
"DE.Views.ApplicationView.txtSearch": "Find",
"DE.Views.ApplicationView.txtShare": "Share",
"DE.Views.ApplicationView.txtTheme": "Interface theme"
"DE.Views.ApplicationView.txtTheme": "Interface theme",
"DE.Views.ApplicationView.tipSubmit": "Submit form"
}
45 changes: 28 additions & 17 deletions apps/documenteditor/main/app/controller/FormsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ define([
callback: function() {
me.api.asc_MoveToFillingForm(true, true, true);
me.view.btnSubmit.updateHint(me.view.textRequired);
}} : undefined
}} : undefined,
'submit-required': this.appConfig.isRestrictedEdit ? {placement: 'bottom-' + dirLeft, text: this.view.textRequired, link: false, target: '#slot-btn-header-form-submit'} : undefined
};
!Common.localStorage.getItem(this._helpTips['key'].name) && this.addListeners({'RightMenu': {'rightmenuclick': this.onRightMenuClick}});
this.addListeners({
Expand Down Expand Up @@ -346,14 +347,17 @@ define([

onSubmitClick: function() {
if (!this.api.asc_IsAllRequiredFormsFilled()) {
var me = this;
Common.UI.warning({
msg: this.view.textRequired,
callback: function() {
me.api.asc_MoveToFillingForm(true, true, true);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
});
this.showHelpTip('submit-required');
this.api.asc_MoveToFillingForm(true, true, true);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
// var me = this;
// Common.UI.warning({
// msg: this.view.textRequired,
// callback: function() {
// me.api.asc_MoveToFillingForm(true, true, true);
// Common.NotificationCenter.trigger('edit:complete', me.toolbar);
// }
// });
return;
}

Expand Down Expand Up @@ -459,7 +463,6 @@ define([
Common.Utils.lockControls(Common.enumLock.submit, !this._submitFail, {array: [this.view.btnSubmit]})
if (!this._submitFail) {
this.view.btnSubmit.setCaption(this.view.textFilled);
this.view.btnSubmit.cmpEl.addClass('gray');
if (!this.submitedTooltip) {
this.submitedTooltip = new Common.UI.SynchronizeTip({
text: this.view.textSubmitOk,
Expand Down Expand Up @@ -497,9 +500,13 @@ define([
// }

config.isEdit && config.canFeatureContentControl && config.isFormCreator && !config.isOForm && me.showHelpTip('create'); // show tip only when create form in docxf
if (config.isRestrictedEdit && me.view && me.view.btnSubmit && me.api && !me.api.asc_IsAllRequiredFormsFilled()) {
Common.Utils.lockControls(Common.enumLock.requiredNotFilled, true, {array: [me.view.btnSubmit]});
me.showHelpTip('submit');
if (config.isRestrictedEdit && me.view && me.view.btnSubmit && me.api) {
if (me.api.asc_IsAllRequiredFormsFilled())
me.view.btnSubmit.cmpEl.removeClass('back-color').addClass('yellow');
// else {
// Common.Utils.lockControls(Common.enumLock.requiredNotFilled, true, {array: [me.view.btnSubmit]});
// me.showHelpTip('submit');
// }
}
me.onRefreshRolesList();
me.onChangeProtectDocument();
Expand All @@ -511,13 +518,13 @@ define([
if (props) {
props.tip && props.tip.close();
props.tip = undefined;
force && Common.localStorage.setItem(props.name, 1);
force && props.name && Common.localStorage.setItem(props.name, 1);
}
},

showHelpTip: function(step) {
if (!this._helpTips[step]) return;
if (!Common.localStorage.getItem(this._helpTips[step].name)) {
if (!(this._helpTips[step].name && Common.localStorage.getItem(this._helpTips[step].name))) {
var props = this._helpTips[step],
target = props.target;

Expand Down Expand Up @@ -549,7 +556,7 @@ define([
Common.NotificationCenter.trigger('file:help', props.link.src);
},
'close': function() {
Common.localStorage.setItem(props.name, 1);
props.name && Common.localStorage.setItem(props.name, 1);
props.callback && props.callback();
}
});
Expand Down Expand Up @@ -640,7 +647,11 @@ define([
},

onFillRequiredFields: function(isFilled) {
this.appConfig.isRestrictedEdit && this.appConfig.canFillForms && this.view.btnSubmit && Common.Utils.lockControls(Common.enumLock.requiredNotFilled, !isFilled, {array: [this.view.btnSubmit]});
// this.appConfig.isRestrictedEdit && this.appConfig.canFillForms && this.view.btnSubmit && Common.Utils.lockControls(Common.enumLock.requiredNotFilled, !isFilled, {array: [this.view.btnSubmit]});
if (this.appConfig.isRestrictedEdit && this.appConfig.canFillForms && this.view.btnSubmit) {
this.view.btnSubmit.cmpEl.removeClass(isFilled ? 'back-color' : 'yellow').addClass(isFilled ? 'yellow' : 'back-color');
isFilled && this.closeHelpTip('submit-required');
}
},

onCountPages: function(count) {
Expand Down
2 changes: 1 addition & 1 deletion apps/documenteditor/main/app/view/FormsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ define([
if (this.appConfig.canSubmitForms) {
if (this.appConfig.isRestrictedEdit && this.appConfig.canFillForms) {
this.btnSubmit = new Common.UI.Button({
cls: 'btn-text-default auto yellow',
cls: 'btn-text-default auto back-color',
caption: this.capBtnSubmit,
lock: [_set.lostConnect, _set.disableOnStart, _set.requiredNotFilled, _set.submit],
dataHint: '0',
Expand Down
Loading