From adde3f65f27e34f233384a1f13560bec42436801 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 19 May 2021 01:26:16 +0300 Subject: [PATCH] [DE embed] Add submit button --- .../embed/resources/img/icon-menu-sprite.svg | 8 ++--- apps/common/embed/resources/less/common.less | 34 +++++++++++++++---- apps/documenteditor/embed/index.html | 7 ++-- .../embed/js/ApplicationController.js | 16 ++++++++- 4 files changed, 50 insertions(+), 15 deletions(-) diff --git a/apps/common/embed/resources/img/icon-menu-sprite.svg b/apps/common/embed/resources/img/icon-menu-sprite.svg index 292b8c569..97b51fd3e 100644 --- a/apps/common/embed/resources/img/icon-menu-sprite.svg +++ b/apps/common/embed/resources/img/icon-menu-sprite.svg @@ -117,7 +117,7 @@ - + @@ -133,13 +133,13 @@ - + - + - + diff --git a/apps/common/embed/resources/less/common.less b/apps/common/embed/resources/less/common.less index bd9231712..23a69e920 100644 --- a/apps/common/embed/resources/less/common.less +++ b/apps/common/embed/resources/less/common.less @@ -63,6 +63,10 @@ @controlBtnHoverBottomColor: #8AACF1; @btnColor: #d8dadc; @btnActiveColor: #7d858c; +@btnColored: #446995; +@btnActiveColored: #293F59; +@btnHoverColored: #375478; + @iconSpriteCommonPath: "../../../../common/embed/resources/img/glyphicons.png"; @icon-socnet-size: 40px; @@ -248,6 +252,24 @@ padding-right: 5px; } + &.colored { + padding: 0 14px; + height: 28px; + background-color: @btnColored; + border-radius: 3px; + color: #ffffff; + } + + // Hover state + &:hover { + text-decoration: none; + background-color: @btnColor; + + &.colored { + background-color: @btnHoverColored; + } + } + &:active { &, .btn-icon { background-position-y: -@icon-height !important; @@ -256,12 +278,10 @@ &.has-caption { color: #ffffff } - } - // Hover state - &:hover { - text-decoration: none; - background-color: @btnColor; + &.colored { + background-color: @btnActiveColored; + } } // Focus state for keyboard and accessibility @@ -506,10 +526,10 @@ background-position: -@icon-width*11 0; } - &.arrow-top { + &.arrow-up { background-position: -@icon-width*17 0; } - &.arrow-bottom { + &.arrow-down { background-position: -@icon-width*16 0; } &.clear-style { diff --git a/apps/documenteditor/embed/index.html b/apps/documenteditor/embed/index.html index 4b3957b4f..9edb823a7 100644 --- a/apps/documenteditor/embed/index.html +++ b/apps/documenteditor/embed/index.html @@ -188,15 +188,16 @@
-
-
of 0
+ +
of 0
diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 4464d2a4c..bb8db4582 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -373,6 +373,7 @@ DE.ApplicationController = new(function(){ var licType = params.asc_getLicenseType(); appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); appOptions.canFillForms = appOptions.canLicense && (permissions.fillForms===true) && (config.mode !== 'view'); + appOptions.canSubmitForms = appOptions.canLicense && (typeof (config.customization) == 'object') && !!config.customization.submitForm; api.asc_setViewMode(!appOptions.canFillForms); @@ -380,9 +381,12 @@ DE.ApplicationController = new(function(){ $('#id-btn-prev-field').hide(); $('#id-btn-next-field').hide(); $('#id-btn-clear-fields').hide(); + $('#id-btn-submit').hide(); } else { + $('#id-pages').hide(); $('#id-btn-next-field .caption').text(me.textNext); $('#id-btn-clear-fields .caption').text(me.textClear); + $('#id-btn-prev-field').on('click', function(){ api.asc_MoveToFillingForm(false); }); @@ -392,6 +396,15 @@ DE.ApplicationController = new(function(){ $('#id-btn-clear-fields').on('click', function(){ api.asc_ClearAllSpecialForms(); }); + + if (appOptions.canSubmitForms) { + $('#id-btn-submit .caption').text(me.textSubmit); + $('#id-btn-submit').on('click', function(){ + api.asc_SendForm(); + }); + } else + $('#id-btn-submit').hide(); + api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms); api.asc_SetFastCollaborative(true); api.asc_setAutoSaveGap(1); @@ -648,6 +661,7 @@ DE.ApplicationController = new(function(){ errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
Please contact your Document Server administrator for details.', errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.', textNext: 'Next Field', - textClear: 'Clear All Fields' + textClear: 'Clear All Fields', + textSubmit: 'Submit' } })(); \ No newline at end of file