[MIG] web_environment_ribbon: Migration to 12.0

[MIG] web_environment_ribbon: Migration to 12.0

[FIX] Default value for ribbon.name if not exists

[FIX] Hide ribbon when ribbon.name is false or not existing

[FIX] Remove copyright flag on __init__ files

[REM] Debugging logs

[REM] Make quotes inconsistant again and change sequence of data files in manifest
This commit is contained in:
tarteo
2018-10-02 13:28:48 +02:00
committed by Andreas Perhab
parent f1cd9f50b9
commit 257c03b8e7
10 changed files with 99 additions and 49 deletions

View File

@@ -14,20 +14,28 @@ odoo.define('web_environment_ribbon.ribbon', function(require) {
// 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; }
if (strToTest === "") {
return false;
}
if (strToTest === "inherit") {
return true;
}
if (strToTest === "transparent") {
return true;
}
var image = document.createElement("img");
image.style.color = "rgb(0, 0, 0)";
image.style.color = strToTest;
if (image.style.color !== "rgb(0, 0, 0)") { return true; }
if (image.style.color !== "rgb(0, 0, 0)") {
return true;
}
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 () {
var ribbon = $('<div class="test-ribbon"/>');
var ribbon = $('<div class="test-ribbon hidden"/>');
$('body').append(ribbon);
ribbon.hide();
// Get ribbon data from backend
@@ -37,7 +45,7 @@ odoo.define('web_environment_ribbon.ribbon', function(require) {
}).then(
function (ribbon_data) {
// Ribbon name
if (ribbon_data.name && ribbon_data.name != 'False') {
if (ribbon_data.name && ribbon_data.name !== 'False') {
ribbon.html(ribbon_data.name);
ribbon.show();
}
@@ -52,4 +60,4 @@ odoo.define('web_environment_ribbon.ribbon', function(require) {
}
);
});
}); // odoo.define
});