[BUGFIX] Check for data-description in CSH 18/38118/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Tue, 24 Mar 2015 16:38:17 +0000 (17:38 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 26 Mar 2015 20:41:35 +0000 (21:41 +0100)
Check for data-description in CSH manual before sending a request to
the server.

Resolves: #65928
Releases: master
Change-Id: I6c8e8024253c8f73e0e2852c06cf7504c070a26e
Reviewed-on: http://review.typo3.org/38118
Reviewed-by: Frank Nägler <typo3@naegler.net>
Tested-by: Frank Nägler <typo3@naegler.net>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js

index 9ac191d..59fe557 100644 (file)
@@ -51,8 +51,15 @@ define('TYPO3/CMS/Backend/ContextHelp', ['jquery', 'TYPO3/CMS/Backend/Popover'],
                TYPO3.Popover.popover($element);
 
                $(document).on('show.bs.popover', ContextHelp.selector, function(evt) {
-                       if ($(this).attr('data-loaded') === 'false' && $(this).data('table')) {
-                               ContextHelp.loadHelp($(this));
+                       var $me = $(this),
+                               description = $me.data('description');
+                       if (typeof description !== 'undefined' && description !== '') {
+                               TYPO3.Popover.setOptions($me, {
+                                       title: $me.data('title'),
+                                       content: description
+                               });
+                       } else if ($me.attr('data-loaded') === 'false' && $me.data('table')) {
+                               ContextHelp.loadHelp($me);
                        }
                });
                $(document).on('shown.bs.popover', ContextHelp.selector, function(evt) {
@@ -62,9 +69,10 @@ define('TYPO3/CMS/Backend/ContextHelp', ['jquery', 'TYPO3/CMS/Backend/Popover'],
                        }
                });
                $(document).on('click', '.tipIsLinked', function(e) {
+                       var $me = $(this);
                        $('.popover').each(function() {
-                               if ($(this).has(e.target).length) {
-                                       ContextHelp.showHelpPopup($(this).data('bs.popover').$element);
+                               if ($me.has(e.target).length) {
+                                       ContextHelp.showHelpPopup($me.data('bs.popover').$element);
                                }
                        });
                });
@@ -122,8 +130,8 @@ define('TYPO3/CMS/Backend/ContextHelp', ['jquery', 'TYPO3/CMS/Backend/Popover'],
                                var title = data.title || '';
                                var content = data.content || '<p></p>';
                                TYPO3.Popover.setOptions($trigger, {
-                                       'title': title,
-                                       'content': content
+                                       title: title,
+                                       content: content
                                });
                                $trigger
                                        .attr('data-loaded', 'true')