TagSpaces is an offline, open source, document manager with tagging support
Update UI by file rename and delete
Ilian26eeb3c95b23
diff --git a/data/ext/perspectiveGrid/perspectiveUI.js b/data/ext/perspectiveGrid/perspectiveUI.jsindex cbe092531..c7b6887bf 100644--- a/data/ext/perspectiveGrid/perspectiveUI.js+++ b/data/ext/perspectiveGrid/perspectiveUI.js@@ -493,7 +493,7 @@ console.log("Loading UI for perspectiveDefault");for(var j=0; j < value.length; j++) {groupedContent.append($('<li>', {- title: value[j][TSCORE.fileListFILENAME]+"\n Modified on: "+ TSCORE.TagUtils.formatDateTime(value[j][TSCORE.fileListFILELMDT], false),+ title: value[j][TSCORE.fileListFILEPATH],filepath: value[j][TSCORE.fileListFILEPATH],class: 'fileTile'})@@ -624,13 +624,15 @@ console.log("Loading UI for perspectiveDefault");};ExtUI.prototype.updateFileUI = function(oldFilePath, newFilePath) {- console.log("Updating file from UI");+ console.log("Updating file in UI");var title = TSCORE.TagUtils.extractTitle(newFilePath),fileExt = TSCORE.TagUtils.extractFileExtension(newFilePath),fileTags = TSCORE.TagUtils.extractTags(newFilePath);- $("#"+this.extensionID+"Container li[filepath='"+oldFilePath+"']")- .replaceWith(this.createFileTile(title, newFilePath, fileExt, fileTags));+ var $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));};ExtUI.prototype.getNextFile = function(filePath) {diff --git a/data/ext/perspectiveList/extension.js b/data/ext/perspectiveList/extension.jsindex 858083c89..a62dff7f2 100644--- a/data/ext/perspectiveList/extension.js+++ b/data/ext/perspectiveList/extension.js@@ -57,12 +57,11 @@ define(function(require, exports, module) {};var removeFileUI = function(filePath) {- console.log("Removing file: "+filePath+" from UI");- $("#"+extensionID+"Container button[filepath='"+filePath+"']").parent().parent().remove();+ UI.removeFileUI(filePath);};var updateFileUI = function(oldFilePath, newFilePath) {- //UI.updateFileUI(filePath);+ UI.updateFileUI(oldFilePath, newFilePath);};var getNextFile = function (filePath) {diff --git a/data/ext/perspectiveList/perspectiveUI.js b/data/ext/perspectiveList/perspectiveUI.jsindex 8662192aa..3a09b006f 100644--- a/data/ext/perspectiveList/perspectiveUI.js+++ b/data/ext/perspectiveList/perspectiveUI.js@@ -156,7 +156,7 @@ console.log("Loading UI for perspectiveList");},*/{ // File extension column"mRender": function ( data, type, row ) {- return buttonizeTitle(data,row[TSCORE.fileListTITLE],row[TSCORE.fileListFILEPATH],row[TSCORE.fileListFILEEXT]);+ return buttonizeTitle(row[TSCORE.fileListTITLE],row[TSCORE.fileListFILEPATH],row[TSCORE.fileListFILEEXT]);},"aTargets": [ TSCORE.fileListFILEEXT ]},@@ -225,8 +225,7 @@ console.log("Loading UI for perspectiveList");hoverClass: "activeRow",drop: function( event, ui ) {var tagName = TSCORE.selectedTag;-- var targetFilePath = self.fileTable.fnGetData( this )[TSCORE.fileListFILEPATH];+ var targetFilePath = $(this).find(".fileTitleButton").attr("filepath");// preventing self drag of tagsvar targetTags = TSCORE.TagUtils.extractTags(targetFilePath);@@ -248,10 +247,8 @@ console.log("Loading UI for perspectiveList");}).hammer().on("doubletap", function(event) {console.log("Doubletap & Opening file...");- var rowData = self.fileTable.fnGetData( this );- TSCORE.FileOpener.openFile(rowData[TSCORE.fileListFILEPATH]);-- var titleBut = $(this).find(".fileTitleButton");+ var titleBut = $(this).find(".fileTitleButton");+ TSCORE.FileOpener.openFile($(titleBut).attr("filepath"));self.selectFile(titleBut, $(titleBut).attr("filepath"));}).click( function() {@@ -310,7 +307,7 @@ console.log("Loading UI for perspectiveList");};// Helper function user by basic and search views- function buttonizeTitle(title, fileName, filePath, fileExt) {+ function buttonizeTitle(title, filePath, fileExt) {if(title.length < 1) {title = filePath;}@@ -326,7 +323,7 @@ console.log("Loading UI for perspectiveList");var thumbHTML = "";if(supportedFileTypeThumnailing.indexOf(fileExt) >= 0) {thumbHTML = $('<span>').append( $('<img>', {- title: fileName,+ title: filePath,class: "thumbImg",filepath: tmbPath,style: "width: 0px; height: 0px; border: 0px"@@ -337,7 +334,7 @@ console.log("Loading UI for perspectiveList");var checkboxHTML = "<button class='btn btn-link fileSelection'><i class='fa fa-square-o'></button>";var buttonHTML = $('<button>', {- title: "Options for "+fileName,+ title: "Options for "+filePath,filepath: filePath,class: 'btn btn-link fileTitleButton',}).append($('<span>', {@@ -449,6 +446,24 @@ console.log("Loading UI for perspectiveList");tagButton.prop('disabled', true);}};++ ExtUI.prototype.removeFileUI = function(filePath) {+ console.log("Removing file from UI");+ $("#"+this.extensionID+"Container button[filepath='"+filePath+"']").parent().parent().remove();+ };++ ExtUI.prototype.updateFileUI = function(oldFilePath, newFilePath) {+ console.log("Updating file in UI");++ var title = TSCORE.TagUtils.extractTitle(newFilePath),+ fileExt = TSCORE.TagUtils.extractFileExtension(newFilePath),+ fileTags = TSCORE.TagUtils.extractTags(newFilePath);++ var $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));+ };ExtUI.prototype.getNextFile = function(filePath) {var nextFilePath = undefined;diff --git a/data/ext/viewerImage/extension.js b/data/ext/viewerImage/extension.jsindex af66a7a88..8d2251c59 100644--- a/data/ext/viewerImage/extension.js+++ b/data/ext/viewerImage/extension.js@@ -7,7 +7,7 @@ define(function(require, exports, module) {console.log("Loading viewerImage");- var extensionTitle = "Image Viewer"+ var extensionTitle = "Image Viewer";var extensionID = "viewerImage"; // ID should be equal to the directory name where the ext. is locatedvar extensionType = "perspective";var extensionIcon = "icon-list";