From a1fba17d6b1716956723f12c2e4382ddcb028b40 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 Oct 2021 16:41:06 +0300 Subject: [PATCH] [DE] Set forms as active tab and show tooltip for docxf files. --- .../main/resources/less/synchronize-tip.less | 42 +++++++++++++++++++ .../main/app/controller/FormsTab.js | 24 +++++++++++ .../main/app/controller/Main.js | 3 +- .../main/app/controller/Toolbar.js | 7 +--- apps/documenteditor/main/app/view/FormsTab.js | 3 +- apps/documenteditor/main/locale/en.json | 1 + 6 files changed, 73 insertions(+), 7 deletions(-) diff --git a/apps/common/main/resources/less/synchronize-tip.less b/apps/common/main/resources/less/synchronize-tip.less index 5b1f03285..a78fa6f87 100644 --- a/apps/common/main/resources/less/synchronize-tip.less +++ b/apps/common/main/resources/less/synchronize-tip.less @@ -67,6 +67,48 @@ } } + &.colored { + .asc-synchronizetip { + background-color: @background-contrast-popover; + color: @text-contrast-background; + .close { + &:before, &:after { + background-color: @text-contrast-background; + } + } + } + + .tip-arrow:after { + background-color: @background-contrast-popover; + } + + .btn-div { + display: inline-block; + border: 1px solid @border-regular-control-ie; + border: 1px solid @border-regular-control; + border-radius: 2px; + padding: 3px 12px; + margin-top: 10px; + } + + .show-link label { + border-bottom: @scaled-one-px-value-ie dotted @text-contrast-background-ie; + border-bottom: @scaled-one-px-value dotted @text-contrast-background; + color: @text-contrast-background-ie; + color: @text-contrast-background; + cursor: pointer; + + &:hover:not(:disabled) { + color: @text-contrast-background; + border-bottom-color: dotted @text-contrast-background; + } + + &:active { + color: @text-contrast-background; + border-bottom-color: dotted @text-contrast-background; + } + } + } &.inc-index { z-index: @zindex-navbar + 4; diff --git a/apps/documenteditor/main/app/controller/FormsTab.js b/apps/documenteditor/main/app/controller/FormsTab.js index 61fddb753..9865320bb 100644 --- a/apps/documenteditor/main/app/controller/FormsTab.js +++ b/apps/documenteditor/main/app/controller/FormsTab.js @@ -360,7 +360,31 @@ define([ clr && (clr = Common.Utils.ThemeColor.getHexColor(clr.get_r(), clr.get_g(), clr.get_b())); me.view.btnHighlight.currentColor = clr; } + config.isEdit && config.canFeatureContentControl && config.isFormCreator && me.showCreateFormTip(); // show tip only when create form in docxf }); + }, + + showCreateFormTip: function() { + if (!Common.localStorage.getItem("de-hide-createform-tip")) { + var target = $('.toolbar').find('.ribtab [data-tab=forms]').parent(); + var tip = new Common.UI.SynchronizeTip({ + extCls: 'colored', + placement: 'bottom-right', + target: target, + text: this.view.textCreateForm, + showLink: true + }); + tip.on({ + 'dontshowclick': function() { + Common.localStorage.setItem("de-hide-createform-tip", 1); + tip.close(); + }, + 'closeclick': function() { + tip.close(); + } + }); + tip.show(); + } } }, DE.Controllers.FormsTab || {})); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 74c7ead81..d0372b4f5 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -480,7 +480,8 @@ define([ } var type = data.doc ? /^(?:(docxf))$/.exec(data.doc.fileType) : false; - this.appOptions.canFeatureForms = !!(type && typeof type[1] === 'string'); + this.appOptions.isFormCreator = !!(type && typeof type[1] === 'string'); + this.appOptions.canFeatureForms = this.appOptions.isFormCreator; // show forms only for docxf type = data.doc ? /^(?:(oform))$/.exec(data.doc.fileType) : false; if (type && typeof type[1] === 'string') { diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 24081a9c6..07ccd796f 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -3224,11 +3224,8 @@ define([ if ($panel) { me.toolbar.addTab(tab, $panel, 4); me.toolbar.setVisible('forms', true); - if (config.isEdit && config.canFeatureContentControl) { - Array.prototype.push.apply(me.toolbar.toolbarControls, forms.getView('FormsTab').getButtons()); - } else if (!compactview) { - me.toolbar.setTab('forms'); - } + config.isEdit && config.canFeatureContentControl && Array.prototype.push.apply(me.toolbar.toolbarControls, forms.getView('FormsTab').getButtons()); + !compactview && (config.isFormCreator || config.isRestrictedEdit && config.canFillForms) && me.toolbar.setTab('forms'); } } } diff --git a/apps/documenteditor/main/app/view/FormsTab.js b/apps/documenteditor/main/app/view/FormsTab.js index 33a6ce3d6..c15e19e79 100644 --- a/apps/documenteditor/main/app/view/FormsTab.js +++ b/apps/documenteditor/main/app/view/FormsTab.js @@ -431,7 +431,8 @@ define([ textRequired: 'Fill all required fields to send form.', capBtnSaveForm: 'Save as a Form', tipSaveForm: 'Save a file as a fillable OFORM document', - txtUntitled: 'Untitled' + txtUntitled: 'Untitled', + textCreateForm: 'Add fields and create a fillable OFORM document' } }()), DE.Views.FormsTab || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 10eb5200b..2e3150124 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1829,6 +1829,7 @@ "DE.Views.FormsTab.tipTextField": "Insert text field", "DE.Views.FormsTab.tipViewForm": "View form", "DE.Views.FormsTab.txtUntitled": "Untitled", + "DE.Views.FormsTab.textCreateForm": "Add fields and create a fillable OFORM document", "DE.Views.HeaderFooterSettings.textBottomCenter": "Bottom center", "DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom left", "DE.Views.HeaderFooterSettings.textBottomPage": "Bottom of Page",