summaryrefslogtreecommitdiff
path: root/ob_chatter_position/static/src/js
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-10-24 12:01:57 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-10-24 12:01:57 +0700
commit9e640373587dea1e612b34eca6308cb42458b714 (patch)
tree5222b900daef5a6eafceeed7c572c715891ae620 /ob_chatter_position/static/src/js
parent2b3c94874466c3dd0a05f0f81dd4b09bc3f87987 (diff)
Update __init__.py, __manifest__.py, and 21 more files...
Diffstat (limited to 'ob_chatter_position/static/src/js')
-rwxr-xr-xob_chatter_position/static/src/js/form_chatter_position.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/ob_chatter_position/static/src/js/form_chatter_position.js b/ob_chatter_position/static/src/js/form_chatter_position.js
new file mode 100755
index 0000000..706b057
--- /dev/null
+++ b/ob_chatter_position/static/src/js/form_chatter_position.js
@@ -0,0 +1,39 @@
+odoo.define('ob_chatter_position.ChatterPositionFormController', function (require) {
+ "use strict";
+
+ var config = require('web.config');
+ var FormController = require('web.FormController');
+ var FormRenderer = require('web.FormRenderer');
+
+ var ChatterPositionFormController = FormController.include({
+
+ renderButtons: function ($node) {
+ this._super.apply(this, arguments);
+ if (this.$buttons) {
+ this.$buttons.on('click', '.o_chatter_position_button', this._onChatterPosition.bind(this));
+ }
+ },
+
+ _onChatterPosition: function () {
+ if (this.$el.offsetParent().hasClass("o_chatter_position_normal")) {
+ this.$el.offsetParent().attr('class', 'o_web_client o_chatter_position_sided');
+ } else if (this.$el.offsetParent().hasClass("o_chatter_position_sided")) {
+ this.$el.offsetParent().attr('class', 'o_web_client o_chatter_position_normal');
+ }
+ },
+ });
+
+ FormRenderer.include({
+ _applyFormSizeClass: function () {
+ const formEl = this.$el[0];
+ if (config.device.size_class <= config.device.SIZES.XS) {
+ formEl.classList.add('o_xxs_form_view');
+ } else {
+ formEl.classList.remove('o_xxs_form_view');
+ }
+ },
+ });
+
+ return ChatterPositionFormController;
+
+ });