|
@ -2,19 +2,18 @@ |
|
|
Copyright 2015 Javi Melendez <javi.melendez@algios.com> |
|
|
Copyright 2015 Javi Melendez <javi.melendez@algios.com> |
|
|
Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com> |
|
|
Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com> |
|
|
Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu> |
|
|
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) { |
|
|
odoo.define('web_environment_ribbon.ribbon', function(require) { |
|
|
"use strict"; |
|
|
"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 === "") { return false; } |
|
|
if (strToTest === "inherit") { return true; } |
|
|
if (strToTest === "inherit") { return true; } |
|
|
if (strToTest === "transparent") { return true; } |
|
|
if (strToTest === "transparent") { return true; } |
|
@ -25,14 +24,17 @@ function validStrColour(strToTest) { |
|
|
image.style.color = "rgb(255, 255, 255)"; |
|
|
image.style.color = "rgb(255, 255, 255)"; |
|
|
image.style.color = strToTest; |
|
|
image.style.color = strToTest; |
|
|
return image.style.color !== "rgb(255, 255, 255)"; |
|
|
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"/>'); |
|
|
var ribbon = $('<div class="test-ribbon"/>'); |
|
|
$('body').append(ribbon); |
|
|
$('body').append(ribbon); |
|
|
ribbon.hide(); |
|
|
ribbon.hide(); |
|
|
// Get ribbon data from backend
|
|
|
// 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) { |
|
|
function (ribbon_data) { |
|
|
// Ribbon name
|
|
|
// Ribbon name
|
|
|
if (ribbon_data.name && ribbon_data.name != 'False') { |
|
|
if (ribbon_data.name && ribbon_data.name != 'False') { |
|
@ -49,6 +51,5 @@ core.bus.on('web_client_ready', null, function () { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
}); // odoo.define
|
|
|
}); // odoo.define
|