mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[IMP] css & support for html editor
This commit is contained in:
@@ -1,8 +1,20 @@
|
||||
.support-branding-submit-form {
|
||||
display: inline;
|
||||
margin: 0px;
|
||||
margin: 0;
|
||||
width: 100%
|
||||
}
|
||||
|
||||
.support-statement {
|
||||
margin: 10px 0 10px 0;
|
||||
}
|
||||
|
||||
.support-statement .note-editor {
|
||||
height: 230px;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.support-desc {
|
||||
resize: block;
|
||||
max-height: 139px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ odoo.define("support_branding.CrashManager", function (require) {
|
||||
var CrashManager = require("web.CrashManager").CrashManager;
|
||||
var session = require("web.session");
|
||||
var core = require("web.core");
|
||||
var Wysiwyg = require('web_editor.wysiwyg.root');
|
||||
|
||||
var _t = core._t;
|
||||
|
||||
@@ -60,7 +61,7 @@ odoo.define("support_branding.CrashManager", function (require) {
|
||||
},
|
||||
show_error: function (error) {
|
||||
var self = this;
|
||||
var dialog = this._super.apply(this, arguments);
|
||||
this.wysiwyg = new Wysiwyg(self, {});
|
||||
var subject =
|
||||
session.username +
|
||||
"@" +
|
||||
@@ -80,15 +81,17 @@ odoo.define("support_branding.CrashManager", function (require) {
|
||||
'autocomplete="off" value=\'' +
|
||||
body +
|
||||
"'/>";
|
||||
dialog.opened(function () {
|
||||
return this._super.apply(this, arguments).opened(function () {
|
||||
var $form = $(".support-branding-submit-form");
|
||||
var $statement = $(".support-statement");
|
||||
var $description = $(".support-desc");
|
||||
var $button = $(".support-btn");
|
||||
var $use_html_ck = $('#use_html_checker');
|
||||
var $close_btn = $(".close");
|
||||
var $body = $(".sp-body");
|
||||
var $header = $form.parents(".modal-dialog").find(".modal-header");
|
||||
var $footer = $form.parents(".modal-dialog").find(".modal-footer");
|
||||
// self.wysiwyg.attachTo($description);
|
||||
|
||||
$statement.prepend(inputs);
|
||||
if (self.support_cp_email) {
|
||||
@@ -105,6 +108,23 @@ odoo.define("support_branding.CrashManager", function (require) {
|
||||
.parents(".modal")
|
||||
.find(".modal-body")
|
||||
.css("max-height", "70vh");
|
||||
$use_html_ck.on('change', function (){
|
||||
if (this.checked) {
|
||||
if (!self.wysiwyg.isDestroyed())
|
||||
self.wysiwyg.attachTo($description);
|
||||
else {
|
||||
self.wysiwyg = new Wysiwyg(self, {});
|
||||
self.wysiwyg.attachTo($description);
|
||||
}
|
||||
}
|
||||
else {
|
||||
self.wysiwyg.destroy();
|
||||
$('.support-statement').append($description);
|
||||
if ($description.is(':hidden'))
|
||||
$description.css({'display': 'block'});
|
||||
}
|
||||
});
|
||||
|
||||
$button.on("click", function (ev) {
|
||||
var $btn = $(this);
|
||||
if (!$description.val()) {
|
||||
@@ -113,18 +133,19 @@ odoo.define("support_branding.CrashManager", function (require) {
|
||||
return;
|
||||
}
|
||||
ev.preventDefault();
|
||||
var desc = $description.val();
|
||||
var error_code = '';
|
||||
var desc = self.wysiwyg.$editor &&
|
||||
self.wysiwyg.$editor.length ?
|
||||
self.wysiwyg.getValue() : $description.val();
|
||||
desc = jQuery("<div/>").text(desc);
|
||||
error_code = jQuery("<pre/>").text(body);
|
||||
var params = {
|
||||
state: "outgoing",
|
||||
auto_delete: true,
|
||||
email_to: self.support_cp_email,
|
||||
subject: subject,
|
||||
body_html: jQuery("<div/>")
|
||||
.append(
|
||||
jQuery("<div/>").text(desc),
|
||||
jQuery("<pre/>").text(body)
|
||||
)
|
||||
.html(),
|
||||
body_html: jQuery("<div/>").append(
|
||||
desc, error_code.html()).text(),
|
||||
};
|
||||
self._rpc({
|
||||
model: "mail.mail",
|
||||
@@ -147,7 +168,7 @@ odoo.define("support_branding.CrashManager", function (require) {
|
||||
}
|
||||
},
|
||||
function () {
|
||||
$body.val(desc + "\n" + $body.val());
|
||||
$body.val(desc + "\n\n" + $body.val());
|
||||
$btn.unbind("click");
|
||||
$btn.click();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,15 @@
|
||||
enctype="text/plain"
|
||||
method="get"
|
||||
>
|
||||
<div class="support-statement oe_form_field_text oe_form_required">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox"
|
||||
name="use_html_checker" id="use_html_checker"/>
|
||||
<label class="form-check-label" for="use_html_checker">
|
||||
Use HTML Editor
|
||||
</label>
|
||||
</div>
|
||||
<div
|
||||
class="support-statement oe_form_field_text oe_form_required">
|
||||
<textarea
|
||||
name="description"
|
||||
autocomplete="off"
|
||||
@@ -17,7 +25,8 @@
|
||||
/>
|
||||
</div>
|
||||
<button class="support-btn btn btn-primary">Email to support
|
||||
company</button>
|
||||
company
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</t>
|
||||
@@ -29,35 +38,39 @@
|
||||
>
|
||||
<div class="col-12 o_setting_box" id="edition">
|
||||
<div class="o_setting_right_pane">
|
||||
<div class="user-heading">
|
||||
<h3>
|
||||
Technical Support By
|
||||
<t t-esc="widget.support_cp_name" />
|
||||
</h3>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
<div
|
||||
<div class="user-heading">
|
||||
<h3>
|
||||
Technical Support By
|
||||
<t t-esc="widget.support_cp_name"/>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
<div
|
||||
role="tabpanel"
|
||||
id="settings"
|
||||
class="tab-pane active text-muted o_web_settings_compact_subtitle"
|
||||
>
|
||||
<small>For Support visit our
|
||||
<a
|
||||
<small>For Support visit our
|
||||
<a
|
||||
target="_blank"
|
||||
t-attr-href="{{widget.support_cp_url}}"
|
||||
style="text-decoration: underline;"
|
||||
>
|
||||
website</a> or mail us at
|
||||
<a
|
||||
website
|
||||
</a>
|
||||
or mail us at
|
||||
<a
|
||||
target="_blank"
|
||||
t-attr-href="mailto:{{widget.support_cp_email}}"
|
||||
style="text-decoration: underline;"
|
||||
>
|
||||
<t t-esc="widget.support_cp_email" /></a></small>
|
||||
<t t-esc="widget.support_cp_email"/>
|
||||
</a>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user