Merge pull request #6664 from umbraco/v8/bug/6663-lang-variant-deletion
Language variant deletion
This commit is contained in:
@@ -225,8 +225,10 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
retainQueryStrings: function (currRouteParams, nextRouteParams) {
|
||||
var toRetain = angular.copy(nextRouteParams);
|
||||
var updated = false;
|
||||
|
||||
_.each(retainedQueryStrings, function (r) {
|
||||
if (currRouteParams[r] && !nextRouteParams[r]) {
|
||||
// if mculture is set to null in nextRouteParams, the value will be undefined and we will not retain any query string that has a value of "null"
|
||||
if (currRouteParams[r] && nextRouteParams[r] !== undefined && !nextRouteParams[r]) {
|
||||
toRetain[r] = currRouteParams[r];
|
||||
updated = true;
|
||||
}
|
||||
|
||||
@@ -212,6 +212,22 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
evts.push(eventsService.on("editors.languages.languageDeleted", function (e, args) {
|
||||
loadLanguages().then(function (languages) {
|
||||
$scope.languages = languages;
|
||||
const defaultCulture = $scope.languages[0].culture;
|
||||
|
||||
if (args.language.culture === $scope.selectedLanguage.culture) {
|
||||
$scope.selectedLanguage = defaultCulture;
|
||||
|
||||
if ($scope.languages.length > 1) {
|
||||
$location.search("mculture", defaultCulture);
|
||||
} else {
|
||||
$location.search("mculture", null);
|
||||
}
|
||||
|
||||
var currentEditorState = editorState.getCurrent();
|
||||
if (currentEditorState && currentEditorState.path) {
|
||||
$scope.treeApi.syncTree({ path: currentEditorState.path, activate: true });
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -255,7 +271,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
evts.push(eventsService.on("treeService.removeNode", function (e, args) {
|
||||
//check to see if the current page has been removed
|
||||
|
||||
var currentEditorState = editorState.getCurrent()
|
||||
var currentEditorState = editorState.getCurrent();
|
||||
if (currentEditorState && currentEditorState.id.toString() === args.node.id.toString()) {
|
||||
//current page is loaded, so navigate to root
|
||||
var section = appState.getSectionState("currentSection");
|
||||
@@ -279,6 +295,9 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
//select the current language if set in the query string
|
||||
if (mainCulture && $scope.languages && $scope.languages.length > 1) {
|
||||
var found = _.find($scope.languages, function (l) {
|
||||
if (mainCulture === true) {
|
||||
return false;
|
||||
}
|
||||
return l.culture.toLowerCase() === mainCulture.toLowerCase();
|
||||
});
|
||||
if (found) {
|
||||
@@ -348,7 +367,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
|
||||
return contentResource.allowsCultureVariation().then(function (b) {
|
||||
if (b === true) {
|
||||
return languageResource.getAll()
|
||||
return languageResource.getAll();
|
||||
} else {
|
||||
return $q.when([]); //resolve an empty collection
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
overlayService.open(dialog);
|
||||
});
|
||||
|
||||
event.preventDefault()
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
|
||||
@@ -212,6 +212,22 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
evts.push(eventsService.on("editors.languages.languageDeleted", function (e, args) {
|
||||
loadLanguages().then(function (languages) {
|
||||
$scope.languages = languages;
|
||||
const defaultCulture = $scope.languages[0].culture;
|
||||
|
||||
if (args.language.culture === $scope.selectedLanguage.culture) {
|
||||
$scope.selectedLanguage = defaultCulture;
|
||||
|
||||
if ($scope.languages.length > 1) {
|
||||
$location.search("mculture", defaultCulture);
|
||||
} else {
|
||||
$location.search("mculture", null);
|
||||
}
|
||||
|
||||
var currentEditorState = editorState.getCurrent();
|
||||
if (currentEditorState && currentEditorState.path) {
|
||||
$scope.treeApi.syncTree({ path: currentEditorState.path, activate: true });
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -255,7 +271,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
evts.push(eventsService.on("treeService.removeNode", function (e, args) {
|
||||
//check to see if the current page has been removed
|
||||
|
||||
var currentEditorState = editorState.getCurrent()
|
||||
var currentEditorState = editorState.getCurrent();
|
||||
if (currentEditorState && currentEditorState.id.toString() === args.node.id.toString()) {
|
||||
//current page is loaded, so navigate to root
|
||||
var section = appState.getSectionState("currentSection");
|
||||
@@ -279,6 +295,9 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
//select the current language if set in the query string
|
||||
if (mainCulture && $scope.languages && $scope.languages.length > 1) {
|
||||
var found = _.find($scope.languages, function (l) {
|
||||
if (mainCulture === true) {
|
||||
return false;
|
||||
}
|
||||
return l.culture.toLowerCase() === mainCulture.toLowerCase();
|
||||
});
|
||||
if (found) {
|
||||
@@ -348,7 +367,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
|
||||
return contentResource.allowsCultureVariation().then(function (b) {
|
||||
if (b === true) {
|
||||
return languageResource.getAll()
|
||||
return languageResource.getAll();
|
||||
} else {
|
||||
return $q.when([]); //resolve an empty collection
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Umbraco.Web.Cache
|
||||
ClearAllIsolatedCacheByEntityType<ILanguage>();
|
||||
|
||||
foreach (var payload in payloads)
|
||||
{
|
||||
{
|
||||
switch (payload.ChangeType)
|
||||
{
|
||||
case LanguageChangeType.Update:
|
||||
@@ -73,7 +73,7 @@ namespace Umbraco.Web.Cache
|
||||
ContentCacheRefresher.RefreshContentTypes(AppCaches); // we need to evict all IContent items
|
||||
//now refresh all nucache
|
||||
var clearContentPayload = new[] { new ContentCacheRefresher.JsonPayload(0, null, TreeChangeTypes.RefreshAll) };
|
||||
ContentCacheRefresher.NotifyPublishedSnapshotService(_publishedSnapshotService, AppCaches, clearContentPayload);
|
||||
ContentCacheRefresher.NotifyPublishedSnapshotService(_publishedSnapshotService, AppCaches, clearContentPayload);
|
||||
}
|
||||
|
||||
// then trigger event
|
||||
|
||||
Reference in New Issue
Block a user