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(){
|
||||
this.items.each(function(field){
|
||||
if (field.property){
|
||||
if (!Ext.isEmpty(field.property)){
|
||||
this.properties.push({
|
||||
'name': field.name,
|
||||
'property': field.property
|
||||
@@ -75,15 +75,31 @@ Sonia.repository.PropertiesFormPanel = Ext.extend(Sonia.repository.FormPanel, {
|
||||
// create properties if they are empty
|
||||
if (!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
|
||||
for ( var i in this.properties ){
|
||||
var property = this.properties[i];
|
||||
for ( var k in this.properties ){
|
||||
var property = this.properties[k];
|
||||
if (!Ext.isEmpty(property.name)){
|
||||
item.properties.push({
|
||||
key: property.property,
|
||||
value: item[property.name]
|
||||
});
|
||||
}
|
||||
delete item[property.name];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ Sonia.util.clone = function(obj) {
|
||||
if (obj[i] && typeof obj[i] == "object") {
|
||||
newObj[i] = Sonia.util.clone(obj[i]);
|
||||
} else newObj[i] = obj[i]
|
||||
} return newObj;
|
||||
}
|
||||
return newObj;
|
||||
};
|
||||
|
||||
Sonia.util.parseInt = function(string, defaultValue){
|
||||
@@ -71,3 +72,22 @@ Sonia.util.getStringFromArray = function(array){
|
||||
|
||||
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