mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[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:
@@ -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
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user