tree syncing

This commit is contained in:
perploug
2013-10-07 10:09:03 +02:00
parent f676ce6ac2
commit ec4eeb5de6
5 changed files with 26 additions and 9 deletions

View File

@@ -123,8 +123,7 @@ angular.module("umbraco.directives")
//watch for section changes
scope.$watch("section", function (newVal, oldVal) {
if(!scope.tree){
if(!scope.tree){
loadTree();
}
@@ -141,6 +140,18 @@ angular.module("umbraco.directives")
}
});
//watch for path changes
scope.$watch("path", function (newVal, oldVal) {
if(!scope.tree){
loadTree();
}
if (newVal && newVal !== oldVal) {
//only reload the tree data and Dom if the newval is different from the old one
loadTree();
}
});
//watch for active tree changes
scope.$watch("activetree", function (newVal, oldVal) {

View File

@@ -6,7 +6,7 @@
* @description
* The controller for the content editor
*/
function ContentEditController($scope, $routeParams, $q, $timeout, $window, contentResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, fileManager, editorContextService) {
function ContentEditController($scope, $routeParams, $q, $timeout, $window, contentResource, navigationService, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, fileManager, editorContextService) {
//initialize the file manager
fileManager.clearFiles();
@@ -49,6 +49,8 @@ function ContentEditController($scope, $routeParams, $q, $timeout, $window, cont
newContent: data,
rebindCallback: contentEditingHelper.reBindChangedProperties($scope.content, data)
});
navigationService.syncPath(data.path.split(","));
});
};
@@ -73,6 +75,8 @@ function ContentEditController($scope, $routeParams, $q, $timeout, $window, cont
rebindCallback: contentEditingHelper.reBindChangedProperties($scope.content, data)
});
navigationService.syncPath(data.path.split(","));
}, function (err) {
contentEditingHelper.handleSaveError({
@@ -124,8 +128,9 @@ function ContentEditController($scope, $routeParams, $q, $timeout, $window, cont
rebindCallback: contentEditingHelper.reBindChangedProperties($scope.content, data)
});
deferred.resolve(data);
navigationService.syncPath(data.path.split(","));
deferred.resolve(data);
}, function (err) {
contentEditingHelper.handleSaveError({
err: err,

View File

@@ -339,11 +339,9 @@ namespace Umbraco.Web.Editors
/// attributed with EnsureUserPermissionForContent to verify the user has access to the recycle bin
/// </remarks>
[HttpDelete]
[EnsureUserPermissionForContent(Constants.System.RecycleBinContent)]
/* [EnsureUserPermissionForContent(Constants.System.RecycleBinContent)]*/
public HttpResponseMessage EmptyRecycleBin()
{
//TODO: We need to check if the user is allowed access to the recycle bin!
Services.ContentService.EmptyRecycleBin();
return Request.CreateResponse(HttpStatusCode.OK);
}

View File

@@ -14,7 +14,9 @@ namespace Umbraco.Web.Models.ContentEditing
[DataContract(Name = "content", Namespace = "")]
public class ContentItemDisplay : ContentItemDisplayBase<ContentPropertyDisplay, IContent>
{
[DataMember(Name = "path")]
public string Path { get; set; }
[DataMember(Name = "publishDate")]
public DateTime? PublishDate { get; set; }

View File

@@ -51,6 +51,7 @@ namespace umbraco.BasePages
public static string ReloadContentFrameUrlIfPathLoaded(string url) {
return string.Format(ClientMgrScript + ".reloadContentFrameUrlIfPathLoaded('{0}');", url);
}
public static string ChildNodeCreated = GetMainTree + ".childNodeCreated();";
public static string SyncTree { get { return GetMainTree + ".syncTree('{0}', {1});"; } }
public static string ClearTreeCache { get { return GetMainTree + ".clearTreeCache();"; } }
@@ -240,7 +241,7 @@ namespace umbraco.BasePages
/// </example>
public ClientTools SyncTree(string path, bool forceReload)
{
//RegisterClientScript(string.Format(Scripts.SyncTree, path, forceReload.ToString().ToLower()));
RegisterClientScript(string.Format(Scripts.SyncTree, path, forceReload.ToString().ToLower()));
return this;
}