Fix basket tooltip display

This commit is contained in:
Romain Neutron
2012-02-17 13:19:23 +01:00
parent 153c43fd09
commit 9889ac720e
3 changed files with 65 additions and 64 deletions

View File

@@ -1,5 +1,5 @@
{% import 'common/thumbnail.html' as thumbnail %} {% import 'common/thumbnail.html' as thumbnail %}
<div style="margin:5px;width:280px;height:300px;position:relative;"> <div class="noToolTipResize" style="margin:5px;width:280px;height:300px;position:relative;">
<div> <div>
<span style="font-weight:bold;font-size:14px;"> <span style="font-weight:bold;font-size:14px;">
{{ basket.getName() }} {{ basket.getName() }}
@@ -15,13 +15,15 @@
{{ nb_records }} records {{ nb_records }} records
{% endtrans %} {% endtrans %}
- {{ date }} - {{ date }}
<hr/> <hr/>
<div style="position:relative;float:left;width:270px;"> <div style="position:relative;float:left;width:270px;">
{% for element in basket.getElements() %} {% for element in basket.getElements() %}
{% if loop.index <= 9 %} {% if loop.index <= 9 %}
<div style="margin:5px;position:relative;float:left;width:80px;height:80px;overflow:hidden;"> <div style="margin:5px;position:relative;float:left;width:80px;height:80px;overflow:hidden;">
{{ thumbnail.format(element.getRecord().get_thumbnail(), 80, 80 , '', session) }} {{ thumbnail.format(element.getRecord().get_thumbnail(), 80, 80 , '', session) }}
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div>
</div> </div>
</div>

View File

@@ -1,5 +1,5 @@
{% import 'common/thumbnail.html' as thumbnail %} {% import 'common/thumbnail.html' as thumbnail %}
<div style="margin:5px;width:280px;height:300px;position:relative;"> <div class="noToolTipResize" style="margin:5px;width:280px;height:300px;position:relative;">
<div> <div>
<span style="font-weight:bold;font-size:14px;"> <span style="font-weight:bold;font-size:14px;">
{{ Story.get_title() }} {{ Story.get_title() }}
@@ -15,13 +15,15 @@
{{ nb_records }} records {{ nb_records }} records
{% endtrans %} {% endtrans %}
- {{ date }} - {{ date }}
<hr/> <hr/>
<div style="position:relative;float:left;width:270px;"> <div style="position:relative;float:left;width:270px;">
{% for element in Story.get_children().get_elements() %} {% for element in Story.get_children().get_elements() %}
{% if loop.index <= 9 %} {% if loop.index <= 9 %}
<div style="margin:5px;position:relative;float:left;width:80px;height:80px;overflow:hidden;"> <div style="margin:5px;position:relative;float:left;width:80px;height:80px;overflow:hidden;">
{{ thumbnail.format(element.get_thumbnail(), 80, 80 , '', session) }} {{ thumbnail.format(element.get_thumbnail(), 80, 80 , '', session) }}
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div>
</div> </div>
</div>

View File

@@ -7,14 +7,14 @@
* Copyright (c) 2006 - 2008 J<>rn Zaefferer * Copyright (c) 2006 - 2008 J<>rn Zaefferer
* *
* $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $ * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
* *
* Dual licensed under the MIT and GPL licenses: * Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
*/ */
(function($) { (function($) {
// the tooltip element // the tooltip element
var helper = {}, var helper = {},
// the title of the current element, used for restoring // the title of the current element, used for restoring
@@ -25,7 +25,7 @@
IE = $.browser.msie && (/MSIE\s(5\.5|6\.)/).test(navigator.userAgent), IE = $.browser.msie && (/MSIE\s(5\.5|6\.)/).test(navigator.userAgent),
// flag for mouse tracking // flag for mouse tracking
track = false; track = false;
$.tooltip = { $.tooltip = {
blocked: false, blocked: false,
ajaxTimeout : false, ajaxTimeout : false,
@@ -71,7 +71,7 @@
}); });
} }
}; };
$.fn.extend({ $.fn.extend({
tooltip: function(settings) { tooltip: function(settings) {
settings = $.extend({}, $.tooltip.defaults, settings); settings = $.extend({}, $.tooltip.defaults, settings);
@@ -131,7 +131,7 @@
return this.attr('href') || this.attr('src'); return this.attr('href') || this.attr('src');
} }
}); });
function createHelper(settings) { function createHelper(settings) {
// there can be only one tooltip helper // there can be only one tooltip helper
if( helper.parent ) if( helper.parent )
@@ -142,7 +142,7 @@
.appendTo(document.body) .appendTo(document.body)
// hide it at first // hide it at first
.hide(); .hide();
// apply bgiframe if available // apply bgiframe if available
if ( $.fn.bgiframe ) if ( $.fn.bgiframe )
helper.parent.bgiframe(); helper.parent.bgiframe();
@@ -152,11 +152,11 @@
helper.body = $('div.body', helper.parent); helper.body = $('div.body', helper.parent);
helper.url = $('div.url', helper.parent); helper.url = $('div.url', helper.parent);
} }
function settings(element) { function settings(element) {
return $.data(element, "tooltip"); return $.data(element, "tooltip");
} }
// main event handler to start showing tooltips // main event handler to start showing tooltips
function handle(event) { function handle(event) {
@@ -169,15 +169,15 @@
else else
visible(); visible();
show(); show();
// if selected, update the helper position when the mouse moves // if selected, update the helper position when the mouse moves
track = !!settings(this).track; track = !!settings(this).track;
$(document.body).bind('mousemove', update); $(document.body).bind('mousemove', update);
// update at least once // update at least once
update(event); update(event);
} }
// save elements title before the tooltip is displayed // save elements title before the tooltip is displayed
function save(event) { function save(event) {
// if this is the current source, or it has no title (occurs with click event), stop // if this is the current source, or it has no title (occurs with click event), stop
@@ -192,7 +192,7 @@
// save current // save current
$.tooltip.current = this; $.tooltip.current = this;
title = this.tooltipText; title = this.tooltipText;
// if ( settings(this).bodyHandler ) { // if ( settings(this).bodyHandler ) {
// helper.title.hide(); // helper.title.hide();
// var bodyContent = settings(this).bodyHandler.call(this); // var bodyContent = settings(this).bodyHandler.call(this);
@@ -215,13 +215,13 @@
// } else { // } else {
// helper.body.html(title).show(); // helper.body.html(title).show();
// } // }
// if element has href or src, add and show it, otherwise hide it // if element has href or src, add and show it, otherwise hide it
if( settings(this).showURL && $(this).url() ) if( settings(this).showURL && $(this).url() )
helper.url.html( $(this).url().replace('http://', '') ).show(); helper.url.html( $(this).url().replace('http://', '') ).show();
else else
helper.url.hide(); helper.url.hide();
// add an optional class for this tip // add an optional class for this tip
// helper.parent.addClass(settings(this).extraClass); // helper.parent.addClass(settings(this).extraClass);
if(this.ajaxLoad) if(this.ajaxLoad)
@@ -251,8 +251,11 @@
var width = 'auto'; var width = 'auto';
var height = 'auto'; var height = 'auto';
var ratio = 1; var ratio = 1;
var resizeImgTips = false;
var $imgTips = $('#' + settings($.tooltip.current).id + ' .imgTips'); var $imgTips = $('#' + settings($.tooltip.current).id + ' .imgTips');
if ($imgTips[0]) {
if ($imgTips[0] && $('#' + settings($.tooltip.current).id + ' .noToolTipResize').length === 0) {
resizeImgTips = true;
width = parseInt($imgTips[0].style.width); width = parseInt($imgTips[0].style.width);
height = parseInt($imgTips[0].style.height); height = parseInt($imgTips[0].style.height);
ratio = width/height; ratio = width/height;
@@ -325,7 +328,7 @@
//correction par ratio //correction par ratio
if ($('#' + settings($.tooltip.current).id + ' .imgTips')[0]) { if (resizeImgTips && $('#' + settings($.tooltip.current).id + ' .imgTips')[0]) {
if(ratioSurfaceH > ratioImage) if(ratioSurfaceH > ratioImage)
{ {
@@ -403,7 +406,7 @@
//si ya une image on re-ajuste au ratio //si ya une image on re-ajuste au ratio
if ($('#' + settings($.tooltip.current).id + ' .imgTips')[0]) { if (resizeImgTips && $('#' + settings($.tooltip.current).id + ' .imgTips')[0]) {
if(width == 'auto') if(width == 'auto')
width = $('#' + settings($.tooltip.current).id).width(); width = $('#' + settings($.tooltip.current).id).width();
if(height == 'auto') if(height == 'auto')
@@ -439,20 +442,14 @@
top: top top: top
}); });
$imgTips.css({ if(resizeImgTips)
width: width, {
height: height $imgTips.css({
// , width: width,
// left: left, height: height
// top: top });
}); }
// if($imgTips.size() > 0)
// {
// $('#' + settings($.tooltip.current).id).image_enhance('destroy').image_enhance({
// zoomable:true
// });
// }
} }
} }
@@ -463,7 +460,7 @@
// delete timeout and show helper // delete timeout and show helper
function show() { function show() {
tID = null; tID = null;
if ((!IE || !$.fn.bgiframe) && settings($.tooltip.current).fade) { if ((!IE || !$.fn.bgiframe) && settings($.tooltip.current).fade) {
if (helper.parent.is(":animated")) if (helper.parent.is(":animated"))
helper.parent.stop().show().fadeTo(settings($.tooltip.current).fade, 100); helper.parent.stop().show().fadeTo(settings($.tooltip.current).fade, 100);
@@ -474,7 +471,7 @@
} }
update(); update();
} }
function fix(event) function fix(event)
{ {
if(!settings(this).fixable) if(!settings(this).fixable)
@@ -489,21 +486,21 @@
$('#tooltip .tooltip_closer').show(); $('#tooltip .tooltip_closer').show();
$.tooltip.blocked = true; $.tooltip.blocked = true;
} }
function visible(){ function visible(){
$.tooltip.visible = true; $.tooltip.visible = true;
helper.parent.css({ helper.parent.css({
visibility:'visible' visibility:'visible'
}); });
} }
/** /**
* callback for mousemove * callback for mousemove
* updates the helper position * updates the helper position
* removes itself when no current element * removes itself when no current element
*/ */
function update(event) { function update(event) {
if($.tooltip.blocked) if($.tooltip.blocked)
return; return;
@@ -515,7 +512,7 @@
if ( !track && helper.parent.is(":visible")) { if ( !track && helper.parent.is(":visible")) {
$(document.body).unbind('mousemove', update); $(document.body).unbind('mousemove', update);
} }
// if no current element is available, remove this listener // if no current element is available, remove this listener
if( $.tooltip.current === null ) { if( $.tooltip.current === null ) {
$(document.body).unbind('mousemove', update); $(document.body).unbind('mousemove', update);
@@ -524,7 +521,7 @@
// remove position helper classes // remove position helper classes
helper.parent.removeClass("viewport-right").removeClass("viewport-bottom"); helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");
if(!settings($.tooltip.current).outside) if(!settings($.tooltip.current).outside)
{ {
var left = helper.parent[0].offsetLeft; var left = helper.parent[0].offsetLeft;
@@ -546,7 +543,7 @@
top: top top: top
}); });
} }
var v = viewport(), var v = viewport(),
h = helper.parent[0]; h = helper.parent[0];
// check horizontal position // check horizontal position
@@ -565,17 +562,17 @@
} }
} }
} }
function viewport() { function viewport() {
return { return {
x: $(window).width(), x: $(window).width(),
y: $(window).height(), y: $(window).height(),
cx: 0, cx: 0,
cy: 0 cy: 0
}; };
} }
// hide helper and restore added classes and the title // hide helper and restore added classes and the title
function hide(event) function hide(event)
{ {
@@ -603,11 +600,11 @@
helper.parent.stop().fadeOut(tsettings.fade, complete); helper.parent.stop().fadeOut(tsettings.fade, complete);
} else } else
complete(); complete();
if( tsettings.fixPNG ) if( tsettings.fixPNG )
helper.parent.unfixPNG(); helper.parent.unfixPNG();
} }
})(jQuery); })(jQuery);
function unfix_tooltip() function unfix_tooltip()