mirror of https://github.com/OCA/web.git
[IMP] support_branding: black, isort, prettier
parent
f9f57da3b9
commit
8d5d047f85
|
@ -0,0 +1 @@
|
||||||
|
__import__('pkg_resources').declare_namespace(__name__)
|
|
@ -0,0 +1 @@
|
||||||
|
__import__('pkg_resources').declare_namespace(__name__)
|
|
@ -0,0 +1 @@
|
||||||
|
../../../../support_branding
|
|
@ -0,0 +1,6 @@
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
|
@ -1,4 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2012-2015 Therp BV (<http://therp.nl>)
|
# Copyright 2012-2015 Therp BV (<http://therp.nl>)
|
||||||
# Copyright 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com>
|
# Copyright 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com>
|
||||||
# Copyright 2017 - redO2oo - Robert Rottermann <robert@redO2oo.ch>
|
# Copyright 2017 - redO2oo - Robert Rottermann <robert@redO2oo.ch>
|
||||||
|
@ -11,16 +10,16 @@
|
||||||
"version": "10.0.1.0.0",
|
"version": "10.0.1.0.0",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"author": "Therp BV,Odoo Community Association (OCA)",
|
"author": "Therp BV,Odoo Community Association (OCA)",
|
||||||
"website": 'http://therp.nl',
|
"website": "https://github.com/OCA/web",
|
||||||
"depends": [
|
"depends": [
|
||||||
'web',
|
"web",
|
||||||
],
|
],
|
||||||
"qweb": [
|
"qweb": [
|
||||||
'static/src/xml/base.xml',
|
"static/src/xml/base.xml",
|
||||||
],
|
],
|
||||||
"data": [
|
"data": [
|
||||||
"data/ir_config_parameter.xml",
|
"data/ir_config_parameter.xml",
|
||||||
'views/qweb.xml',
|
"views/qweb.xml",
|
||||||
],
|
],
|
||||||
'installable': True,
|
"installable": True,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
.support-branding-submit-form
|
.support-branding-submit-form {
|
||||||
{
|
|
||||||
display: inline;
|
display: inline;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,27 @@
|
||||||
|
|
||||||
/* Copyright 2012-2015 Therp
|
/* Copyright 2012-2015 Therp
|
||||||
* Copyright 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com>
|
* Copyright 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com>
|
||||||
* Copyright 2017 - redO2oo - Robert Rottermann <robert@redO2oo.ch>
|
* Copyright 2017 - redO2oo - Robert Rottermann <robert@redO2oo.ch>
|
||||||
* Copyright 2018 - Therp BV
|
* Copyright 2018 - Therp BV
|
||||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||||
|
|
||||||
odoo.define('web.support_branding', function(require) {
|
odoo.define("web.support_branding", function (require) {
|
||||||
var CrashManager = require('web.CrashManager');
|
var CrashManager = require("web.CrashManager");
|
||||||
var core = require('web.core');
|
var core = require("web.core");
|
||||||
var Model = require('web.Model');
|
var Model = require("web.Model");
|
||||||
var session = require('web.session');
|
var session = require("web.session");
|
||||||
var _t = core._t;
|
var _t = core._t;
|
||||||
CrashManager.include({
|
CrashManager.include({
|
||||||
init: function () {
|
init: function () {
|
||||||
var self = this,
|
var self = this,
|
||||||
ir_config_parameter = new Model('ir.config_parameter');
|
ir_config_parameter = new Model("ir.config_parameter");
|
||||||
ir_config_parameter.call(
|
ir_config_parameter
|
||||||
'get_param', ['support_branding.support_email']).then(
|
.call("get_param", ["support_branding.support_email"])
|
||||||
function(email) {
|
.then(function (email) {
|
||||||
self.support_branding_support_email = email;
|
self.support_branding_support_email = email;
|
||||||
});
|
});
|
||||||
ir_config_parameter.call(
|
ir_config_parameter
|
||||||
'get_param', ['support_branding.company_name']).then(
|
.call("get_param", ["support_branding.company_name"])
|
||||||
function(name) {
|
.then(function (name) {
|
||||||
self.support_branding_company_name = name;
|
self.support_branding_company_name = name;
|
||||||
});
|
});
|
||||||
return this._super(this, arguments);
|
return this._super(this, arguments);
|
||||||
|
@ -31,50 +30,58 @@ odoo.define('web.support_branding', function(require) {
|
||||||
var self = this;
|
var self = this;
|
||||||
error._session = session;
|
error._session = session;
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
jQuery('.support-branding-submit-form').each(function() {
|
jQuery(".support-branding-submit-form").each(function () {
|
||||||
var $form = jQuery(this),
|
var $form = jQuery(this),
|
||||||
$button = $form.find('button'),
|
$button = $form.find("button"),
|
||||||
$description = $form.find('textarea[name="description"]'),
|
$description = $form.find('textarea[name="description"]'),
|
||||||
$subject = $form.find('input[name="subject"]'),
|
$subject = $form.find('input[name="subject"]'),
|
||||||
$body = $form.find('input[name="body"]');
|
$body = $form.find('input[name="body"]');
|
||||||
if (self.support_branding_support_email) {
|
if (self.support_branding_support_email) {
|
||||||
$form.attr(
|
$form.attr(
|
||||||
'action',
|
"action",
|
||||||
'mailto:' + self.support_branding_support_email);
|
"mailto:" + self.support_branding_support_email
|
||||||
$form.parents('.modal').find('.modal-body')
|
);
|
||||||
.css('max-height', '70vh');
|
$form
|
||||||
|
.parents(".modal")
|
||||||
|
.find(".modal-body")
|
||||||
|
.css("max-height", "70vh");
|
||||||
$button.click(function (ev) {
|
$button.click(function (ev) {
|
||||||
var mail_mail = new Model('mail.mail');
|
var mail_mail = new Model("mail.mail");
|
||||||
if (!$description.val()) {
|
if (!$description.val()) {
|
||||||
$description.parent().addClass('oe_form_invalid');
|
$description.parent().addClass("oe_form_invalid");
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mail_mail.call(
|
mail_mail
|
||||||
'create', [{
|
.call("create", [
|
||||||
state: 'outgoing',
|
{
|
||||||
|
state: "outgoing",
|
||||||
auto_delete: true,
|
auto_delete: true,
|
||||||
email_to: self.support_branding_support_email,
|
email_to: self.support_branding_support_email,
|
||||||
subject: $subject.val(),
|
subject: $subject.val(),
|
||||||
body_html: jQuery('<div/>').append(
|
body_html: jQuery("<div/>")
|
||||||
jQuery('<div/>').text($description.val()),
|
.append(
|
||||||
jQuery('<pre/>').text($body.val())
|
jQuery("<div/>").text($description.val()),
|
||||||
).html(),
|
jQuery("<pre/>").text($body.val())
|
||||||
}])
|
)
|
||||||
.then(function(mail_id) {
|
.html(),
|
||||||
return mail_mail.call('send', [
|
},
|
||||||
[mail_id]
|
])
|
||||||
]);
|
.then(
|
||||||
}, function() {
|
function (mail_id) {
|
||||||
// if the call failed, fire the mailto link
|
return mail_mail.call("send", [[mail_id]]);
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
// If the call failed, fire the mailto link
|
||||||
// hoping there is a properly configured email
|
// hoping there is a properly configured email
|
||||||
// client
|
// client
|
||||||
$body.val($description.val() + '\n' + $body.val());
|
$body.val($description.val() + "\n" + $body.val());
|
||||||
$button.unbind('click');
|
$button.unbind("click");
|
||||||
$button.click();
|
$button.click();
|
||||||
})
|
}
|
||||||
|
)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
$form.parents('.modal').modal('hide');
|
$form.parents(".modal").modal("hide");
|
||||||
});
|
});
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
});
|
});
|
||||||
|
@ -85,14 +92,15 @@ odoo.define('web.support_branding', function(require) {
|
||||||
if (self.support_branding_company_name) {
|
if (self.support_branding_company_name) {
|
||||||
$button.text(
|
$button.text(
|
||||||
_.str.sprintf(
|
_.str.sprintf(
|
||||||
_t('Email to %s'),
|
_t("Email to %s"),
|
||||||
self.support_branding_company_name));
|
self.support_branding_company_name
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$form.prependTo(
|
$form.prependTo($form.parents(".modal-dialog").find(".modal-footer"));
|
||||||
$form.parents('.modal-dialog').find('.modal-footer'));
|
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
// this is already instantiated, so we need to call init manually
|
// This is already instantiated, so we need to call init manually
|
||||||
require('web.crash_manager').init();
|
require("web.crash_manager").init();
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,13 +3,32 @@
|
||||||
<t t-extend="CrashManager.error">
|
<t t-extend="CrashManager.error">
|
||||||
<t t-jquery="div" t-operation="after">
|
<t t-jquery="div" t-operation="after">
|
||||||
<div>
|
<div>
|
||||||
<form class="support-branding-submit-form oe_form" action="mailto:" enctype="text/plain" method="get">
|
<form
|
||||||
<input type="hidden" name="subject" t-attf-value="#{error._session.username}@#{error._session.db} [#{error._session.server}]: #{error.message}" />
|
class="support-branding-submit-form oe_form"
|
||||||
<input type="hidden" name="body" t-attf-value="#{error.data.debug}" />
|
action="mailto:"
|
||||||
|
enctype="text/plain"
|
||||||
|
method="get"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="hidden"
|
||||||
|
name="subject"
|
||||||
|
t-attf-value="#{error._session.username}@#{error._session.db} [#{error._session.server}]: #{error.message}"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
type="hidden"
|
||||||
|
name="body"
|
||||||
|
t-attf-value="#{error.data.debug}"
|
||||||
|
/>
|
||||||
<div class="oe_form_field_text oe_form_required">
|
<div class="oe_form_field_text oe_form_required">
|
||||||
<textarea name="description" placeholder="Please fill in how you produced this error..." class="" />
|
<textarea
|
||||||
|
name="description"
|
||||||
|
placeholder="Please fill in how you produced this error..."
|
||||||
|
class=""
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-sm btn-primary">Email to support company</button>
|
<button
|
||||||
|
class="btn btn-sm btn-primary"
|
||||||
|
>Email to support company</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
|
|
|
@ -4,22 +4,38 @@
|
||||||
<template
|
<template
|
||||||
id="support_branding_assets"
|
id="support_branding_assets"
|
||||||
name="support_branding assets"
|
name="support_branding assets"
|
||||||
inherit_id="web.assets_backend">
|
inherit_id="web.assets_backend"
|
||||||
|
>
|
||||||
<xpath expr="." position="inside">
|
<xpath expr="." position="inside">
|
||||||
<script type="text/javascript" src="/support_branding/static/src/js/support_branding.js"></script>
|
<script
|
||||||
<link rel="stylesheet" href="/support_branding/static/src/css/support_branding.css" />
|
type="text/javascript"
|
||||||
|
src="/support_branding/static/src/js/support_branding.js"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="/support_branding/static/src/css/support_branding.css"
|
||||||
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
<template id="menu_secondary" inherit_id="web.menu_secondary">
|
<template id="menu_secondary" inherit_id="web.menu_secondary">
|
||||||
<xpath expr="//div[@class='o_sub_menu_footer']" position="inside">
|
<xpath expr="//div[@class='o_sub_menu_footer']" position="inside">
|
||||||
<span>, supported by
|
<span>, supported by
|
||||||
<a target="_new" t-att-href="request.env['ir.config_parameter'].get_param('support_branding.company_url')"
|
<a
|
||||||
t-att-style="'color: ' + request.env['ir.config_parameter'].get_param('support_branding.company_color')">
|
target="_new"
|
||||||
<t t-esc="request.env['ir.config_parameter'].get_param('support_branding.company_name')" />
|
t-att-href="request.env['ir.config_parameter'].get_param('support_branding.company_url')"
|
||||||
|
t-att-style="'color: ' + request.env['ir.config_parameter'].get_param('support_branding.company_color')"
|
||||||
|
>
|
||||||
|
<t
|
||||||
|
t-esc="request.env['ir.config_parameter'].get_param('support_branding.company_name')"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
<div t-if="request.env['ir.config_parameter'].get_param('support_branding.release')">
|
<div
|
||||||
Version <t t-esc="request.env['ir.config_parameter'].get_param('support_branding.release')" />
|
t-if="request.env['ir.config_parameter'].get_param('support_branding.release')"
|
||||||
|
>
|
||||||
|
Version <t
|
||||||
|
t-esc="request.env['ir.config_parameter'].get_param('support_branding.release')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue