Skip to content

Instantly share code, notes, and snippets.

@florentx
Created January 27, 2014 15:15
Show Gist options
  • Save florentx/8650174 to your computer and use it in GitHub Desktop.
Save florentx/8650174 to your computer and use it in GitHub Desktop.
OpenERP 6.1: different layout for Production and Test environments, based on hostname
/* /web_mycompany/static/src/css/mycompany.css */
/* Header */
.openerp.production .company_logo {
background: url('/web_mycompany/static/src/img/logo.png');
/* width:180px; */
/* height:46px; */
}
/* ... and similar CSS hacks ... */
/* /web_mycompany/static/src/js/mycompany.js */
openerp.web_mycompany = function(openerp) {
var hostname = window.location.hostname,
params = jQuery.param != undefined && jQuery.deparam(jQuery.param.querystring()),
production = hostname == 'my.hostname.com' || hostname == 'alt.hostname.com' || params.production != undefined;
if (!openerp.web_mycompany) {
/** @namespace */
openerp.web_mycompany = {};
}
if (production) {
$(document.body).addClass('production');
openerp.web.Login = openerp.web.Login.extend({
start: function() {
this._super.apply(this, arguments);
var logoimg = this.$element.find('#logo img');
logoimg.attr('src', '/web_mycompany/static/src/img/logo.png');
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment