Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Edit List wird ordnerlich aufgebaut

  • Loading branch information...
commit 0ef834b3e86feb4220bc9966337c9af24d3735f6 1 parent cd77f96
Stephan authored
View
11 app/modules/localeEdit/localeEdit.js
@@ -26,8 +26,8 @@ function(app, jquery, Views ) {
Localeedit.ItemModel = Backbone.Model.extend({
defaults: {
- Key: 'Key',
- Value: 'Value',
+ Language: 'XX',
+ Value: 'Foo',
Active: false
},
initialize: function() {
@@ -38,8 +38,8 @@ function(app, jquery, Views ) {
// Default Model.
Localeedit.Model = Backbone.Model.extend({
defaults: {
- Entries: [],
- NameSpace: 'Intranet.Locale'
+ LocaleKey: 'LOCALKEYDEFAULT',
+ LocaleValues: []
},
initialize: function() {
console.log('new Locale Model');
@@ -52,7 +52,8 @@ function(app, jquery, Views ) {
url: '/api/getworkinglocales',
parse : function(resp, xhr) {
- return resp.Locales;
+
+ return resp;
},
initialize: function () {
View
50 app/modules/localeEdit/views.js
@@ -24,6 +24,7 @@ function(app, Backbone) {
manage: true,
tagName: "li",
+ className: 'edititem ',
events: {
click: "activateInput"
@@ -48,16 +49,7 @@ function(app, Backbone) {
data: function() {
return { model: this.model };
}
- // data: function() {
- // var line = this.model !== undefined ? this.model : ':';
- // var split = line.split(':');
-
- // return {
- // Key : split[0] !== undefined ? split[0] : '',
- // Value : split[1] !== undefined ? split[1] : '',
- // Active: false
- // };
- // }
+
});
@@ -65,8 +57,8 @@ function(app, Backbone) {
template: 'app/templates/localeedit/editItem',
manage: true,
- tagName: "li",
- className: 'localeItem',
+ tagName: "div",
+ className: 'edit-wrapper-outer',
data: function() {
return { model: this.model };
@@ -78,38 +70,20 @@ function(app, Backbone) {
activateInput: function(ev) {
var model = this.model;
- // var org = app.router.users.org;
- // var user = app.router.repos.user;
- // // Immediately reflect the active state.
- // app.active = this.model;
- // this.render();
-
- // // Easily create a URL.
- // app.router.go("org", org, "user", user, "repo", model.get("name"));
return false;
},
beforeRender: function() {
- var Entries = this.model.get('Entries');
- for(var i = 0 ; i < Entries.length; i++ ) {
- var current = Entries[i];
- var line = current !== undefined ? current : ':';
- var split = line.split(':');
-
- var objModel = {
- Key : split[0] !== undefined ? split[0] : '',
- Value : split[1] !== undefined ? split[1] : '',
- Active: false
- };
-
- this.insertView("ul", new Views.EditKeyValueItem({
- model: objModel
- }));
+ var items = this.model.get('LocaleValues');
+ for (var i = 0; i < items.length; i++) {
+ this.insertView("ul.locales", new Views.EditKeyValueItem({
+ model: items[i]
+ }));
}
-
+
}
});
@@ -119,8 +93,6 @@ Views.EditList = Backbone.View.extend({
//tagName: 'div',
manage: true,
- className: "locale-wrapper",
-
data: function() {
return {
count: this.collection.length
@@ -135,7 +107,7 @@ Views.EditList = Backbone.View.extend({
// app.active = repo;
// }
- this.insertView("ul", new Views.EditItem({
+ this.insertView("div.localelistitems", new Views.EditItem({
model: locale
}));
}, this);
View
10 app/styles/style.css
@@ -24,4 +24,12 @@ body{
}
#loginform {
-}
+}
+
+
+li.edititem {
+ float: left;
+ clear: left;
+}
+
+
View
2  app/templates/localeedit/edit.html
@@ -10,4 +10,4 @@
<img src ="/app/img/loading.gif"></img>
<% } %>
-<ul class="nav nav-pills locale-list"></ul>
+<div class="localelistitems"></div>
View
14 app/templates/localeedit/editItem.html
@@ -1,4 +1,12 @@
-<div class="edit">
- <label><%= model.get("NameSpace") %></label>
- <ul class="nav nav-pills locales"></ul>
+<div class="edit-wrapper-inner container hero-unit">
+ <div class="edit-wrapper-inner row-fluid">
+ <div class="pull-left span4 key">
+ <span><%= model.get("LocaleKey") %></span>
+ </div>
+ <div class="pull-left span8 values">
+ <ul class="nav nav-pills locales"></ul>
+ </div>
+ <div class="clearfix">
+ </div>
+ </div>
</div>
View
5 app/templates/localeedit/editKeyValueItem.html
@@ -1,3 +1,2 @@
-<div class="well localeitem">
- <label><%= model.Key %></label> <input type="text" <%= !model.Active ? 'disabled' : ''%> value='<%= model.Value %>'></input>
-<div>
+
+ <span class="label"><%= model.Language %></span> <input type="text" <%= !model.Active ? 'disabled' : ''%> value='<%= model.Value %>'></input>
View
13 localeEditFileManager.js
@@ -124,6 +124,7 @@ function toMultiLocaleItem (Locales){
var multiLocaleList = {};
+
for (var language in Locales) {
var lang = Locales[language];
for (var prop in lang) {
@@ -136,7 +137,17 @@ function toMultiLocaleItem (Locales){
}
}
- return multiLocaleList;
+ var multiLocaleArray = [];
+ for (var prop in multiLocaleList) {
+ var v = multiLocaleList[prop];
+
+ multiLocaleArray.push({
+ LocaleKey: prop,
+ LocaleValues: v.Values
+ });
+ }
+
+ return multiLocaleArray;
}
Please sign in to comment.
Something went wrong with that request. Please try again.