Skip to content

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

add description for files persisted in the sidecars file

kristiyandd3efc0586cf82
diff --git a/data/js/fileopener.js b/data/js/fileopener.js
index 2471636c4..7a2bbc1f4 100644
--- a/data/js/fileopener.js
+++ b/data/js/fileopener.js
@@ -590,9 +590,17 @@ define(function(require, exports, module) {
var uiTemplate = Handlebars.compile(uiTPL);
$('body').append(uiTemplate());
}
+
+ console.debug(_openedFileProperties);
+ console.debug(_openedFileProperties);
+ console.debug(_openedFileProperties);
+
$('#filePathProperty').val(_openedFileProperties.path);
$('#fileSizeProperty').val(_openedFileProperties.size);
$('#fileLMDTProperty').val(new Date(_openedFileProperties.lmdt));
+ var description = TSCORE.Meta.getDescriptionFromMetaFile(TSCORE.fileOpener.getOpenedFilePath());
+ $('#fileDescriptionProperty').val(description);
+
var $fileTagsProperty = $('#fileTagsProperty');
$fileTagsProperty.children().remove();
$fileTagsProperty.append(generatedTagButtons);
diff --git a/data/js/meta.js b/data/js/meta.js
index cde343d33..5f6642309 100644
--- a/data/js/meta.js
+++ b/data/js/meta.js
@@ -302,6 +302,23 @@ define(function(require, exports, module) {
}
}
+ function addMetaDescriptionToFile(filePath, description) {
+ var metaObj = findMetaObjectFromFileList(filePath);
+ if (!metaObj) {
+ metaObj = {
+ thumbnailPath: "",
+ metaData: null,
+ };
+ }
+
+ if (!metaObj.metaData) {
+ metaObj.metaData = {
+ description: description
+ };
+ }
+ saveMetaData(filePath, metaObj.metaData);
+ }
+
//meta tag utils
function addMetaTags(filePath, tags) {
var metaObj = findMetaObjectFromFileList(filePath);
@@ -417,6 +434,7 @@ define(function(require, exports, module) {
exports.getTagsFromMetaFile = getTagsFromMetaFile;
exports.getDescriptionFromMetaFile = getDescriptionFromMetaFile;
exports.addMetaTags = addMetaTags;
+ exports.addMetaDescription = addMetaDescriptionToFile;
exports.renameMetaTag = renameMetaTag;
exports.removeMetaTag = removeMetaTag;
exports.loadFolderMetaDataPromise = loadFolderMetaDataPromise;
diff --git a/data/templates/FilePropertiesDialog.html b/data/templates/FilePropertiesDialog.html
index 50ec81cce..6962d7652 100644
--- a/data/templates/FilePropertiesDialog.html
+++ b/data/templates/FilePropertiesDialog.html
@@ -24,6 +24,11 @@
<label class="control-label" for="fileTagsProperty" data-i18n="ns.dialogs:filePropertiesTags"></label>
<span class="form-control" name="fileTagsProperty" id="fileTagsProperty" />
</div>
+ <div class="form-group">
+ <label class="control-label" for="fileDescriptionProperty" data-i18n="ns.dialogs:fileDescriptionProperty"></label>
+ <textarea class="form-control input" rows="4" type="text" name="fileDescriptionProperty"
+ id="fileDescriptionProperty"></textarea>
+ </div>
</div>
<div class="modal-footer">
<button class="btn btn-default btn-primary" data-dismiss="modal" aria-hidden="true">