Skip to content

Commit

Permalink
Merge pull request #22 from nick-denry/master
Browse files Browse the repository at this point in the history
Update selected file data after renaming
  • Loading branch information
Le Phuong authored Mar 7, 2018
2 parents d63bcec + 2be2e64 commit 5409557
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/web/js/roxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,14 @@ $(document).on("click", "#file-rename .btn-submit", function() {
var modal = $("#file-rename");
modal.find("input[name='file']").val(response.data.name);
modal.modal('hide');
$(".file-list-item").find('.selected').find('.file-name').find('span').text(response.data.name);
var selectedFile = $(".file-list-item").find('.selected');
selectedFile.find('.file-name').find('span').text(response.data.name);
var currentUrl = selectedFile.data('url');
var newUrl = currentUrl.substring(0, currentUrl.lastIndexOf("/") + 1)+response.data.name;
selectedFile.data('title', response.data.name);
selectedFile.data('url', newUrl);
selectedFile.find('img').data('original', newUrl).attr('src', newUrl);
$(".btn-file-download").attr('href', newUrl);
} else {
alert(response.message);
}
Expand Down Expand Up @@ -713,4 +720,4 @@ function closeDialog(dialog) {
parent.$('#' + modalId).modal('hide');
break;
}
}
}

0 comments on commit 5409557

Please sign in to comment.