[IMP] Centralized 'openerp' class on top level elements. Also add openerp_ie class for MSIE

bzr revid: fme@openerp.com-20121115164132-i6a0u8zk3knm1zkv
This commit is contained in:
Fabien Meghazi 2012-11-15 17:41:32 +01:00
parent 15281138ea
commit cace9f7887
5 changed files with 16 additions and 5 deletions

View File

@ -549,8 +549,7 @@ def content_disposition(filename, req):
#----------------------------------------------------------
html_template = """<!DOCTYPE html>
<!--[if lte IE 9]> <html style='height: 100%%' class='ie'> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html style='height: 100%%' class=''> <!--<![endif]-->
<html style="height: 100%%">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

View File

@ -27,7 +27,8 @@
var $tip = this.tip();
$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
$tip[0].className = 'tipsy openerp oe_tooltip '; // reset classname in case of dynamic gravity
$tip[0].className = 'tipsy '; // reset classname in case of dynamic gravity
$tip.openerpClass('oe_tooltip');
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
var pos = $.extend({}, this.$element.offset(), {

View File

@ -48,7 +48,7 @@ instance.web.Notification = instance.web.Widget.extend({
*/
instance.web.dialog = function(element) {
var result = element.dialog.apply(element, _.rest(_.toArray(arguments)));
result.dialog("widget").addClass("openerp");
result.dialog("widget").openerpClass();
return result;
};
@ -983,6 +983,7 @@ instance.web.Client = instance.web.Widget.extend({
return instance.session.session_bind(this.origin).then(function() {
var $e = $(QWeb.render(self._template, {}));
self.replaceElement($e);
$e.openerpClass();
self.bind_events();
return self.show_common();
});

View File

@ -460,6 +460,16 @@ $.fn.getAttributes = function() {
}
return o;
}
$.fn.openerpClass = function(additionalClass) {
// This plugin should be applied on top level elements
additionalClass = additionalClass || '';
if (!!$.browser.msie) {
additionalClass += ' openerp_ie';
}
return this.each(function() {
$(this).addClass('openerp ' + additionalClass);
});
};
/** Jquery extentions */
$.Mutex = (function() {

View File

@ -3122,7 +3122,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
minLength: 0,
delay: 0
});
this.$input.autocomplete("widget").addClass("openerp");
this.$input.autocomplete("widget").openerpClass();
// used to correct a bug when selecting an element by pushing 'enter' in an editable list
this.$input.keyup(function(e) {
if (e.which === 13) { // ENTER