TagSpaces is an offline, open source, document manager with tagging support
extracting all tags from the currern search results
Ilianb2d0f55e9fc0
diff --git a/data/ext/perspectiveList/perspectiveUI.js b/data/ext/perspectiveList/perspectiveUI.jsindex 1a246ac11..282dfa2e7 100644--- a/data/ext/perspectiveList/perspectiveUI.js+++ b/data/ext/perspectiveList/perspectiveUI.js@@ -215,7 +215,7 @@ console.log("Loading UI for perspectiveList");// Load new filtered datathis.searchResults = TSCORE.Search.searchData(TSCORE.fileList, TSCORE.Search.nextQuery);- $("#statusBar").text(this.searchResults.length+" files found here");+ $("#statusBar").text(this.searchResults.length+" files found");this.fileTable.fnAddData( this.searchResults );diff --git a/data/js/search.js b/data/js/search.jsindex 269a9cf2a..0438ea157 100644--- a/data/js/search.js+++ b/data/js/search.js@@ -21,6 +21,31 @@ define(function(require, exports, module) {$("#searchBox").val("+"+query);TSCORE.PerspectiveManager.redrawCurrentPerspective();};++ var calculateTags = function(data) {+ var allTags = [];++ data.forEach(function(fileEntry) {+ fileEntry[TSCORE.fileListTAGS].forEach(function(tag) {+ allTags.push(tag.toLowerCase());+ });+ });++ var countData = _.countBy(allTags, function(obj){+ return obj;+ });++ TSCORE.calculatedTags.length = 0;;+ _.each(countData, function(count, tag) {+ TSCORE.calculatedTags.push({+ "title": tag,+ "type" : "plain",+ "count": count,+ });+ });++ TSCORE.generateTagGroups();+ };var searchData = function(data, query) {query = query.toLowerCase().replace(/^\s+|\s+$/g, "");@@ -120,5 +145,6 @@ define(function(require, exports, module) {exports.searchData = searchData;exports.searchForTag = search4Tag;exports.searchForString = search4String;+ exports.calculateTags = calculateTags;});\ No newline at end of filediff --git a/default.settings.tmpl.js b/default.settings.tmpl.jsindex 6b1e4af5b..d88bddfc9 100644--- a/default.settings.tmpl.js+++ b/default.settings.tmpl.js@@ -102,7 +102,7 @@ exports.defaultSettings = {]},{- "title":"GTD",+ "title":"Getting Things Done","isFolder": "true","key":"GTD","expand": "true",@@ -189,6 +189,8 @@ exports.defaultSettings = {]},{+ "title": "Priorities",+ "key": "PRI","expanded": true,"children": [{@@ -209,10 +211,14 @@ exports.defaultSettings = {"color": "#7bd148","textcolor": "#ffffff"}- ],- "title": "Priorities",- "key": "PRI"- }+ ]+ },+ {+ "title": "Tags in Perspective",+ "key": "CTG",+ "expanded": true,+ "children": []+ }]};