From 55e48173ce6e883246db01bf3acdc56efc902a8a Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Wed, 29 Mar 2017 19:27:44 +0300 Subject: [PATCH] [Common] refactoring --- apps/common/main/lib/controller/Comments.js | 6 +++++- apps/documenteditor/main/app/controller/LeftMenu.js | 2 +- apps/presentationeditor/main/app/controller/LeftMenu.js | 2 +- apps/spreadsheeteditor/main/app/controller/LeftMenu.js | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/common/main/lib/controller/Comments.js b/apps/common/main/lib/controller/Comments.js index a7fafc8bc..19920d4ba 100644 --- a/apps/common/main/lib/controller/Comments.js +++ b/apps/common/main/lib/controller/Comments.js @@ -1298,7 +1298,11 @@ define([ // MM/dd/yyyy hh:mm AM return (date.getMonth() + 1) + '/' + (date.getDate()) + '/' + date.getFullYear() + ' ' + format(date); + }, + + getView: function(name) { + return !name && this.view ? + this.view : Backbone.Controller.prototype.getView.call(this, name); } - }, Common.Controllers.Comments || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 82455d1bc..2ba7f930c 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -166,7 +166,7 @@ define([ if ( this.mode.canCoAuthoring ) { this.leftMenu.btnComments[(this.mode.isEdit && this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide'](); if (this.mode.canComments) - this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView('Common.Views.Comments')); + this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView()); this.leftMenu.btnChat[(this.mode.canChat && !this.mode.isLightVersion) ? 'show' : 'hide'](); if (this.mode.canChat) diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index 827137604..50b146b79 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -157,7 +157,7 @@ define([ if ( this.mode.canCoAuthoring ) { this.leftMenu.btnComments[(this.mode.isEdit&&this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide'](); if (this.mode.canComments) - this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView('Common.Views.Comments')); + this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView()); this.leftMenu.btnChat[(this.mode.canChat && !this.mode.isLightVersion) ? 'show' : 'hide'](); if (this.mode.canChat) diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 22d7efca5..49c9e581d 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -165,7 +165,7 @@ define([ if ( this.mode.canCoAuthoring ) { this.leftMenu.btnComments[(this.mode.isEdit&&this.mode.canComments && !this.mode.isLightVersion) ? 'show' : 'hide'](); if (this.mode.canComments) - this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView('Common.Views.Comments')); + this.leftMenu.setOptionsPanel('comment', this.getApplication().getController('Common.Controllers.Comments').getView()); this.leftMenu.btnChat[(this.mode.canChat && !this.mode.isLightVersion) ? 'show' : 'hide'](); if (this.mode.canChat)