mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 09:25:43 +01:00
fix wrong repository properties
This commit is contained in:
@@ -54,7 +54,7 @@ Sonia.repository.PropertiesFormPanel = Ext.extend(Sonia.repository.FormPanel, {
|
|||||||
|
|
||||||
loadProperties: function(){
|
loadProperties: function(){
|
||||||
this.items.each(function(field){
|
this.items.each(function(field){
|
||||||
if (field.property){
|
if (!Ext.isEmpty(field.property)){
|
||||||
this.properties.push({
|
this.properties.push({
|
||||||
'name': field.name,
|
'name': field.name,
|
||||||
'property': field.property
|
'property': field.property
|
||||||
@@ -75,15 +75,31 @@ Sonia.repository.PropertiesFormPanel = Ext.extend(Sonia.repository.FormPanel, {
|
|||||||
// create properties if they are empty
|
// create properties if they are empty
|
||||||
if (!item.properties){
|
if (!item.properties){
|
||||||
item.properties = [];
|
item.properties = [];
|
||||||
|
} else {
|
||||||
|
var filtered = item.properties.filter(function(p){
|
||||||
|
var result = !Ext.isEmpty(p.key);
|
||||||
|
if ( result ){
|
||||||
|
for (var i in this.properties){
|
||||||
|
if ( p.key == this.properties[i].property ){
|
||||||
|
result = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}, this);
|
||||||
|
item.properties = filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy fields to properties
|
// copy fields to properties
|
||||||
for ( var i in this.properties ){
|
for ( var k in this.properties ){
|
||||||
var property = this.properties[i];
|
var property = this.properties[k];
|
||||||
item.properties.push({
|
if (!Ext.isEmpty(property.name)){
|
||||||
key: property.property,
|
item.properties.push({
|
||||||
value: item[property.name]
|
key: property.property,
|
||||||
});
|
value: item[property.name]
|
||||||
|
});
|
||||||
|
}
|
||||||
delete item[property.name];
|
delete item[property.name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ Sonia.util.clone = function(obj) {
|
|||||||
if (obj[i] && typeof obj[i] == "object") {
|
if (obj[i] && typeof obj[i] == "object") {
|
||||||
newObj[i] = Sonia.util.clone(obj[i]);
|
newObj[i] = Sonia.util.clone(obj[i]);
|
||||||
} else newObj[i] = obj[i]
|
} else newObj[i] = obj[i]
|
||||||
} return newObj;
|
}
|
||||||
|
return newObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
Sonia.util.parseInt = function(string, defaultValue){
|
Sonia.util.parseInt = function(string, defaultValue){
|
||||||
@@ -70,4 +71,23 @@ Sonia.util.getStringFromArray = function(array){
|
|||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Array.prototype.filter) {
|
||||||
|
|
||||||
|
Array.prototype.filter = function(fn, scope){
|
||||||
|
var results = [],
|
||||||
|
i = 0,
|
||||||
|
ln = array.length;
|
||||||
|
|
||||||
|
for (; i < ln; i++) {
|
||||||
|
if (fn.call(scope, array[i], i, array)) {
|
||||||
|
results.push(array[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user