[pe mobile] added application settings (units)

This commit is contained in:
Julia Svinareva 2019-04-12 14:32:19 +03:00
parent db404dfac0
commit 652fafcbed
8 changed files with 109 additions and 7 deletions

View file

@ -175,9 +175,28 @@ define([
} else if (pageId == '#settings-about-view') {
// About
me.setLicInfo(_licInfo);
} else if ('#settings-application-view' == pageId) {
me.initPageApplicationSettings();
}
},
initPageApplicationSettings: function () {
var me = this,
$unitMeasurement = $('.page[data-page=settings-application-view] input:radio[name=unit-of-measurement]');
$unitMeasurement.single('change', _.bind(me.unitMeasurementChange, me));
var value = Common.localStorage.getItem('pe-mobile-settings-unit');
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric();
$unitMeasurement.val([value]);
},
unitMeasurementChange: function (e) {
var value = $(e.currentTarget).val();
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric();
Common.Utils.Metric.setCurrentMetric(value);
Common.localStorage.setItem("pe-mobile-settings-unit", value);
this.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter));
},
setLicInfo: function(data){
if (data && typeof data == 'object' && typeof(data.customer)=='object') {
$('.page[data-page=settings-about-view] .logo').hide();

View file

@ -166,7 +166,7 @@ define([
var borderSize = shapeProperties.get_stroke().get_width() * 72.0 / 25.4,
borderType = _shapeObject.get_stroke().get_type();
$('#edit-chart-bordersize input').val([(borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.indexSizeByValue(borderSize)]);
$('#edit-chart-bordersize .item-after').text(((borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize)) + ' ' + _metricText);
$('#edit-chart-bordersize .item-after').text(((borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize)) + ' ' + Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt));
paletteFillColor && paletteFillColor.on('select', _.bind(me.onFillColor, me));
paletteBorderColor && paletteBorderColor.on('select', _.bind(me.onBorderColor, me));
@ -330,7 +330,7 @@ define([
onBorderSizeChanging: function (e) {
var $target = $(e.currentTarget);
$('#edit-chart-bordersize .item-after').text(borderSizeTransform.sizeByIndex($target.val()) + ' ' + _metricText);
$('#edit-chart-bordersize .item-after').text(borderSizeTransform.sizeByIndex($target.val()) + ' ' + Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt));
},
onFillColor: function(palette, color) {

View file

@ -157,7 +157,7 @@ define([
var borderSize = _shapeObject.get_stroke().get_width() * 72.0 / 25.4,
borderType = _shapeObject.get_stroke().get_type();
$('#edit-shape-bordersize input').val([(borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.indexSizeByValue(borderSize)]);
$('#edit-shape-bordersize .item-after').text(((borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize)) + ' ' + _metricText);
$('#edit-shape-bordersize .item-after').text(((borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize)) + ' ' + Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt));
// Init style opacity
$('#edit-shape-effect input').val([_shapeObject.get_fill().asc_getTransparent() ? _shapeObject.get_fill().asc_getTransparent() / 2.55 : 100]);
@ -306,7 +306,7 @@ define([
onBorderSizeChanging: function (e) {
var $target = $(e.currentTarget);
$('#edit-shape-bordersize .item-after').text(borderSizeTransform.sizeByIndex($target.val()) + ' ' + _metricText);
$('#edit-shape-bordersize .item-after').text(borderSizeTransform.sizeByIndex($target.val()) + ' ' + Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt));
},
onOpacity: function (e) {

View file

@ -167,6 +167,7 @@ define([
initSettings: function (pageId) {
var me = this;
_metricText = Common.Utils.Metric.getMetricName(Common.Utils.Metric.getCurrentMetric());
if (_tableObject) {
if (pageId == "#edit-table-style" || pageId == '#edit-table-border-color-view') {
me._initStyleView();
@ -268,7 +269,7 @@ define([
// }
$('#edit-table-bordersize input').val([borderSizeTransform.indexSizeByValue(_cellBorderWidth)]);
$('#edit-table-bordersize .item-after').text(borderSizeTransform.sizeByValue(_cellBorderWidth) + ' ' + _metricText);
$('#edit-table-bordersize .item-after').text(borderSizeTransform.sizeByValue(_cellBorderWidth) + ' ' + Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt));
var borderPalette = me.getView('EditTable').paletteBorderColor;
@ -464,7 +465,7 @@ define([
onBorderSizeChanging: function (e) {
var $target = $(e.currentTarget);
$('#edit-table-bordersize .item-after').text(borderSizeTransform.sizeByIndex($target.val()) + ' ' + _metricText);
$('#edit-table-bordersize .item-after').text(borderSizeTransform.sizeByIndex($target.val()) + ' ' + Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt));
},
onReorder: function (e) {

View file

@ -170,6 +170,8 @@ define([
initSettings: function (pageId) {
var me = this;
metricText = Common.Utils.Metric.getMetricName(Common.Utils.Metric.getCurrentMetric());
me.api && me.api.UpdateInterfaceState(); // TODO: refactor me
if (_paragraphObject) {

View file

@ -77,6 +77,18 @@
</div>
</a>
</li>
<li>
<a id="settings-application" class="item-link">
<div class="item-content">
<div class="item-media">
<i class="icon icon-print"></i>
</div>
<div class="item-inner">
<div class="item-title"><%= scope.textApplicationSettings %></div>
</div>
</div>
</a>
</li>
<li>
<a id="settings-document-info" class="item-link">
<div class="item-content">
@ -342,4 +354,57 @@
</div>
</div>
</div>
</div>
<!-- Presentation application settings -->
<div id="settings-application-view">
<div class="navbar">
<div class="navbar-inner">
<div class="left sliding">
<a href="#" class="back link">
<i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %>
</a>
</div>
<div class="center sliding"><%= scope.textApplicationSettings %></div>
</div>
</div>
<div class="pages">
<div class="page" data-page="settings-application-view">
<div class="page-content">
<div class="content-block-title"><%= scope.textUnitOfMeasurement %></div>
<div class="list-block">
<ul>
<li>
<label class="label-radio item-content">
<input type="radio" name="unit-of-measurement" value="0">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textCentimeter %></div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="unit-of-measurement" value="1">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textPoint %></div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="unit-of-measurement" value="2">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textInch %></div>
</div>
</label>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>

View file

@ -80,6 +80,7 @@ define([
$('#settings-help').single('click', _.bind(me.showHelp, me));
$('#settings-about').single('click', _.bind(me.showAbout, me));
$('#settings-presentation-setup').single('click', _.bind(me.showSetup, me));
$('#settings-application').single('click', _.bind(me.showSetApp, me));
Common.Utils.addScrollIfNeed('.view[data-page=settings-root-view] .pages', '.view[data-page=settings-root-view] .page');
me.initControls();
@ -192,6 +193,10 @@ define([
this.showPage('#settings-setup-view');
},
showSetApp: function () {
this.showPage('#settings-application-view');
},
loadDocument: function (data) {
var permissions = {};
@ -229,7 +234,12 @@ define([
textPoweredBy: 'Powered by',
textFindAndReplace: 'Find and Replace',
textSpellcheck: 'Spell Checking',
textPrint: 'Print'
textPrint: 'Print',
textApplicationSettings: 'Application Settings',
textUnitOfMeasurement: 'Unit of Measurement',
textCentimeter: 'Centimeter',
textPoint: 'Point',
textInch: 'Inch'
}
})(), PE.Views.Settings || {}))
});

View file

@ -465,6 +465,11 @@
"PE.Views.Settings.textSpellcheck": "Spell Checking",
"PE.Views.Settings.textTel": "tel",
"PE.Views.Settings.textVersion": "Version",
"DE.Views.Settings.textApplicationSettings": "Application Settings",
"DE.Views.Settings.textUnitOfMeasurement": "Unit of Measurement",
"DE.Views.Settings.textCentimeter": "Centimeter",
"DE.Views.Settings.textPoint": "Point",
"DE.Views.Settings.textInch": "Inch",
"PE.Views.Settings.unknownText": "Unknown",
"PE.Views.Toolbar.textBack": "Back"
}