From 29354cd1168ff73f5a30b7d794f0e206e3dc8396 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 30 Oct 2019 16:57:48 +0300 Subject: [PATCH] [Calendar] Add test for calendar --- .../main/app/controller/Links.js | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index f6d37fd4c..46b8d269b 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -93,8 +93,10 @@ define([ this.api.asc_registerCallback('asc_onCanAddHyperlink', _.bind(this.onApiCanAddHyperlink, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); - this.api.asc_registerCallback('asc_onShowContentControlsActions',_.bind(this.onShowContentControlsActions, this)); - this.api.asc_registerCallback('asc_onHideContentControlsActions',_.bind(this.onHideContentControlsActions, this)); + this.api.asc_registerCallback('asc_onShowContentControlsActions',_.bind(this.onShowControlsActions, this)); + this.api.asc_registerCallback('asc_onHideContentControlsActions',_.bind(this.onHideControlsActions, this)); + // this.api.asc_registerCallback('asc_onShowContentControlsActions',_.bind(this.onShowContentControlsActions, this)); + // this.api.asc_registerCallback('asc_onHideContentControlsActions',_.bind(this.onHideContentControlsActions, this)); } return this; @@ -391,6 +393,36 @@ define([ onHideContentControlsActions: function() { this.view.contentsMenu && this.view.contentsMenu.hide(); this.view.contentsUpdateMenu && this.view.contentsUpdateMenu.hide(); + }, + + onShowControlsActions: function(action, x, y) { + var documentHolderView = this.getApplication().getController('DocumentHolder').documentHolder, + controlsContainer = documentHolderView.cmpEl.find('#calendar-control-container'), + me = this; + + if (controlsContainer.length < 1) { + controlsContainer = $('
'); + documentHolderView.cmpEl.append(controlsContainer); + } + + Common.UI.Menu.Manager.hideAll(); + + controlsContainer.css({left: x, top : y}); + controlsContainer.show(); + + if (!this.cmpCalendar) + this.cmpCalendar = new Common.UI.Calendar({ + el: documentHolderView.cmpEl.find('#id-document-calendar-control'), + firstday: 1 + }); + + documentHolderView._preventClick = true; + }, + + onHideControlsActions: function() { + var controlsContainer = this.getApplication().getController('DocumentHolder').documentHolder.cmpEl.find('#calendar-control-container'); + if (controlsContainer.is(':visible')) + controlsContainer.hide(); } }, DE.Controllers.Links || {}));