Load home dashboard faster
[civicrm-core.git] / js / jquery / jquery.dashboard.js
index d1f68bb4e16badc3d23e99def5a6048643ba2cf8..34cfec6109ad94753f0ac9edce9b4fd6fdcadea6 100644 (file)
     // Merge in the caller's options with the defaults.
     var opts = $.extend({}, $.fn.dashboard.defaults, options);
 
-    // Execution 'forks' here and restarts in init().  Tell the user we're busy with a throbber.
-    var throbber = $(opts.throbberMarkup).appendTo(dashboard.element);
-    $.getJSON(opts.ajaxCallbacks.getWidgetsByColumn.url, opts.ajaxCallbacks.getWidgetsByColumn.data, init);
-    asynchronousRequestCounter++;
+    init(opts.widgetsByColumn);
+
     return dashboard;
     // End of constructor and private properties for dashboard object.
 
      * Private methods of dashboard.
      */
 
-    // Ajax callback for getWidgetsByColumn.
-    function init(widgets, status) {
-      asynchronousRequestCounter--;
-      throbber.remove();
+    // Initialize widget columns.
+    function init(widgets) {
       var markup = '<li class="empty-placeholder">' + opts.emptyPlaceholderInner + '</li>';
 
       // Build the dashboard in the DOM.  For each column...
         minimize: {
           description: ts('Collapse or expand'),
           callback: widget.toggleMinimize,
-          icon: 'fa-caret-down',
+          icon: 'fa-caret-down'
         },
         fullscreen: {
           description: ts('View fullscreen'),
           callback: widget.enterFullscreen,
-          icon: 'fa-expand',
+          icon: 'fa-expand'
         },
         close: {
           description: ts('Remove from dashboard'),