[PE mobile] Add slide size settings.

This commit is contained in:
Julia Radzhabova 2016-12-20 15:39:57 +03:00
parent 90ffc633fe
commit e1991660d7
3 changed files with 80 additions and 3 deletions

View file

@ -54,6 +54,10 @@ define([
infoObj,
modalView;
var _slideSizeArr = [
[254, 190.5], [254, 143]
];
return {
models: [],
collections: [],
@ -74,6 +78,8 @@ define([
setApi: function (api) {
this.api = api;
this.api.asc_registerCallback('asc_onPresentationSize', _.bind(this.onApiPageSize, this));
},
onLaunch: function () {
@ -137,17 +143,35 @@ define([
}
},
onPageShow: function(view) {
onPageShow: function(view, pageId) {
var me = this;
$('#settings-search').single('click', _.bind(me._onSearch, me));
$('#settings-readermode input:checkbox').single('change', _.bind(me._onReaderMode, me));
$('#settings-edit-presentation').single('click', _.bind(me._onEditPresentation, me));
$(modalView).find('.formats a').single('click', _.bind(me._onSaveFormat, me));
$('#page-settings-setup-view li').single('click', _.bind(me._onSlideSize, me));
me.initSettings(pageId);
},
initSettings: function (pageId) {
var me = this;
if (pageId == '#settings-setup-view') {
me.onApiPageSize(me.api.get_PresentationWidth(), me.api.get_PresentationHeight());
}
},
// API handlers
onApiPageSize: function(width, height) {
for (var i = 0; i < _slideSizeArr.length; i++) {
if (Math.abs(_slideSizeArr[i][0] - width) < 0.001 && Math.abs(_slideSizeArr[i][1] - height) < 0.001) {
$('#page-settings-setup-view input').val([i]);
break;
}
}
},
_onApiDocumentName: function(name) {
$('#settings-presentation-title').html(name ? name : '-');
},
@ -195,6 +219,14 @@ define([
me.hideModal();
},
_onSlideSize: function(e) {
var $target = $(e.currentTarget).find('input');
if ($target && this.api) {
var value = parseFloat($target.prop('value'));
this.api.changeSlideSize(_slideSizeArr[value][0], _slideSizeArr[value][1]);
}
},
txtLoading : 'Loading...',
notcriticalErrorTitle : 'Warning',
warnDownloadAs : 'If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?'

View file

@ -235,4 +235,40 @@
</div>
</div>
</div>
</div>
<div id="settings-setup-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></a></div>
<div class="center sliding"><%= scope.textSlideSize %></div>
<div class="right"><% if (phone) { %><a href="#" class="link icon-only close-picker"><i class="icon icon-expand-down"></i></a><% } %></div>
</div>
</div>
<div class="page" id="page-settings-setup-view" data-page="settings-setup-view">
<div class="page-content">
<div class="list-block">
<ul>
<li>
<label class="label-radio item-content">
<input type="radio" name="slide-size" 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.mniSlideStandard %></div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="slide-size" 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.mniSlideWide %></div>
</div>
</label>
</li>
</ul>
</div>
</div>
</div>
</div>

View file

@ -74,6 +74,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-presentation-setup').single('click', _.bind(me.showSetup, me));
me.initControls();
},
@ -103,6 +104,7 @@ define([
$layour.find('#settings-readermode').hide();
$layour.find('#settings-search .item-title').text(this.textFindAndReplace)
} else {
$layour.find('#settings-presentation-setup').hide();
$layour.find('#settings-readermode input:checkbox')
.attr('checked', Common.SharedSettings.get('readerMode'))
.prop('checked', Common.SharedSettings.get('readerMode'));
@ -133,7 +135,7 @@ define([
content: $content.html()
});
this.fireEvent('page:show', this);
this.fireEvent('page:show', [this, templateId]);
}
},
@ -165,6 +167,10 @@ define([
this.showPage('#settings-about-view');
},
showSetup: function () {
this.showPage('#settings-setup-view');
},
loadDocument: function (data) {
var permissions = {};
@ -196,7 +202,10 @@ define([
textVersion: 'Version',
textAddress: 'address',
textEmail: 'email',
textTel: 'tel'
textTel: 'tel',
textSlideSize: 'Slide Size',
mniSlideStandard: 'Standard (4:3)',
mniSlideWide: 'Widescreen (16:9)'
}
})(), PE.Views.Settings || {}))
});