From bf10598c25d6160e9a9416311f4f4fdba02bb0b0 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Wed, 11 Jan 2017 13:53:59 +0300 Subject: [PATCH] [SSE mobile] separate 'add hyperlink' option --- .../mobile/app/controller/DocumentHolder.js | 5 +- .../mobile/app/controller/add/AddContainer.js | 67 +++++++++++-------- 2 files changed, 42 insertions(+), 30 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js index 2c2a2e3f0..bf9a3c0dd 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js @@ -131,8 +131,9 @@ define([ break; case 'addlink': me.view.hideMenu(); - SSE.getController('AddContainer').showModal(); - SSE.getController('AddOther').getView('AddOther').showInsertLink(); + SSE.getController('AddContainer').showModal({ + panel: 'hyperlink' + }); break; case 'openlink': var linkinfo = info.asc_getHyperlink(); diff --git a/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js b/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js index 913cf345d..da8d230f7 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js +++ b/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js @@ -104,7 +104,7 @@ define([ } options = opts; - parentButton = !opts ? '#toolbar-add' : opts.button; + parentButton = !opts || !opts.button ? '#toolbar-add' : opts.button; me._showByStack(Common.SharedSettings.get('phone')); this.api.asc_closeCellEditor(); @@ -151,6 +151,15 @@ define([ layout: SSE.getController('AddOther').getView('AddOther').rootLayout() }); + if ( options && options.panel == 'hyperlink' ) { + var view = SSE.getController('AddLink').getView(); + addViews.push({ + caption: view.getTitle(), + id: 'add-link', + layout: view.rootLayout() + }); + } + return addViews; }, @@ -174,11 +183,15 @@ define([ ); - if (layoutAdds.length < 2) { + if (layoutAdds.length == 1) { $layoutNavbar .find('.center') .removeClass('categories') .html(layoutAdds[0].caption); + + $layoutPages = $('
' + + layoutAdds[0].layout + + '
'); } else { if (isAndroid) { $layoutNavbar @@ -208,36 +221,34 @@ define([ ); }); } - } + // Content - // Content - - var $layoutPages = $( - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' - ); - - _.each(layoutAdds, function (addView, index) { - $layoutPages.find('.tabs').append( - '
' + - '
' + - '
' + - '
' + - addView.layout + + var _arrangePages = _.template( + '<% _.each(pages, function(view, index) { %>' + + '
">' + + '
' + + '
' + + '
' + + '<%= view.layout %>' + + '
' + '
' + '
' + '
' + - '
' - ); - }); + '<% }); %>'); + + var $layoutPages = $('
' + + '
' + + '
' + + '
' + + '
' + + _arrangePages({pages: layoutAdds}) + + '
' + + '
' + + '
' + + '
' + + '
'); + } if (isPhone) { me.picker = $$(uiApp.popup( @@ -288,7 +299,7 @@ define([ domCache: true }); - Common.NotificationCenter.trigger('addcontainer:show'); + Common.NotificationCenter.trigger('addcontainer:show', options); }, textChart: 'Chart',