diff --git a/apps/documenteditor/mobile/app/controller/Settings.js b/apps/documenteditor/mobile/app/controller/Settings.js index 44b8717da..b3c477e2a 100644 --- a/apps/documenteditor/mobile/app/controller/Settings.js +++ b/apps/documenteditor/mobile/app/controller/Settings.js @@ -115,7 +115,7 @@ define([ } }); - uiApp.onPageAfterBack('settings-document-view', function (page) { + uiApp.onPageAfterBack('margin-view', function (page) { me.applyPageMarginsIfNeed() }); }, @@ -232,6 +232,9 @@ define([ } else if ('#color-schemes-view' == pageId) { me.initPageColorSchemes(); Common.Utils.addScrollIfNeed('.page[data-page=color-schemes-view]', '.page[data-page=color-schemes-view] .page-content'); + } else if ('#margins-view' == pageId) { + me.initPageMargin(); + Common.Utils.addScrollIfNeed('.page[data-page=margin-view]', '.page[data-page=margin-view] .page-content'); } else { $('#settings-readermode input:checkbox').attr('checked', Common.SharedSettings.get('readerMode')); $('#settings-review input:checkbox').attr('checked', _isReviewOnly || Common.localStorage.getBool("de-mobile-track-changes-" + (_fileKey || ''))); @@ -244,6 +247,27 @@ define([ } }, + initPageMargin: function() { + var me = this; + + // Init page margins + me.localSectionProps = me.api.asc_GetSectionProps(); + + if (me.localSectionProps) { + me.maxMarginsH = me.localSectionProps.get_H() - 26; + me.maxMarginsW = me.localSectionProps.get_W() - 127; + + $('#document-margin-top .item-after label').text(mm2Cm(me.localSectionProps.get_TopMargin()) + ' ' + txtCm); + $('#document-margin-bottom .item-after label').text(mm2Cm(me.localSectionProps.get_BottomMargin()) + ' ' + txtCm); + $('#document-margin-left .item-after label').text(mm2Cm(me.localSectionProps.get_LeftMargin()) + ' ' + txtCm); + $('#document-margin-right .item-after label').text(mm2Cm(me.localSectionProps.get_RightMargin()) + ' ' + txtCm); + } + + _.each(["top", "left", "bottom", "right"], function(align) { + $(Common.Utils.String.format('#document-margin-{0} .button', align)).single('click', _.bind(me.onPageMarginsChange, me, align)); + }) + }, + initPageColorSchemes: function() { $('#color-schemes-content').html(templateInsert); $('.color-schemes-menu').on('click', _.bind(this.onColorSchemaClick, this)); @@ -292,22 +316,6 @@ define([ $pageSize.find('.item-title').text(_pageSizes[_pageSizesIndex]['caption']); $pageSize.find('.item-subtitle').text(_pageSizes[_pageSizesIndex]['subtitle']); - // Init page margins - me.localSectionProps = me.api.asc_GetSectionProps(); - - if (me.localSectionProps) { - me.maxMarginsH = me.localSectionProps.get_H() - 26; - me.maxMarginsW = me.localSectionProps.get_W() - 127; - - $('#document-margin-top .item-after label').text(mm2Cm(me.localSectionProps.get_TopMargin()) + ' ' + txtCm); - $('#document-margin-bottom .item-after label').text(mm2Cm(me.localSectionProps.get_BottomMargin()) + ' ' + txtCm); - $('#document-margin-left .item-after label').text(mm2Cm(me.localSectionProps.get_LeftMargin()) + ' ' + txtCm); - $('#document-margin-right .item-after label').text(mm2Cm(me.localSectionProps.get_RightMargin()) + ' ' + txtCm); - } - - _.each(["top", "left", "bottom", "right"], function(align) { - $(Common.Utils.String.format('#document-margin-{0} .button', align)).single('click', _.bind(me.onPageMarginsChange, me, align)); - }) }, initPageInfo: function () { diff --git a/apps/documenteditor/mobile/app/template/Settings.template b/apps/documenteditor/mobile/app/template/Settings.template index 4c6420d8d..454a852b4 100644 --- a/apps/documenteditor/mobile/app/template/Settings.template +++ b/apps/documenteditor/mobile/app/template/Settings.template @@ -235,70 +235,18 @@ -
<%= scope.textMargins %>
-
+
+
+ + + +
+ +
+
+
+
+
    +
  • +
    +
    +
    <%= scope.textTop %>
    +
    + <% if (!android) { %><% } %> +

    + <% if (android) { %><% } else { %>-<% } %> + <% if (android) { %><% } %> + <% if (android) { %><% } else { %>+<% } %> +

    +
    +
    +
    +
  • +
  • +
    +
    +
    <%= scope.textBottom %>
    +
    + <% if (!android) { %><% } %> +

    + <% if (android) { %><% } else { %>-<% } %> + <% if (android) { %><% } %> + <% if (android) { %><% } else { %>+<% } %> +

    +
    +
    +
    +
  • +
  • +
    +
    +
    <%= scope.textLeft %>
    +
    + <% if (!android) { %><% } %> +

    + <% if (android) { %><% } else { %>-<% } %> + <% if (android) { %><% } %> + <% if (android) { %><% } else { %>+<% } %> +

    +
    +
    +
    +
  • +
  • +
    +
    +
    <%= scope.textRight %>
    +
    + <% if (!android) { %><% } %> +

    + <% if (android) { %><% } else { %>-<% } %> + <% if (android) { %><% } %> + <% if (android) { %><% } else { %>+<% } %> +

    +
    +
    +
    +
  • +
+
+
+
+
\ No newline at end of file