Author: sevein
Date: Mon Aug 13 15:40:19 2012
New Revision: 12085
Log:
Make sure that the popovers have always title and content values to show,
better calculation of content position to make sure that the popover shows up
only when it is necessary.
Modified:
trunk/js/treeView.js
trunk/lib/helper/QubitHelper.php
Modified: trunk/js/treeView.js
==============================================================================
--- trunk/js/treeView.js Mon Aug 13 14:25:12 2012 (r12084)
+++ trunk/js/treeView.js Mon Aug 13 15:40:19 2012 (r12085)
@@ -206,43 +206,12 @@
mouseenter: function (e)
{
var $li = 'LI' === e.target.tagName ? $(e.target) :
$(e.target).closest('li');
- var anchor = $li.children('a');
- var level = $li.children('strong.levelOfDescription');
- var publicationStatus = $li.children('strong.publicationStatus');
+ var $anchor = $li.children('a');
- // Do nothing if anchor is not collapsed
- if (anchor.width() + level.width() <= $li.width() - 5)
+ // Stop execution if the popover is not worth it
+ if (($li.offset().left + $li.width()) >= ($anchor.offset().left +
$anchor.width()))
{
- return this;
- }
-
- // If data['content'] does not exist...
- if (typeof $li.data('content') === 'undefined')
- {
- $li.data('content', anchor.attr('title'));
-
- var title = '';
-
- if (level.text())
- {
- title += level.text();
- }
-
- if (publicationStatus.text())
- {
- if (title.length)
- {
- title += " ";
- }
-
- title += publicationStatus.text();
- }
-
- $li.data('title', title);
-
- // Remove HTML title attribute so the browser won't show its
- // native tooltip
- anchor.removeAttr('title');
+ return;
}
$li.popover({ placement: (window.innerWidth -
this.$element.offset().left < 550) ? 'left' : 'right' });
Modified: trunk/lib/helper/QubitHelper.php
==============================================================================
--- trunk/lib/helper/QubitHelper.php Mon Aug 13 14:25:12 2012 (r12084)
+++ trunk/lib/helper/QubitHelper.php Mon Aug 13 15:40:19 2012 (r12085)
@@ -185,6 +185,19 @@
$node .= ' data-xhr-location="'.$options['xhr-location'].'"';
}
+ if ($item instanceof QubitInformationObject)
+ {
+ $node .= ' data-title="'.esc_entities(implode(array(
+ $item->levelOfDescription,
+ "({$item->getPublicationStatus()->__toString()})"), ' ')).'"';
+ }
+ else if ($item instanceof QubitTerm)
+ {
+ $node .= ' data-title="'.sfConfig::get('app_ui_label_term').'"';
+ }
+
+ $node .= '
data-content="'.esc_entities(render_title($item->__toString())).'"';
+
// Close tag
$node .= '>';
@@ -223,7 +236,7 @@
$title .= $item->title;
// Add link
- $node .= link_to(render_title($title), array($item, 'module' =>
'informationobject'));
+ $node .= link_to(render_title($title), array($item, 'module' =>
'informationobject'), array('title' => null));
}
else if ($item instanceof QubitTerm)
{
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.