Merge pull request #1113 from umbraco/temp-U4-7936

U4-7936 Clicking the Recycle Bin shows "Session expired" login screen
This commit is contained in:
Sebastiaan Janssen
2016-02-11 15:48:24 +01:00
9 changed files with 121 additions and 46 deletions

View File

@@ -42,6 +42,15 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
return {
getRecycleBin: function() {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"contentApiBaseUrl",
"GetRecycleBin")),
'Failed to retrieve data for content recycle bin');
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#sort

View File

@@ -22,6 +22,15 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
return {
getRecycleBin: function () {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"mediaApiBaseUrl",
"GetRecycleBin")),
'Failed to retrieve data for media recycle bin');
},
/**
* @ngdoc method
* @name umbraco.resources.mediaResource#sort

View File

@@ -8,7 +8,7 @@
*
*/
function ContentRecycleBinController($scope, $routeParams, dataTypeResource, navigationService, localizationService) {
function ContentRecycleBinController($scope, $routeParams, contentResource, navigationService, localizationService) {
//ensures the list view doesn't actually load until we query for the list view config
// for the section
@@ -16,17 +16,23 @@ function ContentRecycleBinController($scope, $routeParams, dataTypeResource, nav
$scope.page.name = "Recycle Bin";
$scope.page.nameLocked = true;
//ensures the list view doesn't actually load until we query for the list view config
// for the section
$scope.listViewPath = null;
$routeParams.id = "-20";
dataTypeResource.getById(-95).then(function (result) {
_.each(result.preValues, function (i) {
$scope.model.config[i.key] = i.value;
contentResource.getRecycleBin().then(function (result) {
//we'll get the 'content item' for the recycle bin, we know that it will contain a single tab and a
// single property, so we'll extract that property (list view) and use it's data.
var listproperty = result.tabs[0].properties[0];
_.each(listproperty.config, function (val, key) {
$scope.model.config[key] = val;
});
$scope.listViewPath = 'views/propertyeditors/listview/listview.html';
});
$scope.model = { config: { entityType: $routeParams.section } };
$scope.model = { config: { entityType: $routeParams.section, layouts: [] } };
// sync tree node
navigationService.syncTree({ tree: "content", path: ["-1", $routeParams.id], forceReload: false });
@@ -35,11 +41,11 @@ function ContentRecycleBinController($scope, $routeParams, dataTypeResource, nav
function localizePageName() {
var pageName = "general_recycleBin";
var pageName = "general_recycleBin";
localizationService.localize(pageName).then(function(value) {
$scope.page.name = value;
});
localizationService.localize(pageName).then(function (value) {
$scope.page.name = value;
});
}
}

View File

@@ -1,17 +1,16 @@
<umb-editor-view ng-controller="Umbraco.Editors.Content.RecycleBinController">
<form>
<umb-editor-header name="page.name"
name-locked="page.nameLocked"
hide-icon="true"
hide-description="true"
hide-alias="true">
</umb-editor-header>
<umb-editor-header
name="page.name"
name-locked="page.nameLocked"
hide-icon="true"
hide-description="true"
hide-alias="true" >
</umb-editor-header>
<umb-editor-container>
<umb-editor-container>
<div ng-include="listViewPath"></div>
<div ng-include="listViewPath"></div>
</umb-editor-container>
</umb-editor-view>
</umb-editor-container>
</form>
</umb-editor-view>

View File

@@ -8,8 +8,10 @@
*
*/
function MediaRecycleBinController($scope, $routeParams, dataTypeResource, navigationService, localizationService) {
function MediaRecycleBinController($scope, $routeParams, mediaResource, navigationService, localizationService) {
//ensures the list view doesn't actually load until we query for the list view config
// for the section
$scope.page = {};
$scope.page.name = "Recycle Bin";
$scope.page.nameLocked = true;
@@ -19,14 +21,18 @@ function MediaRecycleBinController($scope, $routeParams, dataTypeResource, navig
$scope.listViewPath = null;
$routeParams.id = "-21";
dataTypeResource.getById(-96).then(function (result) {
_.each(result.preValues, function (i) {
$scope.model.config[i.key] = i.value;
mediaResource.getRecycleBin().then(function (result) {
//we'll get the 'content item' for the recycle bin, we know that it will contain a single tab and a
// single property, so we'll extract that property (list view) and use it's data.
var listproperty = result.tabs[0].properties[0];
_.each(listproperty.config, function (val, key) {
$scope.model.config[key] = val;
});
$scope.listViewPath = 'views/propertyeditors/listview/listview.html';
});
$scope.model = { config: { entityType: $routeParams.section } };
$scope.model = { config: { entityType: $routeParams.section, layouts: [] } };
// sync tree node
navigationService.syncTree({ tree: "media", path: ["-1", $routeParams.id], forceReload: false });
@@ -35,14 +41,13 @@ function MediaRecycleBinController($scope, $routeParams, dataTypeResource, navig
function localizePageName() {
var pageName = "general_recycleBin";
var pageName = "general_recycleBin";
localizationService.localize(pageName).then(function(value) {
$scope.page.name = value;
});
localizationService.localize(pageName).then(function (value) {
$scope.page.name = value;
});
}
}
angular.module('umbraco').controller("Umbraco.Editors.Media.RecycleBinController", MediaRecycleBinController);

View File

@@ -1,17 +1,16 @@
<umb-editor-view ng-controller="Umbraco.Editors.Media.RecycleBinController">
<form>
<umb-editor-header name="page.name"
name-locked="page.nameLocked"
hide-icon="true"
hide-description="true"
hide-alias="true">
</umb-editor-header>
<umb-editor-header
name="page.name"
name-locked="page.nameLocked"
hide-icon="true"
hide-description="true"
hide-alias="true">
</umb-editor-header>
<umb-editor-container>
<umb-editor-container>
<div ng-include="listViewPath"></div>
</umb-editor-container>
<div ng-include="listViewPath"></div>
</umb-editor-container>
</form>
</umb-editor-view>