summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorxO-Tx <mou@odoo.com>2020-06-15 07:46:36 +0000
committerThibault Delavallée <tde@odoo.com>2020-08-11 14:38:32 +0000
commit6e8f4ff3ead93ad1e9294b0ebed8d60e4e4bf1ce (patch)
treeb3fc6a5ccd3837289bff6c2d0451a56a492a707e /addons
parent7a253beab2e2bb3a8eab02fd6d538b4284a747cc (diff)
[IMP] sms/mass_mailing: add emojis support to the base SmsWidget
This commit adds emojis to base SmsWidget in order to use a text field with both sms and emoji widgets in "mass_mailing_sms" module for sms content. The emoji feature is optional (depends on "enable_emojis" attribute). To add the emoji support, the following changes have been made: * override the method "on_attach_callback" from emoji widget base code to hide emojis if not enabled; We also adjust the css of emoji widget to make it suitable for a text field with sms option. Task ID-2224393 PR #49096
Diffstat (limited to 'addons')
-rw-r--r--addons/mass_mailing/static/src/scss/mass_mailing.scss7
-rw-r--r--addons/sms/static/src/js/fields_sms_widget.js18
2 files changed, 20 insertions, 5 deletions
diff --git a/addons/mass_mailing/static/src/scss/mass_mailing.scss b/addons/mass_mailing/static/src/scss/mass_mailing.scss
index 8e20d437232..5b8ebff2023 100644
--- a/addons/mass_mailing/static/src/scss/mass_mailing.scss
+++ b/addons/mass_mailing/static/src/scss/mass_mailing.scss
@@ -14,7 +14,12 @@
}
}
}
-
+.o_form_view {
+ // This will display the emoji widget in the right position after a text field with sms option.
+ .o_sms_container ~ .o_mail_add_emoji{
+ bottom: 55px;
+ }
+}
.o_white_body {
background-color: white;
}
diff --git a/addons/sms/static/src/js/fields_sms_widget.js b/addons/sms/static/src/js/fields_sms_widget.js
index 53af8e33e98..d438f6c90bc 100644
--- a/addons/sms/static/src/js/fields_sms_widget.js
+++ b/addons/sms/static/src/js/fields_sms_widget.js
@@ -1,11 +1,9 @@
odoo.define('sms.sms_widget', function (require) {
"use strict";
-var basicFields = require('web.basic_fields');
var core = require('web.core');
var fieldRegistry = require('web.field_registry');
-
-var FieldText = basicFields.FieldText;
+var FieldTextEmojis = require('mail.field_text_emojis');
var _t = core._t;
/**
@@ -13,8 +11,9 @@ var _t = core._t;
* the number of SMS and the number of characters. This text is computed every
* time the user changes the body.
*/
-var SmsWidget = FieldText.extend({
+var SmsWidget = FieldTextEmojis.extend({
className: 'o_field_text',
+ enableEmojis: false,
/**
* @constructor
*/
@@ -23,6 +22,17 @@ var SmsWidget = FieldText.extend({
this.nbrChar = 0;
this.nbrSMS = 0;
this.encoding = 'GSM7';
+ this.enableEmojis = !!this.nodeOptions.enable_emojis;
+ },
+
+ /**
+ * @override
+ *"This will add the emoji dropdown to a target field (controlled by the "enableEmojis" attribute)
+ */
+ on_attach_callback: function () {
+ if (this.enableEmojis) {
+ this._super.apply(this, arguments);
+ }
},
//--------------------------------------------------------------------------