Skip to content

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

enable importing of multiple tag groups

Ilianb877e69313ed
diff --git a/data/js/directories.ui.js b/data/js/directories.ui.js
index 9cab66ccf..ec2a0c3e8 100644
--- a/data/js/directories.ui.js
+++ b/data/js/directories.ui.js
@@ -132,19 +132,15 @@ define(function(require, exports, module) {
}
require(["text!"+metadataPath], function(jsonFile) {
- if(jsonFile !== null)
- var metadata = JSON.parse(jsonFile);
- //console.log("Location Metadata: "+JSON.stringify(metadata));
+ if(jsonFile !== null && jsonFile !== undefined && jsonFile !== "" ) {
+ var metadata = JSON.parse(jsonFile);
+ //console.log("Location Metadata: "+JSON.stringify(metadata));
- if(metadata.tagGroups.length > 0) {
- TSCORE.locationTags = metadata.tagGroups[0].children;
- TSCORE.generateTagGroups();
+ if(metadata.tagGroups.length > 0) {
+ TSCORE.locationTags = metadata.tagGroups;
+ TSCORE.generateTagGroups();
+ }
}
-
- /*if(metadata.desktop !== undefined) {
- TSCORE.locationDesktop = metadata.desktop;
- TSCORE.PerspectiveManager.generateDesktop();
- }*/
});
}
diff --git a/data/js/tags.ui.js b/data/js/tags.ui.js
index c25f1f692..479722eef 100644
--- a/data/js/tags.ui.js
+++ b/data/js/tags.ui.js
@@ -215,7 +215,7 @@
// Cleaning Special TagGroups
for(var k=0; k < tagGroups.length; k++) {
- if(tagGroups[k].key === locationTagGroupKey || tagGroups[k].key === calculatedTagGroupKey) {
+ if(tagGroups[k].key.indexOf(locationTagGroupKey) === 0 || tagGroups[k].key === calculatedTagGroupKey) {
console.log("Deleting:"+tagGroups[k].key+" "+k);
tagGroups.splice(k, 1);
k--;
@@ -232,14 +232,17 @@
});
}
- // Adding the locataion tag group
+ // Adding tag groups from the current location
if(TSCORE.Config.getLoadLocationMeta() && TSCORE.locationTags !== null) {
- tagGroups.push({
- "title": $.i18n.t("ns.common:tagsFromCurrentLocation"),
- "key": locationTagGroupKey,
- "expanded": true,
- "children": TSCORE.locationTags
+ TSCORE.locationTags.forEach(function(data) {
+ tagGroups.push({
+ "title": data.title+" (imported)",
+ "key": locationTagGroupKey+TSCORE.TagUtils.formatDateTime4Tag(new Date(),true, true),
+ "expanded": true,
+ "children": data.children
+ });
});
+
}
// ehnances the taggroups with addition styling information