From 548f9fd01fcc278becb520e67eef7a3dc5189d59 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 8 Feb 2017 15:02:03 +0100 Subject: [PATCH] open mini list view before children are loaded --- .../components/umbminilistview.directive.js | 35 +++++-------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbminilistview.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbminilistview.directive.js index 631004e218..8e5fa8cee2 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbminilistview.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbminilistview.directive.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - function MiniListViewDirective($q, contentResource, memberResource, mediaResource, entityResource) { + function MiniListViewDirective(contentResource, memberResource, mediaResource, entityResource) { function link(scope, el, attr, ctrl) { @@ -33,23 +33,15 @@ } }; - // start loading animation on node - node.loading = true; + // clear and push mini list view in dom so we only render 1 view + scope.miniListViews = []; + scope.miniListViews.push(miniListView); - getChildrenForMiniListView(miniListView) - .then(function (data) { + // store in history so we quickly can navigate back + miniListViewsHistory.push(miniListView); - // stop loading animation on node - node.loading = false; - - // clear and push mini list view in dom so we only render 1 view - scope.miniListViews = []; - scope.miniListViews.push(miniListView); - - // store in history so we quickly can navigate back - miniListViewsHistory.push(miniListView); - - }); + // get children + getChildrenForMiniListView(miniListView); // get ancestors getAncestors(node); @@ -58,9 +50,6 @@ function getChildrenForMiniListView(miniListView) { - // setup promise - var deferred = $q.defer(); - // start loading animation list view miniListView.loading = true; @@ -77,22 +66,14 @@ resource(miniListView.node.id, miniListView.pagination) .then(function (data) { - // update children miniListView.children = data.items; - // update pagination miniListView.pagination.totalItems = data.totalItems; miniListView.pagination.totalPages = data.totalPages; - // stop load indicator miniListView.loading = false; - - deferred.resolve(data); }); - - return deferred.promise; - } scope.openNode = function(event, node) {