[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) { ], function (core) {
'use strict'; 'use strict';
DE.Controllers.EditContainer = Backbone.Controller.extend((function() { DE.Controllers.EditContainer = Backbone.Controller.extend(_.extend((function() {
// Private // Private
var _settings = []; 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 () { _emptyEditController: function () {
var layout = var layout =
'<div class="content-block inset">' + '<div class="content-block inset">' +
@ -113,62 +99,63 @@ define([
'</div>'; '</div>';
return { return {
caption: 'Settings', caption: this.textSettings,
layout: layout layout: layout
} }
}, },
_layoutEditorsByStack: function () { _layoutEditorsByStack: function () {
var editors = []; var me = this,
editors = [];
if (_settings.length < 0) { if (_settings.length < 0) {
editors.push(this._emptyEditController()); editors.push(me._emptyEditController());
} else { } else {
if (_.contains(_settings, 'text')) { if (_.contains(_settings, 'text')) {
editors.push({ editors.push({
caption: 'Text', caption: me.textText,
id: 'edit-text', id: 'edit-text',
layout: DE.getController('EditText').getView('EditText').rootLayout() layout: DE.getController('EditText').getView('EditText').rootLayout()
}) })
} }
if (_.contains(_settings, 'paragraph')) { if (_.contains(_settings, 'paragraph')) {
editors.push({ editors.push({
caption: 'Paragraph', caption: me.textParagraph,
id: 'edit-paragraph', id: 'edit-paragraph',
layout: DE.getController('EditParagraph').getView('EditParagraph').rootLayout() layout: DE.getController('EditParagraph').getView('EditParagraph').rootLayout()
}) })
} }
if (_.contains(_settings, 'table')) { if (_.contains(_settings, 'table')) {
editors.push({ editors.push({
caption: 'Table', caption: me.textTable,
id: 'edit-table', id: 'edit-table',
layout: DE.getController('EditTable').getView('EditTable').rootLayout() layout: DE.getController('EditTable').getView('EditTable').rootLayout()
}) })
} }
if (_.contains(_settings, 'shape')) { if (_.contains(_settings, 'shape')) {
editors.push({ editors.push({
caption: 'Shape', caption: me.textShape,
id: 'edit-shape', id: 'edit-shape',
layout: DE.getController('EditShape').getView('EditShape').rootLayout() layout: DE.getController('EditShape').getView('EditShape').rootLayout()
}) })
} }
if (_.contains(_settings, 'image')) { if (_.contains(_settings, 'image')) {
editors.push({ editors.push({
caption: 'Image', caption: me.textImage,
id: 'edit-image', id: 'edit-image',
layout: DE.getController('EditImage').getView('EditImage').rootLayout() layout: DE.getController('EditImage').getView('EditImage').rootLayout()
}) })
} }
if (_.contains(_settings, 'chart')) { if (_.contains(_settings, 'chart')) {
editors.push({ editors.push({
caption: 'Chart', caption: me.textChart,
id: 'edit-chart', id: 'edit-chart',
layout: DE.getController('EditChart').getView('EditChart').rootLayout() layout: DE.getController('EditChart').getView('EditChart').rootLayout()
}) })
} }
if (_.contains(_settings, 'hyperlink')) { if (_.contains(_settings, 'hyperlink')) {
editors.push({ editors.push({
caption: 'Hyperlink', caption: me.textHyperlink,
id: 'edit-link', id: 'edit-link',
layout: DE.getController('EditHyperlink').getView('EditHyperlink').rootLayout() layout: DE.getController('EditHyperlink').getView('EditHyperlink').rootLayout()
}) })
@ -363,7 +350,17 @@ define([
} }
_settings = _.uniq(_settings); _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) { ], function (core) {
'use strict'; 'use strict';
DE.Controllers.EditHyperlink = Backbone.Controller.extend((function() { DE.Controllers.EditHyperlink = Backbone.Controller.extend(_.extend((function() {
// Private // Private
var _stack = [], var _stack = [],
_linkObject = undefined; _linkObject = undefined;
@ -169,8 +169,8 @@ define([
} }
}, },
textEmptyImgUrl : 'You need to specify image URL.', textEmptyImgUrl: 'You need to specify image URL.',
txtNotUrl : 'This field should be a URL in the format \"http://www.example.com\"' txtNotUrl: 'This field should be a URL in the format \"http://www.example.com\"'
}; };
})()); })(), DE.Controllers.EditHyperlink || {}))
}); });

View file

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

View file

@ -49,7 +49,7 @@ define([
], function (editTemplate, $, _, Backbone) { ], function (editTemplate, $, _, Backbone) {
'use strict'; 'use strict';
DE.Views.EditHyperlink = Backbone.View.extend((function() { DE.Views.EditHyperlink = Backbone.View.extend(_.extend((function() {
// private // private
return { return {
@ -79,7 +79,8 @@ define([
render: function () { render: function () {
this.layout = $('<div/>').append(this.template({ this.layout = $('<div/>').append(this.template({
android : Common.SharedSettings.get('android'), android : Common.SharedSettings.get('android'),
phone : Common.SharedSettings.get('phone') phone : Common.SharedSettings.get('phone'),
scope : this
})); }));
return this; return this;
@ -93,7 +94,13 @@ define([
} }
return ''; 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.textFill": "Fill",
"DE.Views.EditChart.textBorder": "Border", "DE.Views.EditChart.textBorder": "Border",
"DE.Views.EditChart.textSize": "Size", "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"
} }