summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-11-07 17:19:55 +0100
committerXavier Morel <xmo@openerp.com>2012-11-07 17:19:55 +0100
commita423c324547bdd2416ff4e04413277367cc406e6 (patch)
tree1a6f8e5bc5180a48161a61573d709e8b3cb5e114 /addons/web/static/src
parent6f79b279bfbbdd3f745d0e11edfc33ceb0f328f1 (diff)
[IMP] m2m_tags code
bzr revid: xmo@openerp.com-20121107161955-bc7bxmmbdkmr34ix
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/view_form.js23
1 files changed, 11 insertions, 12 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index d55e9bb523b..6599bdbc3e0 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -3924,11 +3924,11 @@ instance.web.form.One2ManyFormView = instance.web.FormView.extend({
});
var lazy_build_o2m_kanban_view = function() {
-if (! instance.web_kanban || instance.web.form.One2ManyKanbanView)
- return;
-instance.web.form.One2ManyKanbanView = instance.web_kanban.KanbanView.extend({
-});
-}
+ if (! instance.web_kanban || instance.web.form.One2ManyKanbanView)
+ return;
+ instance.web.form.One2ManyKanbanView = instance.web_kanban.KanbanView.extend({
+ });
+};
instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(instance.web.form.CompletionFieldMixin, instance.web.form.ReinitializeFieldMixin, {
template: "FieldMany2ManyTags",
@@ -3943,7 +3943,7 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in
if (this.get("effective_readonly"))
return;
var self = this;
- self.$text = $("textarea", this.$el);
+ self.$text = this.$("textarea");
self.$text.textext({
plugins : 'tags arrow autocomplete',
autocomplete: {
@@ -3967,9 +3967,8 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in
},
tags: {
isTagAllowed: function(tag) {
- if (! tag.name)
- return false;
- return true;
+ return !!tag.name;
+
},
removeTag: function(tag) {
var id = tag.data("id");
@@ -4001,7 +4000,7 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in
self._drop_shown = true;
});
self.tags = self.$text.textext()[0].tags();
- $("textarea", this.$el).focusout(function() {
+ self.$text.focusout(function() {
self.$text.trigger("setInputData", "");
}).keydown(function(e) {
if (e.which === $.ui.keyCode.TAB && self._drop_shown) {
@@ -4026,7 +4025,7 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in
render_value: function() {
var self = this;
var dataset = new instance.web.DataSetStatic(this, this.field.relation, self.build_context());
- var values = self.get("value")
+ var values = self.get("value");
var handle_names = function(data) {
if (self.isDestroyed())
return;
@@ -4037,7 +4036,7 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in
data = _.map(values, function(el) { return indexed[el]; });
if (! self.get("effective_readonly")) {
self.tags.containerElement().children().remove();
- $("textarea", self.$el).css("padding-left", "3px");
+ self.$('textarea').css("padding-left", "3px");
self.tags.addTags(_.map(data, function(el) {return {name: el[1], id:el[0]};}));
} else {
self.$el.html(QWeb.render("FieldMany2ManyTag", {elements: data}));