working on U4-4011 Package installation will require either a full app refresh or we will need to re-lazy load in all of the assets but unfortunately we cannot lazy load in things like directives as angular doesn't like that, we have to re-load the browser.
This commit is contained in:
@@ -364,6 +364,12 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
|
||||
getRootScope().$emit("app.closeDialogs", undefined);
|
||||
}
|
||||
},
|
||||
/* This is used for the package installer to call in order to reload all app assets so we don't have to reload the window */
|
||||
_packageInstalled: function() {
|
||||
var injector = getRootInjector();
|
||||
var packageHelper = injector.get("packageHelper");
|
||||
packageHelper.packageInstalled();
|
||||
},
|
||||
_debug: function(strMsg) {
|
||||
if (this._isDebug) {
|
||||
Sys.Debug.trace("UmbClientMgr: " + strMsg);
|
||||
|
||||
@@ -65,6 +65,11 @@ function sectionsDirective($timeout, $window, navigationService, treeService, se
|
||||
scope.currentSection = args.value;
|
||||
}
|
||||
});
|
||||
|
||||
eventsService.on("app.reInitialize", function (e, args) {
|
||||
//re-load the sections if we're re-initializing (i.e. package installed)
|
||||
loadSections();
|
||||
});
|
||||
|
||||
//on page resize
|
||||
window.onresize = calculateHeight;
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
* </pre>
|
||||
*/
|
||||
angular.module('umbraco.services')
|
||||
.factory('assetsService', function ($q, $log, angularHelper, umbRequestHelper, $rootScope) {
|
||||
.factory('assetsService', function ($q, $log, angularHelper, umbRequestHelper, $rootScope, $http) {
|
||||
|
||||
var initAssetsLoaded = false;
|
||||
|
||||
@@ -71,6 +71,23 @@ angular.module('umbraco.services')
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
/** Internal method. This is used after installing a package to reload the application assets so we don't have to reload the whole window */
|
||||
_reloadApplicationAssets: function() {
|
||||
|
||||
umbRequestHelper.resourcePromise(
|
||||
$http.get(umbRequestHelper.getApiUrl("manifestAssetList", "", "")),
|
||||
'Failed to get manifest list').then(function(data) {
|
||||
|
||||
//ok so we have the list of assets, now we'll use yepnope to go get them. Anything that is already loaded should remain loaded
|
||||
// and this should just load anything that is newly installed.
|
||||
|
||||
yepnope({
|
||||
load: data
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.assetsService#loadCss
|
||||
|
||||
@@ -65,7 +65,7 @@ function eventsService($q, $rootScope) {
|
||||
return $rootScope.$on(name, callback);
|
||||
},
|
||||
|
||||
/** pass in the result of subscribe to this method, or just call the method returned from subscribe to unsubscribe */
|
||||
/** pass in the result of 'on' to this method, or just call the method returned from 'on' to unsubscribe */
|
||||
unsubscribe: function(handle) {
|
||||
if (angular.isFunction(handle)) {
|
||||
handle();
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
/*Contains multiple services for various helper tasks */
|
||||
|
||||
function packageHelper(assetsService, treeService, eventsService) {
|
||||
|
||||
return {
|
||||
|
||||
/** Called when a package is installed, this resets a bunch of data and ensures the new package assets are loaded in */
|
||||
packageInstalled: function () {
|
||||
assetsService._reloadApplicationAssets();
|
||||
treeService.clearCache();
|
||||
//send event
|
||||
eventsService.emit("app.reInitialize");
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
angular.module('umbraco.services').factory('packageHelper', packageHelper);
|
||||
|
||||
function umbPhotoFolderHelper($compile, $log, $timeout, $filter, imageHelper, umbRequestHelper) {
|
||||
return {
|
||||
/** sets the image's url - will check if it is a folder or a real image */
|
||||
|
||||
Reference in New Issue
Block a user