Add renamingToName override name for instant apparent renames

This commit is contained in:
James Allen 2018-01-31 09:34:34 +00:00
parent 9721dffbb6
commit aa6c16593e
2 changed files with 8 additions and 6 deletions

View file

@ -110,7 +110,7 @@ script(type='text/ng-template', id='entityListItemTemplate')
i.fa.fa-fw(ng-if="entity.type != 'folder'", ng-class="'fa-' + iconTypeFromName(entity.name)")
span(
ng-hide="entity.renaming"
) {{ entity.name }}
) {{ entity.renamingToName || entity.name }}
span.rename-input
input(
ng-if="permissions.write",
@ -198,7 +198,7 @@ script(type='text/ng-template', id='entityListItemTemplate')
span(
ng-hide="entity.renaming"
) {{ entity.name }}
) {{ entity.renamingToName || entity.name }}
span.rename-input
input(
ng-if="permissions.write",

View file

@ -362,13 +362,15 @@ define [
parent_folder = @getCurrentFolder()
if @existsInThisFolder parent_folder, name
return @nameExistsError()
# We'll wait for the socket.io notification to actually
# do the rename for us.
entity.renamingToName = name
@ide.$http.post("/project/#{@ide.project_id}/#{entity.type}/#{entity.id}/rename", {
name: name,
_csrf: window.csrfToken
}).then () ->
entity.name = name
})
.then () ->
entity.name = name
.finally () ->
entity.renamingToName = null
deleteEntity: (entity, callback = (error) ->) ->
# We'll wait for the socket.io notification to