Commit e6959997 authored by Alexander Yuzhin's avatar Alexander Yuzhin

[DE mobile] Add document settings.

parent c9792dde
...@@ -54,7 +54,19 @@ ...@@ -54,7 +54,19 @@
</div> </div>
</li> </li>
<li> <li>
<a id="settings-download" class="item-link"> <a id="settings-document" class="item-link" data-page="#settings-document-view">
<div class="item-content">
<div class="item-media">
<i class="icon icon-doc-setup"></i>
</div>
<div class="item-inner">
<div class="item-title"><%= scope.textDocumentSettings %></div>
</div>
</div>
</a>
</li>
<li>
<a id="settings-download" class="item-link" data-page="#settings-download-view">
<div class="item-content"> <div class="item-content">
<div class="item-media"> <div class="item-media">
<i class="icon icon-download"></i> <i class="icon icon-download"></i>
...@@ -66,7 +78,7 @@ ...@@ -66,7 +78,7 @@
</a> </a>
</li> </li>
<li> <li>
<a id="settings-document-info" class="item-link"> <a id="settings-document-info" class="item-link" data-page="#settings-info-view">
<div class="item-content"> <div class="item-content">
<div class="item-media"> <div class="item-media">
<i class="icon icon-info"></i> <i class="icon icon-info"></i>
...@@ -78,7 +90,7 @@ ...@@ -78,7 +90,7 @@
</a> </a>
</li> </li>
<!--<li>--> <!--<li>-->
<!--<a id="settings-history" class="item-link">--> <!--<a id="settings-history" class="item-link" data-page="#settings-history-view">-->
<!--<div class="item-content">--> <!--<div class="item-content">-->
<!--<div class="item-media">--> <!--<div class="item-media">-->
<!--<i class="icon icon-versions"></i>--> <!--<i class="icon icon-versions"></i>-->
...@@ -102,7 +114,7 @@ ...@@ -102,7 +114,7 @@
</a> </a>
</li> </li>
<li> <li>
<a id="settings-about" class="item-link"> <a id="settings-about" class="item-link" data-page="#settings-about-view">
<div class="item-content"> <div class="item-content">
<div class="item-media"> <div class="item-media">
<i class="icon icon-about"></i> <i class="icon icon-about"></i>
...@@ -120,6 +132,79 @@ ...@@ -120,6 +132,79 @@
</div> </div>
</div> </div>
<!-- Document Settings view -->
<div id="settings-document-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.textDocumentSettings %></div>
</div>
</div>
<div class="pages">
<div class="page" data-page="settings-document-view">
<div class="page-content">
<div class="content-block-title">Orientation</div>
<div class="list-block">
<ul>
<li>
<label class="label-radio item-content">
<input type="radio" name="doc-orientation" value="true">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textPortrait %></div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="doc-orientation" value="false">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textLandscape %></div>
</div>
</label>
</li>
</ul>
</div>
<div class="content-block-title"><%= scope.textFormat %></div>
<div class="list-block media-list">
<ul>
<li>
<a id="settings-document-format" class="item-link item-content" data-page="#settings-document-formats-view">
<div class="item-inner">
<div class="item-title-row">
<div class="item-title"><%= scope.textCustom %></div>
</div>
<div class="item-subtitle"><%= scope.textCustomSize %></div>
</div>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- Document Formats view -->
<div id="settings-document-formats-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.textDocumentFormats %></div>
</div>
</div>
<div class="pages">
<div class="page" data-page="settings-document-formats-view">
<div class="page-content">
<div class="list-block media-list">
<ul></ul>
</div>
</div>
</div>
</div>
</div>
<!-- Document Info view --> <!-- Document Info view -->
<div id="settings-info-view"> <div id="settings-info-view">
<div class="navbar"> <div class="navbar">
......
...@@ -50,7 +50,7 @@ define([ ...@@ -50,7 +50,7 @@ define([
DE.Views.Settings = Backbone.View.extend(_.extend((function() { DE.Views.Settings = Backbone.View.extend(_.extend((function() {
// private // private
var isEdit; var _isEdit = false;
return { return {
// el: '.view-main', // el: '.view-main',
...@@ -63,19 +63,14 @@ define([ ...@@ -63,19 +63,14 @@ define([
initialize: function() { initialize: function() {
Common.NotificationCenter.on('settingscontainer:show', _.bind(this.initEvents, this)); Common.NotificationCenter.on('settingscontainer:show', _.bind(this.initEvents, this));
Common.Gateway.on('opendocument', _.bind(this.loadDocument, this)); Common.Gateway.on('opendocument', _.bind(this.loadDocument, this));
this.on('page:show', _.bind(this.updateItemHandlers, this));
}, },
initEvents: function () { initEvents: function () {
var me = this; var me = this;
$('#settings-document-info').single('click', _.bind(me.showDocumentInfo, me)); me.updateItemHandlers();
$('#settings-download').single('click', _.bind(me.showDownload, me));
$('#settings-history').single('click', _.bind(me.showHistory, me));
$('#settings-help').single('click', _.bind(me.showHelp, me));
$('#settings-about').single('click', _.bind(me.showAbout, me));
me.initControls(); me.initControls();
}, },
...@@ -91,7 +86,7 @@ define([ ...@@ -91,7 +86,7 @@ define([
}, },
setMode: function (mode) { setMode: function (mode) {
isEdit = (mode === 'edit') _isEdit = (mode === 'edit')
}, },
rootLayout: function () { rootLayout: function () {
...@@ -99,11 +94,12 @@ define([ ...@@ -99,11 +94,12 @@ define([
var $layour = this.layout.find('#settings-root-view'), var $layour = this.layout.find('#settings-root-view'),
isPhone = Common.SharedSettings.get('phone'); isPhone = Common.SharedSettings.get('phone');
if (isEdit) { if (_isEdit) {
$layour.find('#settings-edit-document').hide(); $layour.find('#settings-edit-document').hide();
$layour.find('#settings-readermode').hide(); $layour.find('#settings-readermode').hide();
$layour.find('#settings-search .item-title').text(this.textFindAndReplace) $layour.find('#settings-search .item-title').text(this.textFindAndReplace)
} else { } else {
$layour.find('#settings-document').hide();
$layour.find('#settings-readermode input:checkbox') $layour.find('#settings-readermode input:checkbox')
.prop('checked', Common.SharedSettings.get('readerMode')); .prop('checked', Common.SharedSettings.get('readerMode'));
} }
...@@ -118,7 +114,18 @@ define([ ...@@ -118,7 +114,18 @@ define([
// //
}, },
showPage: function(templateId) { updateItemHandlers: function () {
var selectorsDynamicPage = [
'.page[data-page=settings-root-view]',
'.page[data-page=settings-document-view]'
].map(function (selector) {
return selector + ' a.item-link[data-page]';
}).join(', ');
$(selectorsDynamicPage).single('click', _.bind(this.onItemClick, this));
},
showPage: function(templateId, suspendEvent) {
var rootView = DE.getController('Settings').rootView(); var rootView = DE.getController('Settings').rootView();
if (rootView && this.layout) { if (rootView && this.layout) {
...@@ -133,41 +140,50 @@ define([ ...@@ -133,41 +140,50 @@ define([
content: $content.html() content: $content.html()
}); });
this.fireEvent('page:show', this); if (suspendEvent !== true) {
this.fireEvent('page:show', [this, templateId]);
} }
},
showDocumentInfo: function() {
this.showPage('#settings-info-view');
var api = DE.getController('Settings').api;
if (api) {
api.startGetDocInfo();
var document = Common.SharedSettings.get('document') || {},
info = document.info || {};
$('#settings-document-title').html(document.title ? document.title : this.unknownText);
$('#settings-document-autor').html(info.author ? info.author : this.unknownText);
$('#settings-document-date').html(info.created ? info.created : this.unknownText);
} }
}, },
showDownload: function () { onItemClick: function (e) {
this.showPage('#settings-download-view'); var $target = $(e.currentTarget),
}, page = $target.data('page');
showHistory: function () { if (page && page.length > 0 ) {
this.showPage('#settings-history-view'); this.showPage(page);
}
}, },
showHelp: function () { renderPageSizes: function(sizes, selectIndex) {
window.open('http://support.onlyoffice.com/', "_blank"); var $pageFormats = $('.page[data-page=settings-document-formats-view]'),
DE.getController('Settings').hideModal(); $list = $pageFormats.find('ul'),
}, items = [];
_.each(sizes, function (size, index) {
items.push(_.template([
'<li>',
'<label class="label-radio item-content">',
'<input type="radio" name="document-format" value="<%= item.value %>" <% if (index == selectIndex) { %>checked="checked"<% } %> >',
'<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>',
'<div class="item-inner">',
'<div class="item-title-row">',
'<div class="item-title"><%= item.caption %></div>',
'</div>',
// '<div class="item-subtitle"><%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.value[0]).toFixed(2)) %><%= Common.Utils.Metric.getCurrentMetricName() %> x <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></div>',
'<div class="item-subtitle"><%= item.subtitle %></div>',
'</div>',
'</label>',
'</li>'
].join(''), {
android: Framework7.prototype.device.android,
item: size,
index: index,
selectIndex: selectIndex
}));
});
showAbout: function () { $list.html(items.join(''));
this.showPage('#settings-about-view');
}, },
loadDocument: function(data) { loadDocument: function(data) {
...@@ -182,7 +198,6 @@ define([ ...@@ -182,7 +198,6 @@ define([
} }
}, },
unknownText: 'Unknown',
textFindAndReplace: 'Find and Replace', textFindAndReplace: 'Find and Replace',
textSettings: 'Settings', textSettings: 'Settings',
textDone: 'Done', textDone: 'Done',
...@@ -208,7 +223,14 @@ define([ ...@@ -208,7 +223,14 @@ define([
textVersion: 'Version', textVersion: 'Version',
textAddress: 'address', textAddress: 'address',
textEmail: 'email', textEmail: 'email',
textTel: 'tel' textTel: 'tel',
textDocumentSettings: 'Document Settings',
textPortrait: 'Portrait',
textLandscape: 'Landscape',
textFormat: 'Format',
textCustom: 'Custom',
textCustomSize: 'Custom Size',
textDocumentFormats: 'Document Formats'
} }
})(), DE.Views.Settings || {})) })(), DE.Views.Settings || {}))
......
...@@ -105,10 +105,10 @@ ...@@ -105,10 +105,10 @@
"DE.Views.Search.textCase": "Case sensitive", "DE.Views.Search.textCase": "Case sensitive",
"DE.Views.Search.textHighlight": "Highlight results", "DE.Views.Search.textHighlight": "Highlight results",
"DE.Controllers.Settings.unknownText": "Unknown",
"DE.Controllers.Settings.txtLoading": "Loading...", "DE.Controllers.Settings.txtLoading": "Loading...",
"DE.Controllers.Settings.notcriticalErrorTitle": "Warning", "DE.Controllers.Settings.notcriticalErrorTitle": "Warning",
"DE.Controllers.Settings.warnDownloadAs": "If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?", "DE.Controllers.Settings.warnDownloadAs": "If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?",
"DE.Views.Settings.unknownText": "Unknown",
"DE.Views.Settings.textFindAndReplace": "Find and Replace", "DE.Views.Settings.textFindAndReplace": "Find and Replace",
"DE.Views.Settings.textSettings": "Settings", "DE.Views.Settings.textSettings": "Settings",
"DE.Views.Settings.textDone": "Done", "DE.Views.Settings.textDone": "Done",
...@@ -135,6 +135,13 @@ ...@@ -135,6 +135,13 @@
"DE.Views.Settings.textAddress": "address", "DE.Views.Settings.textAddress": "address",
"DE.Views.Settings.textEmail": "email", "DE.Views.Settings.textEmail": "email",
"DE.Views.Settings.textTel": "tel", "DE.Views.Settings.textTel": "tel",
"DE.Views.Settings.textDocumentSettings": "Document Settings",
"DE.Views.Settings.textPortrait": "Portrait",
"DE.Views.Settings.textLandscape": "Landscape",
"DE.Views.Settings.textFormat": "Format",
"DE.Views.Settings.textCustom": "Custom",
"DE.Views.Settings.textCustomSize": "Custom Size",
"DE.Views.Settings.textDocumentFormats": "Document Formats",
"DE.Controllers.Toolbar.dlgLeaveTitleText": "You leave the application", "DE.Controllers.Toolbar.dlgLeaveTitleText": "You leave the application",
"DE.Controllers.Toolbar.dlgLeaveMsgText": "You have unsaved changes in this document. Click 'Stay on this Page' to await the autosave of the document. Click 'Leave this Page' to discard all the unsaved changes.", "DE.Controllers.Toolbar.dlgLeaveMsgText": "You have unsaved changes in this document. Click 'Stay on this Page' to await the autosave of the document. Click 'Leave this Page' to discard all the unsaved changes.",
......
...@@ -35,6 +35,11 @@ i.icon { ...@@ -35,6 +35,11 @@ i.icon {
height: 28px; height: 28px;
.encoded-svg-background('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-1 3 22 28" fill="@{themeColor}"><g><polygon points="10,5.6 10,21.2 11,21.2 11,5.6 14.6,9.3 15.3,8.5 10.5,3.6 5.7,8.5 6.4,9.3 "/><polygon points="13,12 13,13 19,13 19,30 2,30 2,13 8,13 8,12 1,12 1,13 1,30 1,31 20,31 20,30 20,13 20,12 "/></g></svg>'); .encoded-svg-background('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-1 3 22 28" fill="@{themeColor}"><g><polygon points="10,5.6 10,21.2 11,21.2 11,5.6 14.6,9.3 15.3,8.5 10.5,3.6 5.7,8.5 6.4,9.3 "/><polygon points="13,12 13,13 19,13 19,30 2,30 2,13 8,13 8,12 1,12 1,13 1,30 1,31 20,31 20,30 20,13 20,12 "/></g></svg>');
} }
&.icon-doc-setup {
width: 22px;
height: 22px;
.encoded-svg-background('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-4 6 22 22" fill="@{themeColor}"><g><path id="XMLID_2_" d="M15,27H-1V15h6V8l0,0h10V27z M16,7H4.2L-2,13.6V28h18V7z M4,8.8V14h-4.9L4,8.8z"/></g></svg>');
}
&.icon-info { &.icon-info {
width: 22px; width: 22px;
height: 22px; height: 22px;
......
...@@ -30,6 +30,11 @@ i.icon { ...@@ -30,6 +30,11 @@ i.icon {
height: 28px; height: 28px;
.encoded-svg-background('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-1 3 22 28" fill="@{themeColor}"><g><polygon id="XMLID_3_" points="10,5.6 10,21.2 11,21.2 11,5.6 14.6,9.3 15.3,8.5 10.5,3.6 5.7,8.5 6.4,9.3 "/><polygon id="XMLID_6_" points="13,12 13,13 19,13 19,30 2,30 2,13 8,13 8,12 1,12 1,13 1,30 1,31 20,31 20,30 20,13 20,12 "/></g></svg>'); .encoded-svg-background('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-1 3 22 28" fill="@{themeColor}"><g><polygon id="XMLID_3_" points="10,5.6 10,21.2 11,21.2 11,5.6 14.6,9.3 15.3,8.5 10.5,3.6 5.7,8.5 6.4,9.3 "/><polygon id="XMLID_6_" points="13,12 13,13 19,13 19,30 2,30 2,13 8,13 8,12 1,12 1,13 1,30 1,31 20,31 20,30 20,13 20,12 "/></g></svg>');
} }
&.icon-doc-setup {
width: 22px;
height: 22px;
.encoded-svg-background('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-4 6 22 22" fill="@{themeColor}"><g><path id="XMLID_2_" d="M15,27H-1V15h6V8l0,0h10V27z M16,7H4.2L-2,13.6V28h18V7z M4,8.8V14h-4.9L4,8.8z"/></g></svg>');
}
&.icon-info { &.icon-info {
width: 22px; width: 22px;
height: 22px; height: 22px;
......
...@@ -145,7 +145,7 @@ define([ ...@@ -145,7 +145,7 @@ define([
}, },
onApiShowPopMenu: function(posX, posY) { onApiShowPopMenu: function(posX, posY) {
if (_isPopMenuHidden || $('.popover.settings, .popup.settings, .picker-modal.settings').length > 0) if (_isPopMenuHidden || $('.popover.settings, .popup.settings, .picker-modal.settings, .modal-in').length > 0)
return; return;
var me = this, var me = this,
......
...@@ -151,7 +151,7 @@ define([ ...@@ -151,7 +151,7 @@ define([
onApiShowPopMenu: function(posX, posY) { onApiShowPopMenu: function(posX, posY) {
// if ( !this.permitions.isEdit ) return; // if ( !this.permitions.isEdit ) return;
if ($('.popover.settings, .popup.settings, .picker-modal.settings').length > 0) { if ($('.popover.settings, .popup.settings, .picker-modal.settings, .modal-in').length > 0) {
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment