From ab5f7d449263a77faf3252da47e8399bad948d8c Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Thu, 22 May 2014 14:48:58 +0200 Subject: [PATCH] Fix PHRAS-123 Fix tooltip content display --- lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php | 10 ++++------ templates/web/prod/Tooltip/Tooltip.html.twig | 4 ++-- www/include/jquery.tooltip.js | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php b/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php index a79a2e394b..6cc8359da3 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php @@ -103,12 +103,10 @@ class Tooltip implements ControllerProviderInterface public function displayPreview(Application $app, $sbas_id, $record_id) { - $record = new \record_adapter($app, $sbas_id, $record_id); - - return $app['twig']->render( - 'prod/Tooltip/Preview.html.twig' - , array('record' => $record, 'not_wrapped' => true) - ); + return $app['twig']->render('prod/Tooltip/Preview.html.twig', array( + 'record' => new \record_adapter($app, $sbas_id, $record_id), + 'not_wrapped' => true + )); } public function displayCaption(Application $app, $sbas_id, $record_id, $context) diff --git a/templates/web/prod/Tooltip/Tooltip.html.twig b/templates/web/prod/Tooltip/Tooltip.html.twig index 95eb856df5..5266e93949 100644 --- a/templates/web/prod/Tooltip/Tooltip.html.twig +++ b/templates/web/prod/Tooltip/Tooltip.html.twig @@ -1,8 +1,8 @@ -
+

- {% if title %} + {% if title is not none %} {{ title }} {% endif %} diff --git a/www/include/jquery.tooltip.js b/www/include/jquery.tooltip.js index 8ddca19495..2aa9ff24d0 100644 --- a/www/include/jquery.tooltip.js +++ b/www/include/jquery.tooltip.js @@ -414,7 +414,7 @@ } if (resizeImgTips) { - var factor = Math.min((width - 45) / width, (height - 75) / height); + var factor = Math.max(Math.min((width - 45) / width, (height - 75) / height), 1); var imgWidth = Math.round(width * factor); var imgHeight = Math.round(height * factor);