From 848e27bbe2b5286bf017f4a7694d535b4d4c8e5c Mon Sep 17 00:00:00 2001 From: Alexander Yuzhin Date: Tue, 6 Dec 2016 12:25:21 +0300 Subject: [PATCH] [SE mobile] Add EditContainer. --- .../app/controller/edit/EditContainer.js | 9 ++-- .../app/controller/edit/EditContainer.js | 2 +- apps/spreadsheeteditor/mobile/app-dev.js | 4 +- .../app/controller/edit/EditContainer.js | 54 +++++++++---------- .../mobile/app/view/Toolbar.js | 2 +- 5 files changed, 36 insertions(+), 35 deletions(-) diff --git a/apps/documenteditor/mobile/app/controller/edit/EditContainer.js b/apps/documenteditor/mobile/app/controller/edit/EditContainer.js index acf0ac896..ba6138c24 100644 --- a/apps/documenteditor/mobile/app/controller/edit/EditContainer.js +++ b/apps/documenteditor/mobile/app/controller/edit/EditContainer.js @@ -40,8 +40,11 @@ * */ define([ - 'core' -], function (core) { + 'core', + 'jquery', + 'underscore', + 'backbone' +], function (core, $, _, Backbone) { 'use strict'; DE.Controllers.EditContainer = Backbone.Controller.extend(_.extend((function() { @@ -108,7 +111,7 @@ define([ var me = this, editors = []; - if (_settings.length < 0) { + if (_settings.length < 1) { editors.push(me._emptyEditController()); } else { if (_.contains(_settings, 'text')) { diff --git a/apps/presentationeditor/mobile/app/controller/edit/EditContainer.js b/apps/presentationeditor/mobile/app/controller/edit/EditContainer.js index eccb9ee48..1cfa69a93 100644 --- a/apps/presentationeditor/mobile/app/controller/edit/EditContainer.js +++ b/apps/presentationeditor/mobile/app/controller/edit/EditContainer.js @@ -108,7 +108,7 @@ define([ var me = this, editors = []; - if (_settings.length < 0) { + if (_settings.length < 1) { editors.push(me._emptyEditController()); } else { if (_.contains(_settings, 'slide')) { diff --git a/apps/spreadsheeteditor/mobile/app-dev.js b/apps/spreadsheeteditor/mobile/app-dev.js index f87eee3c1..9bf929fc5 100644 --- a/apps/spreadsheeteditor/mobile/app-dev.js +++ b/apps/spreadsheeteditor/mobile/app-dev.js @@ -122,7 +122,7 @@ require([ , 'CellEditor' , 'Statusbar' ,'Settings' - // ,'EditContainer' + ,'EditContainer' // ,'EditText' // ,'EditParagraph' // ,'EditTable' @@ -192,7 +192,7 @@ require([ , 'spreadsheeteditor/mobile/app/controller/CellEditor' , 'spreadsheeteditor/mobile/app/controller/Statusbar' , 'spreadsheeteditor/mobile/app/controller/Settings' - // ,'spreadsheeteditor/mobile/app/controller/edit/EditContainer' + ,'spreadsheeteditor/mobile/app/controller/edit/EditContainer' // ,'spreadsheeteditor/mobile/app/controller/edit/EditText' // ,'spreadsheeteditor/mobile/app/controller/edit/EditParagraph' // ,'spreadsheeteditor/mobile/app/controller/edit/EditTable' diff --git a/apps/spreadsheeteditor/mobile/app/controller/edit/EditContainer.js b/apps/spreadsheeteditor/mobile/app/controller/edit/EditContainer.js index acf0ac896..f8b008f16 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/edit/EditContainer.js +++ b/apps/spreadsheeteditor/mobile/app/controller/edit/EditContainer.js @@ -33,18 +33,21 @@ /** * EditContainer.js - * Document Editor + * Spreadsheet Editor * - * Created by Alexander Yuzhin on 9/27/16 + * Created by Alexander Yuzhin on 12/6/16 * Copyright (c) 2016 Ascensio System SIA. All rights reserved. * */ define([ - 'core' -], function (core) { + 'core', + 'jquery', + 'underscore', + 'backbone' +], function (core, $, _, Backbone) { 'use strict'; - DE.Controllers.EditContainer = Backbone.Controller.extend(_.extend((function() { + SSE.Controllers.EditContainer = Backbone.Controller.extend(_.extend((function() { // Private var _settings = []; @@ -68,7 +71,7 @@ define([ showModal: function() { var me = this, - mainView = DE.getController('Editor').getView('Editor').f7View, + mainView = SSE.getController('Editor').getView('Editor').f7View, isAndroid = Framework7.prototype.device.android === true; if ($$('.container-edit.modal-in').length > 0) { @@ -81,7 +84,7 @@ define([ me._showByStack(Common.SharedSettings.get('phone')); - DE.getController('Toolbar').getView('Toolbar').hideSearch(); + SSE.getController('Toolbar').getView('Toolbar').hideSearch(); }, hideModal: function () { @@ -108,56 +111,49 @@ define([ var me = this, editors = []; - if (_settings.length < 0) { + if (_settings.length < 1) { editors.push(me._emptyEditController()); } else { - if (_.contains(_settings, 'text')) { + if (_.contains(_settings, 'cell')) { editors.push({ - caption: me.textText, - id: 'edit-text', - layout: DE.getController('EditText').getView('EditText').rootLayout() - }) - } - if (_.contains(_settings, 'paragraph')) { - editors.push({ - caption: me.textParagraph, - id: 'edit-paragraph', - layout: DE.getController('EditParagraph').getView('EditParagraph').rootLayout() + caption: me.textCell, + id: 'edit-cell', + layout: SSE.getController('EditCell').getView('EditCell').rootLayout() }) } if (_.contains(_settings, 'table')) { editors.push({ caption: me.textTable, id: 'edit-table', - layout: DE.getController('EditTable').getView('EditTable').rootLayout() + layout: SSE.getController('EditTable').getView('EditTable').rootLayout() }) } if (_.contains(_settings, 'shape')) { editors.push({ caption: me.textShape, id: 'edit-shape', - layout: DE.getController('EditShape').getView('EditShape').rootLayout() + layout: SSE.getController('EditShape').getView('EditShape').rootLayout() }) } if (_.contains(_settings, 'image')) { editors.push({ caption: me.textImage, id: 'edit-image', - layout: DE.getController('EditImage').getView('EditImage').rootLayout() + layout: SSE.getController('EditImage').getView('EditImage').rootLayout() }) } if (_.contains(_settings, 'chart')) { editors.push({ caption: me.textChart, id: 'edit-chart', - layout: DE.getController('EditChart').getView('EditChart').rootLayout() + layout: SSE.getController('EditChart').getView('EditChart').rootLayout() }) } if (_.contains(_settings, 'hyperlink')) { editors.push({ caption: me.textHyperlink, id: 'edit-link', - layout: DE.getController('EditHyperlink').getView('EditHyperlink').rootLayout() + layout: SSE.getController('EditHyperlink').getView('EditHyperlink').rootLayout() }) } } @@ -167,7 +163,7 @@ define([ _showByStack: function(isPhone) { var me = this, - mainView = DE.getController('Editor').getView('Editor').f7View, + mainView = SSE.getController('Editor').getView('Editor').f7View, isAndroid = Framework7.prototype.device.android === true, layoutEditors = me._layoutEditorsByStack(); @@ -350,11 +346,13 @@ define([ } _settings = _.uniq(_settings); + + //TODO: DEBUG ONLY + _settings = []; }, textSettings: 'Settings', - textText: 'Text', - textParagraph: 'Paragraph', + textCell: 'Cell', textTable: 'Table', textShape: 'Shape', textImage: 'Image', @@ -362,5 +360,5 @@ define([ textHyperlink: 'Hyperlink' } - })(), DE.Controllers.EditContainer || {})) + })(), SSE.Controllers.EditContainer || {})) }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/app/view/Toolbar.js b/apps/spreadsheeteditor/mobile/app/view/Toolbar.js index ae1cda6ad..fd4226d22 100644 --- a/apps/spreadsheeteditor/mobile/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/mobile/app/view/Toolbar.js @@ -124,7 +124,7 @@ define([ // Editor showEdition: function () { - // SSE.getController('EditContainer').showModal(); + SSE.getController('EditContainer').showModal(); }, // Inserts