mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 14:33:14 +00:00
Fix field edition for vocabulary
This commit is contained in:
@@ -235,6 +235,8 @@ class databox_field implements cache_cacheableInterface
|
|||||||
|
|
||||||
$this->thumbtitle = $row['thumbtitle'];
|
$this->thumbtitle = $row['thumbtitle'];
|
||||||
|
|
||||||
|
$this->loadVocabulary();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -89,11 +89,22 @@ define([
|
|||||||
"blur input#tbranch": "fieldChangedAction",
|
"blur input#tbranch": "fieldChangedAction",
|
||||||
"blur input#separator": "fieldChangedAction",
|
"blur input#separator": "fieldChangedAction",
|
||||||
"blur input#tag": "tagFieldChangedAction",
|
"blur input#tag": "tagFieldChangedAction",
|
||||||
|
"change select#vocabulary-type": "triggerControlledVocabulary",
|
||||||
"keyup input.input-label": "labelChangedAction",
|
"keyup input.input-label": "labelChangedAction",
|
||||||
"change input[type=checkbox]": "fieldChangedAction",
|
"change input[type=checkbox]": "fieldChangedAction",
|
||||||
"change select": "selectionChangedAction",
|
"change select": "selectionChangedAction",
|
||||||
"click .lng-label a": "_toggleLabels"
|
"click .lng-label a": "_toggleLabels"
|
||||||
},
|
},
|
||||||
|
triggerControlledVocabulary: function(e) {
|
||||||
|
if ($(e.target, this.$el).find("option:selected").val() === "") {
|
||||||
|
this.model.set("vocabulary-type", false);
|
||||||
|
this.render();
|
||||||
|
} else if ($("input#vocabulary-restricted", this.$el).length === 0) {
|
||||||
|
this.model.set("vocabulary-restricted", false);
|
||||||
|
this.model.set("vocabulary-type", $(e.target, this.$el).find("option:selected").val());
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
},
|
||||||
selectionChangedAction: function(e) {
|
selectionChangedAction: function(e) {
|
||||||
var field = $(e.target);
|
var field = $(e.target);
|
||||||
var data = {};
|
var data = {};
|
||||||
|
@@ -225,6 +225,15 @@ define([
|
|||||||
|
|
||||||
assert.isTrue(view.$('input#tag').closest(".control-group").hasClass("error"));
|
assert.isTrue(view.$('input#tag').closest(".control-group").hasClass("error"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should uncheck vocabulary restricted if provided vocabulary is empty", function() {
|
||||||
|
var view = this.view.render();
|
||||||
|
|
||||||
|
view.$('input#vocabulary-restricted').attr("checked", true);
|
||||||
|
view.$('input#vocabulary-type option').first().attr("selected", true);
|
||||||
|
|
||||||
|
assert.isTrue(false === view.$('input#vocabulary-restricted').is(":checked"));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("FieldError Views", function() {
|
describe("FieldError Views", function() {
|
||||||
|
Reference in New Issue
Block a user