forked from Techsystech/web
[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 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com>
|
||||
# Copyright 2017 - redO2oo - Robert Rottermann <robert@redO2oo.ch>
|
||||
|
@ -11,16 +10,16 @@
|
|||
"version": "10.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "Therp BV,Odoo Community Association (OCA)",
|
||||
"website": 'http://therp.nl',
|
||||
"website": "https://github.com/OCA/web",
|
||||
"depends": [
|
||||
'web',
|
||||
"web",
|
||||
],
|
||||
"qweb": [
|
||||
'static/src/xml/base.xml',
|
||||
"static/src/xml/base.xml",
|
||||
],
|
||||
"data": [
|
||||
"data/ir_config_parameter.xml",
|
||||
'views/qweb.xml',
|
||||
"views/qweb.xml",
|
||||
],
|
||||
'installable': True,
|
||||
"installable": True,
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<openerp>
|
||||
<data noupdate="0">
|
||||
<record id="config_parameter_company_name" model="ir.config_parameter">
|
||||
|
@ -15,11 +15,11 @@
|
|||
</record>
|
||||
<record id="config_parameter_support_email" model="ir.config_parameter">
|
||||
<field name="key">support_branding.support_email</field>
|
||||
<field name="value" eval="''"/>
|
||||
<field name="value" eval="''" />
|
||||
</record>
|
||||
<record id="config_parameter_release" model="ir.config_parameter">
|
||||
<field name="key">support_branding.release</field>
|
||||
<field name="value" eval="''"/>
|
||||
<field name="value" eval="''" />
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
.support-branding-submit-form
|
||||
{
|
||||
.support-branding-submit-form {
|
||||
display: inline;
|
||||
margin: 0px;
|
||||
}
|
||||
|
|
|
@ -1,80 +1,87 @@
|
|||
|
||||
/* Copyright 2012-2015 Therp
|
||||
* Copyright 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com>
|
||||
* Copyright 2017 - redO2oo - Robert Rottermann <robert@redO2oo.ch>
|
||||
* Copyright 2018 - Therp BV
|
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||
|
||||
odoo.define('web.support_branding', function(require) {
|
||||
var CrashManager = require('web.CrashManager');
|
||||
var core = require('web.core');
|
||||
var Model = require('web.Model');
|
||||
var session = require('web.session');
|
||||
odoo.define("web.support_branding", function (require) {
|
||||
var CrashManager = require("web.CrashManager");
|
||||
var core = require("web.core");
|
||||
var Model = require("web.Model");
|
||||
var session = require("web.session");
|
||||
var _t = core._t;
|
||||
CrashManager.include({
|
||||
init: function() {
|
||||
init: function () {
|
||||
var self = this,
|
||||
ir_config_parameter = new Model('ir.config_parameter');
|
||||
ir_config_parameter.call(
|
||||
'get_param', ['support_branding.support_email']).then(
|
||||
function(email) {
|
||||
ir_config_parameter = new Model("ir.config_parameter");
|
||||
ir_config_parameter
|
||||
.call("get_param", ["support_branding.support_email"])
|
||||
.then(function (email) {
|
||||
self.support_branding_support_email = email;
|
||||
});
|
||||
ir_config_parameter.call(
|
||||
'get_param', ['support_branding.company_name']).then(
|
||||
function(name) {
|
||||
ir_config_parameter
|
||||
.call("get_param", ["support_branding.company_name"])
|
||||
.then(function (name) {
|
||||
self.support_branding_company_name = name;
|
||||
});
|
||||
return this._super(this, arguments);
|
||||
},
|
||||
show_error: function(error) {
|
||||
show_error: function (error) {
|
||||
var self = this;
|
||||
error._session = session;
|
||||
this._super.apply(this, arguments);
|
||||
jQuery('.support-branding-submit-form').each(function() {
|
||||
jQuery(".support-branding-submit-form").each(function () {
|
||||
var $form = jQuery(this),
|
||||
$button = $form.find('button'),
|
||||
$button = $form.find("button"),
|
||||
$description = $form.find('textarea[name="description"]'),
|
||||
$subject = $form.find('input[name="subject"]'),
|
||||
$body = $form.find('input[name="body"]');
|
||||
if (self.support_branding_support_email) {
|
||||
$form.attr(
|
||||
'action',
|
||||
'mailto:' + self.support_branding_support_email);
|
||||
$form.parents('.modal').find('.modal-body')
|
||||
.css('max-height', '70vh');
|
||||
$button.click(function(ev) {
|
||||
var mail_mail = new Model('mail.mail');
|
||||
"action",
|
||||
"mailto:" + self.support_branding_support_email
|
||||
);
|
||||
$form
|
||||
.parents(".modal")
|
||||
.find(".modal-body")
|
||||
.css("max-height", "70vh");
|
||||
$button.click(function (ev) {
|
||||
var mail_mail = new Model("mail.mail");
|
||||
if (!$description.val()) {
|
||||
$description.parent().addClass('oe_form_invalid');
|
||||
$description.parent().addClass("oe_form_invalid");
|
||||
ev.preventDefault();
|
||||
return;
|
||||
}
|
||||
mail_mail.call(
|
||||
'create', [{
|
||||
state: 'outgoing',
|
||||
mail_mail
|
||||
.call("create", [
|
||||
{
|
||||
state: "outgoing",
|
||||
auto_delete: true,
|
||||
email_to: self.support_branding_support_email,
|
||||
subject: $subject.val(),
|
||||
body_html: jQuery('<div/>').append(
|
||||
jQuery('<div/>').text($description.val()),
|
||||
jQuery('<pre/>').text($body.val())
|
||||
).html(),
|
||||
}])
|
||||
.then(function(mail_id) {
|
||||
return mail_mail.call('send', [
|
||||
[mail_id]
|
||||
]);
|
||||
}, function() {
|
||||
// if the call failed, fire the mailto link
|
||||
// hoping there is a properly configured email
|
||||
// client
|
||||
$body.val($description.val() + '\n' + $body.val());
|
||||
$button.unbind('click');
|
||||
$button.click();
|
||||
})
|
||||
.then(function() {
|
||||
$form.parents('.modal').modal('hide');
|
||||
body_html: jQuery("<div/>")
|
||||
.append(
|
||||
jQuery("<div/>").text($description.val()),
|
||||
jQuery("<pre/>").text($body.val())
|
||||
)
|
||||
.html(),
|
||||
},
|
||||
])
|
||||
.then(
|
||||
function (mail_id) {
|
||||
return mail_mail.call("send", [[mail_id]]);
|
||||
},
|
||||
function () {
|
||||
// If the call failed, fire the mailto link
|
||||
// hoping there is a properly configured email
|
||||
// client
|
||||
$body.val($description.val() + "\n" + $body.val());
|
||||
$button.unbind("click");
|
||||
$button.click();
|
||||
}
|
||||
)
|
||||
.then(function () {
|
||||
$form.parents(".modal").modal("hide");
|
||||
});
|
||||
ev.preventDefault();
|
||||
});
|
||||
|
@ -85,14 +92,15 @@ odoo.define('web.support_branding', function(require) {
|
|||
if (self.support_branding_company_name) {
|
||||
$button.text(
|
||||
_.str.sprintf(
|
||||
_t('Email to %s'),
|
||||
self.support_branding_company_name));
|
||||
_t("Email to %s"),
|
||||
self.support_branding_company_name
|
||||
)
|
||||
);
|
||||
}
|
||||
$form.prependTo(
|
||||
$form.parents('.modal-dialog').find('.modal-footer'));
|
||||
$form.prependTo($form.parents(".modal-dialog").find(".modal-footer"));
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
// this is already instantiated, so we need to call init manually
|
||||
require('web.crash_manager').init();
|
||||
// This is already instantiated, so we need to call init manually
|
||||
require("web.crash_manager").init();
|
||||
});
|
||||
|
|
|
@ -1,15 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates>
|
||||
<t t-extend="CrashManager.error">
|
||||
<t t-jquery="div" t-operation="after">
|
||||
<div>
|
||||
<form class="support-branding-submit-form oe_form" 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}" />
|
||||
<form
|
||||
class="support-branding-submit-form oe_form"
|
||||
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">
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</t>
|
||||
|
|
|
@ -1,25 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<template
|
||||
id="support_branding_assets"
|
||||
name="support_branding assets"
|
||||
inherit_id="web.assets_backend">
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr="." position="inside">
|
||||
<script type="text/javascript" src="/support_branding/static/src/js/support_branding.js"></script>
|
||||
<link rel="stylesheet" href="/support_branding/static/src/css/support_branding.css" />
|
||||
<script
|
||||
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>
|
||||
</template>
|
||||
<template id="menu_secondary" inherit_id="web.menu_secondary">
|
||||
<xpath expr="//div[@class='o_sub_menu_footer']" position="inside">
|
||||
<span>, supported by
|
||||
<a target="_new" 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
|
||||
target="_new"
|
||||
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>
|
||||
</span>
|
||||
<div 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
|
||||
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>
|
||||
</xpath>
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue