[IMP] Improved m2o tooltip

bzr revid: fme@openerp.com-20120806140044-mgo3git8zi9xrqbh
This commit is contained in:
Fabien Meghazi 2012-08-06 16:00:44 +02:00
parent 6b8c1d2828
commit 0cecacd43e
5 changed files with 43 additions and 2 deletions

View File

@ -602,6 +602,19 @@
.openerp.oe_tooltip .oe_tooltip_technical_title { .openerp.oe_tooltip .oe_tooltip_technical_title {
font-weight: bold; font-weight: bold;
} }
.openerp.oe_tooltip .oe_tooltip_close {
margin: -5px 0 0 2px;
cursor: default;
float: right;
color: white;
}
.openerp.oe_tooltip .oe_tooltip_close:hover {
color: #999999;
cursor: pointer;
}
.openerp.oe_tooltip .oe_tooltip_message {
max-width: 310px;
}
.openerp .oe_notebook { .openerp .oe_notebook {
margin: 8px 0; margin: 8px 0;
padding: 0 16px; padding: 0 16px;

View File

@ -469,6 +469,16 @@ $sheet-max-width: 860px
list-style: circle list-style: circle
.oe_tooltip_technical_title .oe_tooltip_technical_title
font-weight: bold font-weight: bold
.oe_tooltip_close
margin: -5px 0 0 2px
cursor: default
float: right
color: white
&:hover
color: #999
cursor: pointer
.oe_tooltip_message
max-width: 310px
// }}} // }}}
// Notebook {{{ // Notebook {{{
.oe_notebook .oe_notebook

View File

@ -979,6 +979,7 @@ instance.web.Client = instance.web.Widget.extend({
}, 0); }, 0);
}); });
instance.web.bus.on('click', this, function(ev) { instance.web.bus.on('click', this, function(ev) {
$.fn.tipsy.clear();
if (!$(ev.target).is('input[type=file]')) { if (!$(ev.target).is('input[type=file]')) {
self.$element.find('.oe_dropdown_menu.oe_opened').removeClass('oe_opened'); self.$element.find('.oe_dropdown_menu.oe_opened').removeClass('oe_opened');
} }

View File

@ -2711,10 +2711,20 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
self.$input.tipsy({ self.$input.tipsy({
title: function() { title: function() {
return "No element was selected, you should create or select one from the dropdown list."; return QWeb.render('Tipsy.alert', {
message: "No element was selected, you should create or select one from the dropdown list."
});
}, },
trigger:'manual', trigger:'manual',
fade: true, fade: true,
gravity: 's',
html: true,
opacity: 1,
offset: 4,
});
self.$input.on('focus', function() {
self.$input.tipsy("hide");
}); });
this.$drop_down = this.$element.find(".oe_m2o_drop_down_button"); this.$drop_down = this.$element.find(".oe_m2o_drop_down_button");
@ -2768,7 +2778,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
var tip_def = $.Deferred(); var tip_def = $.Deferred();
var untip_def = $.Deferred(); var untip_def = $.Deferred();
var tip_delay = 200; var tip_delay = 200;
var tip_duration = 3000; var tip_duration = 15000;
var anyoneLoosesFocus = function() { var anyoneLoosesFocus = function() {
var used = false; var used = false;
if (self.floating) { if (self.floating) {

View File

@ -25,6 +25,13 @@
</div> </div>
</div> </div>
</t> </t>
<t t-name="Tipsy.alert">
<a class="oe_tooltip_close oe_e">[</a>
<span style="float:left; margin:2px 5px 0 0;" class="ui-icon ui-icon-alert ui-state-error"></span>
<div class="oe_tooltip_message">
<t t-esc="message"/>
</div>
</t>
<t t-name="CrashManager.warning"> <t t-name="CrashManager.warning">
<table cellspacing="0" cellpadding="0" border="0" class="oe_dialog_warning"> <table cellspacing="0" cellpadding="0" border="0" class="oe_dialog_warning">