From c28e18966508dc4c288b94ec9a66cc66e02cb0e7 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 13 Dec 2023 19:12:31 +0300 Subject: [PATCH] [DE] Fix fill forms mode --- .../main/app/controller/FormsTab.js | 2 +- apps/documenteditor/main/app/view/FormsTab.js | 39 ++++++++++--------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/apps/documenteditor/main/app/controller/FormsTab.js b/apps/documenteditor/main/app/controller/FormsTab.js index 9ad0e2f5e0..99db1c5169 100644 --- a/apps/documenteditor/main/app/controller/FormsTab.js +++ b/apps/documenteditor/main/app/controller/FormsTab.js @@ -275,7 +275,7 @@ define([ }, changeViewFormMode: function(state) { - if (this.view && (state !== this.view.btnViewFormRoles.isActive())) { + if (this.view && this.view.btnViewFormRoles && (state !== this.view.btnViewFormRoles.isActive())) { this.view.btnViewFormRoles.toggle(state, true); this.onModeClick(state); } diff --git a/apps/documenteditor/main/app/view/FormsTab.js b/apps/documenteditor/main/app/view/FormsTab.js index 01796e8e6b..fe18abac0c 100644 --- a/apps/documenteditor/main/app/view/FormsTab.js +++ b/apps/documenteditor/main/app/view/FormsTab.js @@ -133,25 +133,26 @@ define([ this.btnDateTime && this.btnDateTime.on('click', function (b, e) { me.fireEvent('forms:insert', ['datetime']); }); - this.btnViewFormRoles && this.btnViewFormRoles.on('click', function (b, e) { - var item = b.menu.getChecked(); - if (item) { - item = item.caption; - } else if (me._state.roles && me._state.roles.length>0) { - item = me._state.roles[0].asc_getSettings().asc_getName(); - } - me.fireEvent('forms:mode', [b.pressed, item]); - }); - this.btnViewFormRoles.menu.on('item:click', _.bind(function (menu, item) { - if (!!item.checked) { - me.btnViewFormRoles.toggle(true, true); - me.fireEvent('forms:mode', [true, item.caption]); - } - }, me)); - this.btnViewFormRoles.menu.on('show:after', function (menu) { - me.fillRolesMenu(); - }); - + if (this.btnViewFormRoles) { + this.btnViewFormRoles.on('click', function (b, e) { + var item = b.menu.getChecked(); + if (item) { + item = item.caption; + } else if (me._state.roles && me._state.roles.length>0) { + item = me._state.roles[0].asc_getSettings().asc_getName(); + } + me.fireEvent('forms:mode', [b.pressed, item]); + }); + this.btnViewFormRoles.menu.on('item:click', _.bind(function (menu, item) { + if (!!item.checked) { + me.btnViewFormRoles.toggle(true, true); + me.fireEvent('forms:mode', [true, item.caption]); + } + }, me)); + this.btnViewFormRoles.menu.on('show:after', function (menu) { + me.fillRolesMenu(); + }); + } this.btnManager && this.btnManager.on('click', function (b, e) { me.fireEvent('forms:manager'); });