Skip to content

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

refactoring directory properties

Ilian Sapundshiev1450ecc28fd3
diff --git a/data/index.html b/data/index.html
index 2c2444ab7..5ba9de558 100644
--- a/data/index.html
+++ b/data/index.html
@@ -1363,17 +1363,6 @@
</div>
</div>
-<div id="locationTagTreeMenu" class="dropdown clearfix">
- <ul class="dropdown-menu" role="menu" style="display:block;position:static;">
- <li class="dropdown-header">
- <button class="close" data-i18n="[title]ns.common:closeTooltip">&times;</button>
- <span data-i18n="ns.common:tagOperations"></span></li>
- <li class="divider"></li>
- <li><a id="locationTagTreeMenuDeleteTag" data-i18n="[title]ns.common:deleteTagFromTagGroupTooltip">
- <i class="fa fa-trash-o fa-fw"></i>&nbsp;<span data-i18n="ns.common:deleteTagFromTagGroup"></span></a></li>
- </ul>
-</div>
-
<input type="file" id="addFileInput" style="display: none;"/>
<input type="file" id="jsonImportFileInput" style="display: none;"/>
diff --git a/data/js/directories.ui.js b/data/js/directories.ui.js
index 56585ed50..664ab1d89 100644
--- a/data/js/directories.ui.js
+++ b/data/js/directories.ui.js
@@ -240,9 +240,8 @@ define(function(require, exports, module) {
if (TSCORE.PRO && TSCORE.PRO.Directory) {
TSCORE.PRO.Directory.setContextMenu($directoryTagsArea);
- } else {
- $("#locationContent .dropDownIcon").hide();
}
+ $("#locationContent .dropDownIcon").hide();
}
function updateSubDirs(dirList) {
@@ -577,10 +576,23 @@ define(function(require, exports, module) {
$('#cancelEditFolderDescriptionButton').on('click', cancelEditFolderDescription);
$('#saveFolderDescriptionButton').on('click', saveEditFolderDescription);
+
+ }
+
+ function saveFolderTags(event) {
+ var newTags = $(this).val();
+ console.log("Tags: " + newTags);
+ TSCORE.Meta.loadFolderMetaDataPromise(TSCORE.currentPath).then(function(metaData) {
+ newTags = newTags.split(",");
+ metaData.tags = TSCORE.PRO.Directory.generateTags(newTags);
+ TSCORE.PRO.Directory.saveMetaData(metaData);
+ });
}
function initFolderProperties() {
$('#folderPathProperty').val(TSCORE.currentPath);
+
+ $('#folderTagsProperty').off();
$("#folderTagsProperty").val("");
$('#folderTagsProperty').select2('data', null);
@@ -599,7 +611,6 @@ define(function(require, exports, module) {
}
$("#folderTagsProperty").val(tags);
- $('#folderTagsProperty').select2('data', null);
$('#folderTagsProperty').select2({
multiple: true,
tags: TSCORE.Config.getAllTags(),
@@ -615,13 +626,7 @@ define(function(require, exports, module) {
});
if (TSCORE.PRO && TSCORE.Config.getEnableMetaData()) { // TSCORE.Config.getWriteMetaToSidecarFile()
- $('#folderTagsProperty').off();
- $('#folderTagsProperty').on('change', function(evt) {
- console.log("Tags: " + $(this).val());
- var newTags = $(this).val().split(",");
- metaData.tags = TSCORE.PRO.Directory.generateTags(newTags);
- TSCORE.PRO.Directory.saveMetaData(metaData);
- });
+ $('#folderTagsProperty').on('change', saveFolderTags);
} else {
$('#folderTagsProperty').attr('disabled', 'disabled');
// $('.select2-search-choice').css('padding-left', '4px !important');