Skip to content

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

update perspective names

Borislav Sapundzhievfebcb0cfff73
diff --git a/data/js/directories.ui.js b/data/js/directories.ui.js
index 3d31fc2d3..8bd23c109 100644
--- a/data/js/directories.ui.js
+++ b/data/js/directories.ui.js
@@ -8,6 +8,7 @@ define(function(require, exports, module) {
console.log('Loading directories.ui.js ...');
var TSCORE = require('tscore');
+ var tsExtManager = require('tsextmanager');
var TSPOSTIO = require("tspostioapi");
var directoryHistory = [];
var metaTagGroupsHistory = null;
@@ -578,12 +579,15 @@ define(function(require, exports, module) {
var $locationPerspective2 = $('#locationPerspective2');
var selectedPerspectiveId = TSCORE.Config.getLocation(path).perspective;
$locationPerspective2.children().remove();
- TSCORE.Config.getActivatedPerspectiveExtensions().forEach(function(value) {
- if (selectedPerspectiveId === value.id) {
- $locationPerspective2.append($('<option>').attr('selected', 'selected').text(value.id).val(value.id));
- } else {
- $locationPerspective2.append($('<option>').text(value.id).val(value.id));
- }
+ tsExtManager.loadExtensionData().then(function() {
+ TSCORE.Config.getActivatedPerspectiveExtensions().forEach(function(value) {
+ var name = value.name ? value.name : value.id;
+ if (selectedPerspectiveId === value.id) {
+ $locationPerspective2.append($('<option>').attr('selected', 'selected').text(name).val(value.id));
+ } else {
+ $locationPerspective2.append($('<option>').text(name).val(value.id));
+ }
+ });
});
$connectionName2.val(name);
$connectionName2.attr('oldName', name);
@@ -639,8 +643,11 @@ define(function(require, exports, module) {
selectLocalDirectory();
});
}
- TSCORE.Config.getActivatedPerspectiveExtensions().forEach(function(value) {
- $('#locationPerspective').append($('<option>').text(value.id).val(value.id));
+ tsExtManager.loadExtensionData().then(function() {
+ TSCORE.Config.getActivatedPerspectiveExtensions().forEach(function(value) {
+ var name = value.name ? value.name : value.id;
+ $('#locationPerspective').append($('<option>').text(name).val(value.id));
+ });
});
$('#createFolderConnectionButton').on('click', function() {
createLocation();
diff --git a/data/js/extension.manager.js b/data/js/extension.manager.js
index e2435a3f5..88707ba93 100644
--- a/data/js/extension.manager.js
+++ b/data/js/extension.manager.js
@@ -48,10 +48,6 @@ define(function(require, exports, module) {
function loadExtensionData() {
var extFolderPath = getExtFolderPath();
- //if (isChrome) {
- // TODO: chrome
- // return Promise.resolve();
- //}
var promise = new Promise(function(resolve, reject) {
TSCORE.IO.listDirectoryPromise(extFolderPath).then(function(dirList) {
var readBowerFileWorkers = [];
@@ -69,6 +65,7 @@ define(function(require, exports, module) {
result.push(values[val]);
}
}
+ updatePerspectiveNames(result);
TSCORE.hideLoadingAnimation();
resolve(result);
}).catch(function(err) {
@@ -84,5 +81,18 @@ define(function(require, exports, module) {
return promise;
}
+ function updatePerspectiveNames(perspectiveList) {
+ TSCORE.Config.getPerspectives().forEach(function(value) {
+ if(!value.name) {
+ for(var i in perspectiveList) {
+ var element = perspectiveList[i];
+ if(element.id === value.id) {
+ value.name = element.name;
+ }
+ }
+ }
+ });
+ }
+
exports.loadExtensionData = loadExtensionData;
});