[se mobile] added application settings (units)

This commit is contained in:
Julia Svinareva 2019-04-12 14:33:14 +03:00
parent 652fafcbed
commit 6e78971810
6 changed files with 103 additions and 5 deletions

View file

@ -158,6 +158,8 @@ define([
if (pageId == '#settings-about-view') {
// About
me.setLicInfo(_licInfo);
} else if ('#settings-application-view' == pageId) {
me.initPageApplicationSettings();
}
},
@ -198,6 +200,22 @@ define([
}
},
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('se-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("se-mobile-settings-unit", value);
},
// API handlers
_onSearch: function (e) {

View file

@ -225,7 +225,7 @@ define([
var borderSize = shapeProperties.get_stroke().get_width() * 72.0 / 25.4,
borderType = shapeProperties.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));
$('#edit-chart-bordersize input').single('change touchend', _.buffered(me.onBorderSize, 100, me));
$('#edit-chart-bordersize input').single('input', _.bind(me.onBorderSizeChanging, me));
@ -660,7 +660,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));
},
onBorderColor: function (palette, color) {

View file

@ -182,7 +182,7 @@ define([
var borderSize = me._mm2pt(shapeProperties.get_stroke().get_width()),
borderType = shapeProperties.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));
$('#edit-shape-bordersize input').single('change touchend', _.buffered(me.onBorderSize, 100, me));
$('#edit-shape-bordersize input').single('input', _.bind(me.onBorderSizeChanging, me));
@ -301,7 +301,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

@ -49,6 +49,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">
@ -330,3 +342,56 @@
</div>
</div>
</div>
<!-- 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

@ -79,6 +79,7 @@ define([
$('#settings-history').single('click', _.bind(me.showHistory, me));
$('#settings-help').single('click', _.bind(me.showHelp, me));
$('#settings-about').single('click', _.bind(me.showAbout, 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();
@ -162,6 +163,10 @@ define([
}
},
showSetApp: function() {
this.showPage('#settings-application-view');
},
showDocumentInfo: function() {
this.showPage('#settings-info-view');
@ -225,7 +230,12 @@ define([
textEmail: 'email',
textTel: 'tel',
textPoweredBy: 'Powered by',
textPrint: 'Print'
textPrint: 'Print',
textApplicationSettings: 'Application Settings',
textUnitOfMeasurement: 'Unit of Measurement',
textCentimeter: 'Centimeter',
textPoint: 'Point',
textInch: 'Inch'
}
})(), SSE.Views.Settings || {}))
});

View file

@ -512,6 +512,11 @@
"SSE.Views.Settings.textSettings": "Settings",
"SSE.Views.Settings.textTel": "tel",
"SSE.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",
"SSE.Views.Settings.unknownText": "Unknown",
"SSE.Views.Toolbar.textBack": "Back"
}