From 6ee867c01b290d055750b8d09a3662f81f63f40f Mon Sep 17 00:00:00 2001 From: perploug Date: Mon, 28 Oct 2013 22:12:27 +0100 Subject: [PATCH] Fixes: U4-2655 double-click to force reload --- .../directives/umbsections.directive.js | 9 +-------- .../common/directives/umbtree.directive.js | 11 ++++++---- .../src/common/services/navigation.service.js | 20 ++++++++++++++----- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbsections.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbsections.directive.js index d215baadc5..a1eb2b06bf 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbsections.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/umbsections.directive.js @@ -16,12 +16,6 @@ function sectionsDirective($timeout, $window, navigationService, treeService, se scope.nav = navigationService; -/* - scope.$watch("currentSection", function (newVal, oldVal) { - scope.currentSection = newVal; - }); -*/ - function loadSections(){ sectionResource.getSections() .then(function (result) { @@ -70,8 +64,7 @@ function sectionsDirective($timeout, $window, navigationService, treeService, se }; scope.sectionDblClick = function(section){ - treeService.clearCache(section.alias); - navigationService.changeSection(section.alias); + navigationService.reloadSection(section.alias); }; scope.trayClick = function(){ diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js index d1ea7f1553..dda5518ed8 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js @@ -68,10 +68,13 @@ angular.module("umbraco.directives") function setupExternalEvents() { if (scope.eventhandler) { - //TODO: This will *never* do anything because we dont cache trees by tree alias!! - // Have changed this to clear all tree cache. - scope.eventhandler.clearCache = function(treeAlias){ - treeService.clearCache(); + scope.eventhandler.clearCache = function(section){ + treeService.clearCache(section); + }; + + scope.eventhandler.load = function(section){ + scope.section = section; + loadTree(); }; scope.eventhandler.syncPath = function(path, forceReload){ diff --git a/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js b/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js index 9e5f767a85..f8b0c8fef6 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js @@ -148,13 +148,16 @@ angular.module('umbraco.services') * and load the dashboard related to the section * @param {string} sectionAlias The alias of the section */ - changeSection: function (sectionAlias) { - if (this.ui.stickyNavigation) { - setMode("default-opensection"); - this.ui.currentSection = sectionAlias; - this.showTree(sectionAlias); + changeSection: function (sectionAlias, force) { + setMode("default-opensection"); + + if(force && this.ui.currentSection === sectionAlias){ + this.ui.currentSection = ""; } + this.ui.currentSection = sectionAlias; + this.showTree(sectionAlias); + $location.path(sectionAlias); }, @@ -283,6 +286,13 @@ angular.module('umbraco.services') } }, + reloadSection: function (sectionAlias) { + if(this.ui.treeEventHandler){ + this.ui.treeEventHandler.clearCache(sectionAlias); + this.ui.treeEventHandler.load(sectionAlias); + } + }, + setActiveTreeType: function (treeAlias) { if(this.ui.treeEventHandler){ this.ui.treeEventHandler.setActiveTreeType(treeAlias);