Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fixing model update in list and grid perspective

Ilianbfe0aac56c9d
diff --git a/data/ext/perspectiveGrid/perspectiveUI.js b/data/ext/perspectiveGrid/perspectiveUI.js
index b8f5ba01d..d99c5a812 100644
--- a/data/ext/perspectiveGrid/perspectiveUI.js
+++ b/data/ext/perspectiveGrid/perspectiveUI.js
@@ -638,12 +638,17 @@ console.log("Loading UI for perspectiveDefault");
ExtUI.prototype.removeFileUI = function(filePath) {
console.log("Removing "+filePath+" from UI");
-
+
if(isWin) {
- filePath = filePath.replace("\\","\\\\");
+ filePath = filePath.replace("\\","");
+ $("#"+this.extensionID+"Container button[filepath]").each(function( index ) {
+ if( $( this ).attr("filepath").replace("\\","") == filePath ) {
+ $( this ).remove();
+ }
+ });
+ } else {
+ $("#"+this.extensionID+"Container li[filepath='"+filePath+"']").remove();
}
-
- $("#"+this.extensionID+"Container li[filepath='"+filePath+"']").remove();
};
ExtUI.prototype.updateFileUI = function(oldFilePath, newFilePath) {
@@ -652,11 +657,19 @@ console.log("Loading UI for perspectiveDefault");
fileExt = TSCORE.TagUtils.extractFileExtension(newFilePath),
fileTags = TSCORE.TagUtils.extractTags(newFilePath);
+ var $fileTile = undefined;
+
if(isWin) {
- oldFilePath = oldFilePath.replace("\\","\\\\");
- }
-
- var $fileTile = $("#"+this.extensionID+"Container li[filepath='"+oldFilePath+"']");
+ oldFilePath = oldFilePath.replace("\\","");
+ $("#"+this.extensionID+"Container button[filepath]").each(function( index ) {
+ if( $( this ).attr("filepath").replace("\\","") == oldFilePath ) {
+ var $fileTile = $( this );
+ }
+ });
+ } else {
+ $fileTile = $("#"+this.extensionID+"Container li[filepath='"+oldFilePath+"']");
+ }
+
$fileTile.attr("filepath", newFilePath);
$fileTile.attr("title", newFilePath);
$fileTile.find("p").replaceWith(this.createFileTile(title, newFilePath, fileExt, fileTags));
diff --git a/data/ext/perspectiveList/perspectiveUI.js b/data/ext/perspectiveList/perspectiveUI.js
index 235a369a5..ccbcb48a5 100644
--- a/data/ext/perspectiveList/perspectiveUI.js
+++ b/data/ext/perspectiveList/perspectiveUI.js
@@ -459,10 +459,15 @@ console.log("Loading UI for perspectiveList");
console.log("Removing "+filePath+" from UI");
if(isWin) {
- filePath = filePath.replace("\\","\\\\");
+ filePath = filePath.replace("\\","");
+ $("#"+this.extensionID+"Container button[filepath]").each(function( index ) {
+ if( $( this ).attr("filepath").replace("\\","") == filePath ) {
+ $( this ).parent().parent().remove();
+ }
+ });
+ } else {
+ $("#"+this.extensionID+"Container button[filepath='"+filePath+"']").parent().parent().remove();
}
-
- $("#"+this.extensionID+"Container button[filepath='"+filePath+"']").parent().parent().remove();
};
ExtUI.prototype.updateFileUI = function(oldFilePath, newFilePath) {
@@ -472,11 +477,19 @@ console.log("Loading UI for perspectiveList");
fileExt = TSCORE.TagUtils.extractFileExtension(newFilePath),
fileTags = TSCORE.TagUtils.extractTags(newFilePath);
+ var $fileRow = undefined;
+
if(isWin) {
- oldFilePath = oldFilePath.replace("\\","\\\\");
- }
-
- var $fileRow = $("#"+this.extensionID+"Container button[filepath='"+oldFilePath+"']").parent().parent();
+ oldFilePath = oldFilePath.replace("\\","");
+ $("#"+this.extensionID+"Container button[filepath]").each(function( index ) {
+ if( $( this ).attr("filepath").replace("\\","") == oldFilePath ) {
+ var $fileRow = $( this ).parent().parent();
+ }
+ });
+ } else {
+ $fileRow = $("#"+this.extensionID+"Container button[filepath='"+oldFilePath+"']").parent().parent();
+ }
+
$($fileRow.find("td")[0]).empty().append(buttonizeTitle(title,newFilePath,fileExt));
$($fileRow.find("td")[1]).text(title);
$($fileRow.find("td")[2]).empty().append(TSCORE.generateTagButtons(fileTags,newFilePath));