Update listviews after sorting children
This commit is contained in:
committed by
Sebastiaan Janssen
parent
dc5d418477
commit
b55fdd60e5
@@ -1,7 +1,7 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function ContentSortController($scope, $filter, $routeParams, contentResource, navigationService) {
|
||||
function ContentSortController($scope, $filter, $routeParams, contentResource, navigationService, eventsService) {
|
||||
|
||||
var vm = this;
|
||||
var id = $scope.currentNode.id;
|
||||
@@ -50,6 +50,7 @@
|
||||
navigationService.syncTree({ tree: "content", path: $scope.currentNode.path, forceReload: true })
|
||||
.then(() => navigationService.reloadNode($scope.currentNode));
|
||||
|
||||
eventsService.emit("sortCompleted", { id: id });
|
||||
vm.saveButtonState = "success";
|
||||
}, function(error) {
|
||||
vm.error = error;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function MediaSortController($scope, $filter, mediaResource, navigationService) {
|
||||
function MediaSortController($scope, $filter, mediaResource, navigationService, eventsService) {
|
||||
|
||||
var vm = this;
|
||||
var id = $scope.currentNode.id;
|
||||
@@ -50,6 +50,7 @@
|
||||
navigationService.syncTree({ tree: "media", path: $scope.currentNode.path, forceReload: true })
|
||||
.then(() => navigationService.reloadNode($scope.currentNode));
|
||||
|
||||
eventsService.emit("sortCompleted", { id: id });
|
||||
vm.saveButtonState = "success";
|
||||
}, function(error) {
|
||||
vm.error = error;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function listViewController($scope, $interpolate, $routeParams, $injector, $timeout, currentUserResource, notificationsService, iconHelper, editorState, localizationService, appState, $location, listViewHelper, navigationService, editorService, overlayService, languageResource, mediaHelper) {
|
||||
function listViewController($scope, $interpolate, $routeParams, $injector, $timeout, currentUserResource, notificationsService, iconHelper, editorState, localizationService, appState, $location, listViewHelper, navigationService, editorService, overlayService, languageResource, mediaHelper, eventsService) {
|
||||
|
||||
//this is a quick check to see if we're in create mode, if so just exit - we cannot show children for content
|
||||
// that isn't created yet, if we continue this will use the parent id in the route params which isn't what
|
||||
@@ -838,6 +838,19 @@ function listViewController($scope, $interpolate, $routeParams, $injector, $time
|
||||
$scope.toggleDropdown = toggleDropdown;
|
||||
$scope.leaveDropdown = leaveDropdown;
|
||||
|
||||
// if this listview has sort order in it, make sure it is updated when sorting is performed on the current content
|
||||
if (_.find($scope.options.includeProperties, property => property.alias === "sortOrder")) {
|
||||
var eventSubscription = eventsService.on("sortCompleted", function (e, args) {
|
||||
if (parseInt(args.id) === parseInt($scope.contentId)) {
|
||||
$scope.reloadView($scope.contentId);
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
eventsService.unsubscribe(eventSubscription);
|
||||
});
|
||||
}
|
||||
|
||||
//GO!
|
||||
initView();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user