From c7d75003865ca187f5dd760d00b5943d9a2b2e2a Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Mon, 22 Apr 2019 14:12:16 +0300 Subject: [PATCH] [sse mobile] Add page orientation in Spreadsheet Settings --- .../mobile/app/controller/Settings.js | 19 ++++++++++++++- .../mobile/app/template/Settings.template | 23 +++++++++++++++++++ .../mobile/app/view/Settings.js | 5 +++- apps/spreadsheeteditor/mobile/locale/en.json | 5 ++++ 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/app/controller/Settings.js b/apps/spreadsheeteditor/mobile/app/controller/Settings.js index fff456b6f..a4ef98f14 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Settings.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Settings.js @@ -177,7 +177,8 @@ define([ var me = this, $pageSpreadsheetSettings = $('.page[data-page=settings-spreadsheet-view]'), $switchHideHeadings = $pageSpreadsheetSettings.find('#hide-headings input'), - $switchHideGridlines = $pageSpreadsheetSettings.find('#hide-gridlines input'); + $switchHideGridlines = $pageSpreadsheetSettings.find('#hide-gridlines input'), + $pageOrientation = $('.page[data-page=settings-spreadsheet-view] input:radio[name=table-orientation]'); $switchHideHeadings.single('change', _.bind(me.clickCheckboxHideHeadings, me)); $switchHideGridlines.single('change', _.bind(me.clickCheckboxHideGridlines, me)); @@ -185,6 +186,22 @@ define([ var params = me.sheetChanged(); $switchHideHeadings.prop('checked',!params.asc_getShowRowColHeaders()); $switchHideGridlines.prop('checked',!params.asc_getShowGridLines()); + + // Init orientation + var currentSheet = this.api.asc_getActiveWorksheetIndex(), + props = this.api.asc_getPageOptions(currentSheet), + opt = props.asc_getPageSetup(); + if(Number(opt.asc_getOrientation()) === 0) { + $('.page[data-page=settings-spreadsheet-view] input:radio[name=table-orientation][value="0"]').prop( "checked", true ); + } else { + $('.page[data-page=settings-spreadsheet-view] input:radio[name=table-orientation][value="1"]').prop( "checked", true ); + } + $pageOrientation.single('change', _.bind(me.onOrientationChange, me)); + }, + + onOrientationChange: function(e) { + var value = $(e.currentTarget).attr('value'); + this.api.asc_changePageOrient(Number(value) === Asc.c_oAscPageOrientation.PagePortrait, this.api.asc_getActiveWorksheetIndex()); }, clickCheckboxHideHeadings: function(e) { diff --git a/apps/spreadsheeteditor/mobile/app/template/Settings.template b/apps/spreadsheeteditor/mobile/app/template/Settings.template index 3e2110442..861257d23 100644 --- a/apps/spreadsheeteditor/mobile/app/template/Settings.template +++ b/apps/spreadsheeteditor/mobile/app/template/Settings.template @@ -417,6 +417,29 @@
+
<%= scope.textOrientation %>
+
+
    +
  • + +
  • +
  • + +
  • +
+
  • diff --git a/apps/spreadsheeteditor/mobile/app/view/Settings.js b/apps/spreadsheeteditor/mobile/app/view/Settings.js index a636e0c68..c1624e37d 100644 --- a/apps/spreadsheeteditor/mobile/app/view/Settings.js +++ b/apps/spreadsheeteditor/mobile/app/view/Settings.js @@ -249,7 +249,10 @@ define([ textSpreadsheetSettings: 'Spreadsheet Settings', textColorSchemes: 'Color Schemes', textHideHeadings: 'Hide Headings', - textHideGridlines: 'Hide Gridlines' + textHideGridlines: 'Hide Gridlines', + textOrientation: 'Orientation', + textPortrait: 'Portrait', + textLandscape: 'Landscape' } })(), SSE.Views.Settings || {})) }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index 993c4f851..26e36139d 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -519,6 +519,11 @@ "SSE.Views.Settings.textInch": "Inch", "SSE.Views.Settings.textColorSchemes": "Color Schemes", "SSE.Views.Settings.textSpreadsheetSettings": "Spreadsheet Settings", + "SSE.Views.Settings.textHideHeadings": "Hide Headings", + "SSE.Views.Settings.textHideGridlines": "Hide Gridlines", + "SSE.Views.Settings.textOrientation": "Orientation", + "SSE.Views.Settings.textPortrait": "Portrait", + "SSE.Views.Settings.textLandscape": "Landscape", "SSE.Views.Settings.unknownText": "Unknown", "SSE.Views.Toolbar.textBack": "Back" } \ No newline at end of file