mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 04:53:26 +00:00
Jquery edit enhancements
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
},
|
},
|
||||||
remove : function() {
|
remove : function() {
|
||||||
this.datas.value = '';
|
this.datas.value = '';
|
||||||
|
this.datas.VocabularyId = null;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -182,6 +183,13 @@
|
|||||||
this.datas.push(new recordFieldValue(null, value, VocabularyId));
|
this.datas.push(new recordFieldValue(null, value, VocabularyId));
|
||||||
this.options.dirty = true;
|
this.options.dirty = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(window.console)
|
||||||
|
{
|
||||||
|
console.log('already have ',value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -226,6 +234,7 @@
|
|||||||
},
|
},
|
||||||
hasValue : function(value, VocabularyId) {
|
hasValue : function(value, VocabularyId) {
|
||||||
|
|
||||||
|
console.log('has value ', value, VocabularyId);
|
||||||
if(typeof value === 'undefined')
|
if(typeof value === 'undefined')
|
||||||
{
|
{
|
||||||
if(window.console)
|
if(window.console)
|
||||||
@@ -237,19 +246,29 @@
|
|||||||
|
|
||||||
for(d in this.datas)
|
for(d in this.datas)
|
||||||
{
|
{
|
||||||
if(this.datas[d].getVocabularyId() !== null && VocabularyId !== null)
|
if(VocabularyId !== null)
|
||||||
{
|
{
|
||||||
if(this.datas[d].getVocabularyId() === VocabularyId)
|
if(this.datas[d].getVocabularyId() === VocabularyId)
|
||||||
|
{
|
||||||
|
if(window.console)
|
||||||
|
{
|
||||||
|
console.log('already got the vocab ID');
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(this.datas[d].getValue() == value)
|
else if(this.datas[d].getVocabularyId() === null && this.datas[d].getValue() == value)
|
||||||
{
|
{
|
||||||
|
if(window.console)
|
||||||
|
{
|
||||||
|
console.log('already got this value');
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
removeValue : function(value) {
|
removeValue : function(value, vocabularyId) {
|
||||||
|
|
||||||
if(this.databoxField.isReadonly())
|
if(this.databoxField.isReadonly())
|
||||||
{
|
{
|
||||||
@@ -258,10 +277,38 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(typeof VocabularyId === 'undefined')
|
||||||
|
VocabularyId = null;
|
||||||
|
|
||||||
|
if(window.console)
|
||||||
|
{
|
||||||
|
console.log('Try to remove value ', value, vocabularyId, this.datas);
|
||||||
|
}
|
||||||
|
|
||||||
for(d in this.datas)
|
for(d in this.datas)
|
||||||
{
|
{
|
||||||
if(this.datas[d].getValue() == value)
|
if(window.console)
|
||||||
{
|
{
|
||||||
|
console.log('loopin... ', this.datas[d].getValue());
|
||||||
|
}
|
||||||
|
if(this.datas[d].getVocabularyId() !== null)
|
||||||
|
{
|
||||||
|
if(this.datas[d].getVocabularyId() == vocabularyId)
|
||||||
|
{
|
||||||
|
if(window.console)
|
||||||
|
{
|
||||||
|
console.log('Found within the vocab ! removing... ');
|
||||||
|
}
|
||||||
|
this.datas[d].remove();
|
||||||
|
this.options.dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(this.datas[d].getValue() == value)
|
||||||
|
{
|
||||||
|
if(window.console)
|
||||||
|
{
|
||||||
|
console.log('Found ! removing... ');
|
||||||
|
}
|
||||||
this.datas[d].remove();
|
this.datas[d].remove();
|
||||||
this.options.dirty = true;
|
this.options.dirty = true;
|
||||||
}
|
}
|
||||||
@@ -326,6 +373,11 @@
|
|||||||
|
|
||||||
return arrayValues;
|
return arrayValues;
|
||||||
},
|
},
|
||||||
|
sort : function(algo) {
|
||||||
|
this.datas.sort(algo);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
getSerializedValues : function() {
|
getSerializedValues : function() {
|
||||||
|
|
||||||
var arrayValues = [];
|
var arrayValues = [];
|
||||||
|
Reference in New Issue
Block a user