[DE mobile] Localization EditContainer, EditHyperlink.

This commit is contained in:
Alexander Yuzhin 2016-11-18 14:56:48 +03:00
parent d384306778
commit 6584fa1f24
5 changed files with 67 additions and 46 deletions

View file

@ -44,7 +44,7 @@ define([
], function (core) {
'use strict';
DE.Controllers.EditContainer = Backbone.Controller.extend((function() {
DE.Controllers.EditContainer = Backbone.Controller.extend(_.extend((function() {
// Private
var _settings = [];
@ -90,20 +90,6 @@ define([
}
},
_dummyEditController: function () {
var layout =
'<div class="content-block inset">' +
'<div class="content-block-inner"> ' +
'<p>Implement settings!!!!</p>' +
'</div>' +
'</div>';
return {
caption: 'Dummy',
layout: layout
}
},
_emptyEditController: function () {
var layout =
'<div class="content-block inset">' +
@ -113,62 +99,63 @@ define([
'</div>';
return {
caption: 'Settings',
caption: this.textSettings,
layout: layout
}
},
_layoutEditorsByStack: function () {
var editors = [];
var me = this,
editors = [];
if (_settings.length < 0) {
editors.push(this._emptyEditController());
editors.push(me._emptyEditController());
} else {
if (_.contains(_settings, 'text')) {
editors.push({
caption: 'Text',
caption: me.textText,
id: 'edit-text',
layout: DE.getController('EditText').getView('EditText').rootLayout()
})
}
if (_.contains(_settings, 'paragraph')) {
editors.push({
caption: 'Paragraph',
caption: me.textParagraph,
id: 'edit-paragraph',
layout: DE.getController('EditParagraph').getView('EditParagraph').rootLayout()
})
}
if (_.contains(_settings, 'table')) {
editors.push({
caption: 'Table',
caption: me.textTable,
id: 'edit-table',
layout: DE.getController('EditTable').getView('EditTable').rootLayout()
})
}
if (_.contains(_settings, 'shape')) {
editors.push({
caption: 'Shape',
caption: me.textShape,
id: 'edit-shape',
layout: DE.getController('EditShape').getView('EditShape').rootLayout()
})
}
if (_.contains(_settings, 'image')) {
editors.push({
caption: 'Image',
caption: me.textImage,
id: 'edit-image',
layout: DE.getController('EditImage').getView('EditImage').rootLayout()
})
}
if (_.contains(_settings, 'chart')) {
editors.push({
caption: 'Chart',
caption: me.textChart,
id: 'edit-chart',
layout: DE.getController('EditChart').getView('EditChart').rootLayout()
})
}
if (_.contains(_settings, 'hyperlink')) {
editors.push({
caption: 'Hyperlink',
caption: me.textHyperlink,
id: 'edit-link',
layout: DE.getController('EditHyperlink').getView('EditHyperlink').rootLayout()
})
@ -363,7 +350,17 @@ define([
}
_settings = _.uniq(_settings);
}
},
textSettings: 'Settings',
textText: 'Text',
textParagraph: 'Paragraph',
textTable: 'Table',
textShape: 'Shape',
textImage: 'Image',
textChart: 'Chart',
textHyperlink: 'Hyperlink'
}
})());
})(), DE.Controllers.EditContainer || {}))
});

View file

@ -47,7 +47,7 @@ define([
], function (core) {
'use strict';
DE.Controllers.EditHyperlink = Backbone.Controller.extend((function() {
DE.Controllers.EditHyperlink = Backbone.Controller.extend(_.extend((function() {
// Private
var _stack = [],
_linkObject = undefined;
@ -169,8 +169,8 @@ define([
}
},
textEmptyImgUrl : 'You need to specify image URL.',
txtNotUrl : 'This field should be a URL in the format \"http://www.example.com\"'
textEmptyImgUrl: 'You need to specify image URL.',
txtNotUrl: 'This field should be a URL in the format \"http://www.example.com\"'
};
})());
})(), DE.Controllers.EditHyperlink || {}))
});

View file

@ -5,9 +5,9 @@
<li>
<div id="edit-link-url" class="item-content">
<div class="item-inner">
<div class="item-title label">Link</div>
<div class="item-title label"><%= scope.textLink %></div>
<div class="item-input">
<input type="url" placeholder="Link">
<input type="url" placeholder="<%= scope.textLink %>">
</div>
</div>
</div>
@ -15,9 +15,9 @@
<li>
<div id="edit-link-display" class="item-content">
<div class="item-inner">
<div class="item-title label">Display</div>
<div class="item-title label"><%= scope.textDisplay %></div>
<div class="item-input">
<input type="text" placeholder="Display">
<input type="text" placeholder="<%= scope.textDisplay %>">
</div>
</div>
</div>
@ -25,9 +25,9 @@
<li>
<div id="edit-link-tip" class="item-content">
<div class="item-inner">
<div class="item-title label">Screen Tip</div>
<div class="item-title label"><%= scope.textTip %></div>
<div class="item-input">
<input type="text" placeholder="Screen Tip">
<input type="text" placeholder="<%= scope.textTip %>">
</div>
</div>
</div>
@ -36,15 +36,15 @@
</div>
<div class="list-block">
<% if (android) { %>
<a href="#" id="edit-link-edit" class="button button-raised button-fill disabled" style="margin: 20px 16px;">Edit Link</a>
<a href="#" id="edit-link-remove" class="button button-raised button-fill" style="margin: 20px 16px; background-color: #f44336;">Remove Link</a>
<a href="#" id="edit-link-edit" class="button button-raised button-fill disabled" style="margin: 20px 16px;"><%= scope.textEdit %></a>
<a href="#" id="edit-link-remove" class="button button-raised button-fill" style="margin: 20px 16px; background-color: #f44336;"><%= scope.textRemove %></a>
<% } else { %>
<ul>
<li>
<a href="#" id="edit-link-edit" class="list-button item-link disabled" style="text-align: center;">Edit Link</a>
<a href="#" id="edit-link-edit" class="list-button item-link disabled" style="text-align: center;"><%= scope.textEdit %></a>
</li>
<li>
<a href="#" id="edit-link-remove" class="list-button item-link" style="text-align: center; color: #f00">Remove Link</a>
<a href="#" id="edit-link-remove" class="list-button item-link" style="text-align: center; color: #f00"><%= scope.textRemove %></a>
</li>
</ul>
<% } %>

View file

@ -49,7 +49,7 @@ define([
], function (editTemplate, $, _, Backbone) {
'use strict';
DE.Views.EditHyperlink = Backbone.View.extend((function() {
DE.Views.EditHyperlink = Backbone.View.extend(_.extend((function() {
// private
return {
@ -79,7 +79,8 @@ define([
render: function () {
this.layout = $('<div/>').append(this.template({
android : Common.SharedSettings.get('android'),
phone : Common.SharedSettings.get('phone')
phone : Common.SharedSettings.get('phone'),
scope : this
}));
return this;
@ -93,7 +94,13 @@ define([
}
return '';
}
},
textLink: 'Link',
textDisplay: 'Display',
textTip: 'Screen Tip',
textEdit: 'Edit Link',
textRemove: 'Remove Link'
}
})());
})(), DE.Views.EditHyperlink || {}))
});

View file

@ -205,5 +205,22 @@
"DE.Views.EditChart.textFill": "Fill",
"DE.Views.EditChart.textBorder": "Border",
"DE.Views.EditChart.textSize": "Size",
"DE.Views.EditChart.textColor": "Color"
"DE.Views.EditChart.textColor": "Color",
"DE.Controllers.EditContainer.textSettings": "Settings",
"DE.Controllers.EditContainer.textText": "Text",
"DE.Controllers.EditContainer.textParagraph": "Paragraph",
"DE.Controllers.EditContainer.textTable": "Table",
"DE.Controllers.EditContainer.textShape": "Shape",
"DE.Controllers.EditContainer.textImage": "Image",
"DE.Controllers.EditContainer.textChart": "Chart",
"DE.Controllers.EditContainer.textHyperlink": "Hyperlink",
"DE.Views.EditHyperlink.textLink": "Link",
"DE.Views.EditHyperlink.textDisplay": "Display",
"DE.Views.EditHyperlink.textTip": "Screen Tip",
"DE.Views.EditHyperlink.textEdit": "Edit Link",
"DE.Views.EditHyperlink.textRemove": "Remove Link"
}