From f8a1908d117c5f6b086b82c44361afcd23c0a98e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 30 Mar 2019 16:04:45 +0100 Subject: [PATCH] Add HTML editor issue8004 review54481002 --- CHANGELOG | 1 + src/view/form.js | 64 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index a18bf36583..99f9f31d63 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Support HTML widget * Use locale format for data export * Add day view on calendar * Add CSV exports into print toolbar diff --git a/src/view/form.js b/src/view/form.js index c8c24c4c47..f9292fba2e 100644 --- a/src/view/form.js +++ b/src/view/form.js @@ -1150,6 +1150,10 @@ function eval_pyson(value){ if (!this.translate) { this.translate = Sao.View.Form.TranslateMixin.translate.bind(this); } + if (!this.translate_dialog) { + this.translate_dialog = + Sao.View.Form.TranslateMixin.translate_dialog.bind(this); + } if (!this.translate_widget_set_readonly) { this.translate_widget_set_readonly = Sao.View.Form.TranslateMixin.translate_widget_set_readonly @@ -1194,10 +1198,13 @@ function eval_pyson(value){ 'params': params.concat({}) }; Sao.rpc(args, session).then(function(languages) { - var dialog = new Sao.View.Form.TranslateDialog(languages, this); + this.translate_dialog(languages); }.bind(this)); }.bind(this)); }; + Sao.View.Form.TranslateMixin.translate_dialog = function(languages) { + new Sao.View.Form.TranslateDialog(languages, this); + }; Sao.View.Form.TranslateMixin.translate_widget_set_readonly = function(el, value) { el.prop('readonly', value); @@ -3786,6 +3793,60 @@ function eval_pyson(value){ } }); + Sao.View.Form.HTML = Sao.class_(Sao.View.Form.Widget, { + class_: 'form-html', + init: function(view, attributes) { + Sao.View.Form.HTML._super.init.call(this, view, attributes); + Sao.View.Form.TranslateMixin.init.call(this); + this.el = jQuery('
', { + 'class': this.class_, + }); + this.button = jQuery('', { + 'class': 'btn btn-lnk', + 'target': '_blank', + }).text(attributes.string).appendTo(this.el); + if (attributes.translate) { + var button = jQuery('