V8: Fix broken listview pagination when using the back link (#5149)
This commit is contained in:
committed by
Sebastiaan Janssen
parent
32104fff41
commit
e180bb6722
@@ -91,6 +91,10 @@ Use this directive to generate a pagination.
|
||||
function link(scope, el, attr, ctrl) {
|
||||
|
||||
function activate() {
|
||||
// page number is sometimes a string - let's make sure it's an int before we do anything with it
|
||||
if (scope.pageNumber) {
|
||||
scope.pageNumber = parseInt(scope.pageNumber);
|
||||
}
|
||||
|
||||
scope.pagination = [];
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function listViewHelper(localStorageService) {
|
||||
function listViewHelper($location, localStorageService, urlHelper) {
|
||||
|
||||
var firstSelectedIndex = 0;
|
||||
var localStorageKey = "umblistViewLayout";
|
||||
@@ -559,6 +559,32 @@
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.listViewHelper#editItem
|
||||
* @methodOf umbraco.services.listViewHelper
|
||||
*
|
||||
* @description
|
||||
* Method for opening an item in a list view for editing.
|
||||
*
|
||||
* @param {Object} item The item to edit
|
||||
*/
|
||||
function editItem(item) {
|
||||
if (!item.editPath) {
|
||||
return;
|
||||
}
|
||||
var parts = item.editPath.split("?");
|
||||
var path = parts[0];
|
||||
var params = parts[1]
|
||||
? urlHelper.getQueryStringParams("?" + parts[1])
|
||||
: {};
|
||||
|
||||
$location.path(path);
|
||||
for (var p in params) {
|
||||
$location.search(p, params[p])
|
||||
}
|
||||
}
|
||||
|
||||
function isMatchingLayout(id, layout) {
|
||||
// legacy format uses "nodeId", be sure to look for both
|
||||
return layout.id === id || layout.nodeId === id;
|
||||
@@ -579,7 +605,8 @@
|
||||
isSelectedAll: isSelectedAll,
|
||||
setSortingDirection: setSortingDirection,
|
||||
setSorting: setSorting,
|
||||
getButtonPermissions: getButtonPermissions
|
||||
getButtonPermissions: getButtonPermissions,
|
||||
editItem: editItem
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
}
|
||||
|
||||
function goToItem(item, $event, $index) {
|
||||
$location.path($scope.entityType + '/' + $scope.entityType + '/edit/' + item.id);
|
||||
listViewHelper.editItem(item);
|
||||
}
|
||||
|
||||
activate();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function ListViewListLayoutController($scope, listViewHelper, $location, mediaHelper, mediaTypeHelper) {
|
||||
function ListViewListLayoutController($scope, listViewHelper, mediaHelper, mediaTypeHelper, urlHelper) {
|
||||
|
||||
var vm = this;
|
||||
var umbracoSettings = Umbraco.Sys.ServerVariables.umbracoSettings;
|
||||
@@ -53,8 +53,7 @@
|
||||
}
|
||||
|
||||
function clickItem(item) {
|
||||
// if item.id is 2147483647 (int.MaxValue) use item.key
|
||||
$location.path($scope.entityType + '/' + $scope.entityType + '/edit/' + (item.id === 2147483647 ? item.key : item.id));
|
||||
listViewHelper.editItem(item);
|
||||
}
|
||||
|
||||
function isSortDirection(col, direction) {
|
||||
|
||||
Reference in New Issue
Block a user