Ensured that the default container options are used if no configuration has been defined

This commit is contained in:
AndyButland
2014-07-27 14:40:55 +02:00
parent df04a90698
commit ef2c7e2d3a
2 changed files with 18 additions and 8 deletions

View File

@@ -29,16 +29,21 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific
items: []
};
// Set default default options (i.e. those if no container configuration has been saved)
$scope.options = {
pageSize: 10,
pageNumber: 1,
filter: '',
orderBy: 'UpdateDate',
orderDirection: "desc"
};
// Retrieve the container configuration for the content type and set options before presenting initial view
contentTypeResource.getContainerConfig($routeParams.id)
.then(function (config) {
$scope.options = {
pageSize: config.pageSize,
pageNumber: 1,
filter: '',
orderBy: 'UpdateDate',
orderDirection: "desc"
};
if (typeof(config.pageSize) !== 'undefined') {
$scope.options.pageSize = config.pageSize;
}
$scope.initView();
});

View File

@@ -41,7 +41,12 @@ namespace Umbraco.Web.Editors
throw new HttpResponseException(HttpStatusCode.NotFound);
}
return JsonConvert.DeserializeObject<ContentTypeContainerConfiguration>(contentItem.ContentType.ContainerConfig);
if (!string.IsNullOrEmpty(contentItem.ContentType.ContainerConfig))
{
return JsonConvert.DeserializeObject<ContentTypeContainerConfiguration>(contentItem.ContentType.ContainerConfig);
}
return null;
}
}
}