[IMP] Improved m2o tooltip
authorFabien Meghazi <fme@openerp.com>
Mon, 6 Aug 2012 14:00:44 +0000 (16:00 +0200)
committerFabien Meghazi <fme@openerp.com>
Mon, 6 Aug 2012 14:00:44 +0000 (16:00 +0200)
bzr revid: fme@openerp.com-20120806140044-mgo3git8zi9xrqbh

addons/web/static/src/css/base.css
addons/web/static/src/css/base.sass
addons/web/static/src/js/chrome.js
addons/web/static/src/js/view_form.js
addons/web/static/src/xml/base.xml

index 8f35c81..029b3ef 100644 (file)
 .openerp.oe_tooltip .oe_tooltip_technical_title {
   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 {
   margin: 8px 0;
   padding: 0 16px;
index 688c306..449d76b 100644 (file)
@@ -469,6 +469,16 @@ $sheet-max-width: 860px
                 list-style: circle
         .oe_tooltip_technical_title
             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 {{{
     .oe_notebook
index 694ffc3..503cb33 100644 (file)
@@ -979,6 +979,7 @@ instance.web.Client = instance.web.Widget.extend({
             }, 0);
         });
         instance.web.bus.on('click', this, function(ev) {
+            $.fn.tipsy.clear();
             if (!$(ev.target).is('input[type=file]')) {
                 self.$element.find('.oe_dropdown_menu.oe_opened').removeClass('oe_opened');
             }
index c4e13da..f69bf39 100644 (file)
@@ -2711,10 +2711,20 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
 
         self.$input.tipsy({
             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',
             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");
@@ -2768,7 +2778,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
         var tip_def = $.Deferred();
         var untip_def = $.Deferred();
         var tip_delay = 200;
-        var tip_duration = 3000;
+        var tip_duration = 15000;
         var anyoneLoosesFocus = function() {
             var used = false;
             if (self.floating) {
index c45b2d7..601fe16 100644 (file)
         </div>
     </div>
 </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">
     <table cellspacing="0" cellpadding="0" border="0" class="oe_dialog_warning">