Browse Source

[MIG] web_environment_ribbon: Migration to 11.0

pull/796/head
xavierjimenez 7 years ago
committed by Pedro M. Baeza
parent
commit
e021f3de3f
  1. 15
      web_environment_ribbon/README.rst
  2. 1
      web_environment_ribbon/__init__.py
  3. 6
      web_environment_ribbon/__manifest__.py
  4. 1
      web_environment_ribbon/models/web_environment_ribbon_backend.py
  5. 27
      web_environment_ribbon/static/src/js/ribbon.js

15
web_environment_ribbon/README.rst

@ -1,5 +1,5 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3
======================
@ -8,14 +8,6 @@ Web Environment Ribbon
Mark a Test Environment with a red ribbon on the top left corner in every page
.. image:: /web_environment_ribbon/static/description/screenshot.png
:alt: Screenshot
Installation
============
No special setup
Configuration
=============
@ -36,7 +28,7 @@ ribbon will be visible on top left corner of every Odoo backend page
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/162/10.0
:target: https://runbot.odoo-community.org/runbot/162/11.0
Bug Tracker
===========
@ -56,6 +48,7 @@ Contributors
* Javi Melendez <javimelex@gmail.com>
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
* Thomas Binsfeld <thomas.binsfeld@acsone.eu>
* Xavier Jiménez <xavier.jimenez@qubiq.es>
Maintainer
----------

1
web_environment_ribbon/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Francesco OpenCode Apruzzese <cescoap@gmail.com>
# Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu>

6
web_environment_ribbon/__manifest__.py

@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Francesco OpenCode Apruzzese <cescoap@gmail.com>
# Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu>
# Copyright 2017 Xavier Jiménez <xavier.jimenez@qubiq.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': "Web Environment Ribbon",
'version': '10.0.1.0.0',
'version': '11.0.1.0.0',
'category': 'Web',
'author': 'Francesco OpenCode Apruzzese, '
'Tecnativa, '
'Odoo Community Association (OCA)',
'website': 'https://it.linkedin.com/in/francescoapruzzese',
'website': 'https://github.com/OCA/web',
'license': 'AGPL-3',
"depends": [
'web',

1
web_environment_ribbon/models/web_environment_ribbon_backend.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

27
web_environment_ribbon/static/src/js/ribbon.js

@ -2,19 +2,18 @@
Copyright 2015 Javi Melendez <javi.melendez@algios.com>
Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu>
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
Copyright 2017 Xavier Jiménez <xavier.jimenez@qubiq.es>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define('web_environment_ribbon.ribbon', function(require) {
"use strict";
var $ = require('jquery');
var Model = require('web.Model');
var core = require('web.core');
var $ = require('jquery');
var rpc = require('web.rpc');
var core = require('web.core');
var backend_model = new Model('web.environment.ribbon.backend');
// Code from: http://jsfiddle.net/WK_of_Angmar/xgA5C/
function validStrColour(strToTest) {
// Code from: http://jsfiddle.net/WK_of_Angmar/xgA5C/
function validStrColour(strToTest) {
if (strToTest === "") { return false; }
if (strToTest === "inherit") { return true; }
if (strToTest === "transparent") { return true; }
@ -25,14 +24,17 @@ function validStrColour(strToTest) {
image.style.color = "rgb(255, 255, 255)";
image.style.color = strToTest;
return image.style.color !== "rgb(255, 255, 255)";
}
}
core.bus.on('web_client_ready', null, function () {
core.bus.on('web_client_ready', null, function () {
var ribbon = $('<div class="test-ribbon"/>');
$('body').append(ribbon);
ribbon.hide();
// Get ribbon data from backend
backend_model.call('get_environment_ribbon').then(
rpc.query({
model: 'web.environment.ribbon.backend',
method: 'get_environment_ribbon',
}).then(
function (ribbon_data) {
// Ribbon name
if (ribbon_data.name && ribbon_data.name != 'False') {
@ -49,6 +51,5 @@ core.bus.on('web_client_ready', null, function () {
}
}
);
});
});
}); // odoo.define
Loading…
Cancel
Save