Browse Source

publish muk_web_utils - 12.0

pull/35/head
MuK IT GmbH 6 years ago
parent
commit
dc4ebe0a42
  1. 12
      muk_web_utils/static/src/js/fields/color.js

12
muk_web_utils/static/src/js/fields/color.js

@ -28,12 +28,16 @@ var colorpicker = require('web.colorpicker');
var _t = core._t; var _t = core._t;
var QWeb = core.qweb; var QWeb = core.qweb;
var FieldColor = fields.DebouncedField.extend({
events: _.extend({}, fields.FieldChar.prototype.events, {
var FieldColor = fields.InputField.extend({
events: _.extend({}, fields.InputField.prototype.events, {
"click .mk_field_color_button": "_onCustomColorButtonClick", "click .mk_field_color_button": "_onCustomColorButtonClick",
}), }),
template: "muk_web_utils.FieldColor", template: "muk_web_utils.FieldColor",
supportedFieldTypes: ['char'], supportedFieldTypes: ['char'],
start: function() {
this.$input = this.$('.mk_field_color_input');
return this._super.apply(this, arguments);
},
_renderEdit: function () { _renderEdit: function () {
this.$('.mk_field_color_input').val(this._formatValue(this.value)); this.$('.mk_field_color_input').val(this._formatValue(this.value));
}, },
@ -42,9 +46,11 @@ var FieldColor = fields.DebouncedField.extend({
}, },
_onCustomColorButtonClick: function () { _onCustomColorButtonClick: function () {
var ColorpickerDialog = new colorpicker(this, { var ColorpickerDialog = new colorpicker(this, {
dialogClass: 'mk_field_color_picker'
dialogClass: 'mk_field_color_picker',
defaultColor: this._getValue(),
}); });
ColorpickerDialog.on('colorpicker:saved', this, function (event) { ColorpickerDialog.on('colorpicker:saved', this, function (event) {
this.$input.val(event.data.hex);
this._setValue(event.data.hex); this._setValue(event.data.hex);
}); });
ColorpickerDialog.open(); ColorpickerDialog.open();

Loading…
Cancel
Save