Cleanup
authorAlexander Ebert <ebert@woltlab.com>
Mon, 18 May 2015 13:00:34 +0000 (15:00 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 18 May 2015 13:00:34 +0000 (15:00 +0200)
com.woltlab.wcf/templates/headIncludeJavaScript.tpl
wcfsetup/install/files/js/WoltLab/WCF/BootstrapFrontend.js

index 53afea9e25de8ac20f92d7a934b923a5456ff2c9..2112a9c3ffca1d90ccf206aae2ba29381f837400 100644 (file)
                BootstrapFrontend.setup({
                        styleChanger: {if $__wcf->getStyleHandler()->countStyles() > 1}true{else}false{/if}
                });
-               
-               require(['WoltLab/WCF/Controller/Popover'], function(ControllerPopover) {
-                       ControllerPopover.init({
-                               attributeName: 'data-user-id',
-                               className: 'userLink',
-                               identifier: 'com.woltlab.wcf.user',
-                               loadCallback: function(objectId, popover) {
-                                       new WCF.Action.Proxy({
-                                               autoSend: true,
-                                               data: {
-                                                       actionName: 'getUserProfile',
-                                                       className: 'wcf\\data\\user\\UserProfileAction',
-                                                       objectIDs: [ objectId ]
-                                               },
-                                               success: (function(data) {
-                                                       popover.setContent('com.woltlab.wcf.user', objectId, data.returnValues.template);
-                                               }).bind(this),
-                                               failure: (function(data) {
-                                                       // TODO
-                                               }).bind(this)
-                                       });
-                               }
-                       });
-               });
        });
 </script>
 
index 024ea6dd74abf5ddc97f01baffa6af38de3820b2..11762f26db62d13cd574d76c6762f3703ac36260 100644 (file)
@@ -6,7 +6,7 @@
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @module     WoltLab/WCF/BootstrapFrontend
  */
-define(['WoltLab/WCF/Bootstrap', 'WoltLab/WCF/Controller/Sitemap', 'WoltLab/WCF/Controller/Style/Changer'], function(Bootstrap, ControllerSitemap, ControllerStyleChanger) {
+define(['WoltLab/WCF/Bootstrap', 'WoltLab/WCF/Controller/Sitemap', 'WoltLab/WCF/Controller/Style/Changer', 'WoltLab/WCF/Controller/Popover'], function(Bootstrap, ControllerSitemap, ControllerStyleChanger, ControllerPopover) {
        "use strict";
        
        /**
@@ -27,6 +27,35 @@ define(['WoltLab/WCF/Bootstrap', 'WoltLab/WCF/Controller/Sitemap', 'WoltLab/WCF/
                        if (options.styleChanger) {
                                ControllerStyleChanger.setup();
                        }
+                       
+                       this._initUserPopover();
+               },
+               
+               /**
+                * Initializes user profile popover.
+                */
+               _initUserPopover: function() {
+                       ControllerPopover.init({
+                               attributeName: 'data-user-id',
+                               className: 'userLink',
+                               identifier: 'com.woltlab.wcf.user',
+                               loadCallback: function(objectId, popover) {
+                                       new WCF.Action.Proxy({
+                                               autoSend: true,
+                                               data: {
+                                                       actionName: 'getUserProfile',
+                                                       className: 'wcf\\data\\user\\UserProfileAction',
+                                                       objectIDs: [ objectId ]
+                                               },
+                                               success: (function(data) {
+                                                       popover.setContent('com.woltlab.wcf.user', objectId, data.returnValues.template);
+                                               }).bind(this),
+                                               failure: (function(data) {
+                                                       popover.setContent('com.woltlab.wcf.user', objectId, data.returnValues.template);
+                                               }).bind(this)
+                                       });
+                               }
+                       });
                }
        };