Skip to content

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

Added PRO options tab

Borislav Sapundzhievb81980e6d652
diff --git a/data/js/core.ui.js b/data/js/core.ui.js
index 6dfbd0cec..a598203bf 100644
--- a/data/js/core.ui.js
+++ b/data/js/core.ui.js
@@ -192,7 +192,9 @@ define(function(require, exports, module) {
], function(uiTPL, controller) {
if ($('#dialogOptions').length < 1) {
var uiTemplate = Handlebars.compile(uiTPL);
- $('body').append(uiTemplate());
+ $('body').append(uiTemplate({ isProVersion: TSCORE.PRO ? true : false }));
+
+
controller.initUI();
}
$('#dialogOptions').i18n();
diff --git a/data/js/options.ui.js b/data/js/options.ui.js
index f6331c29e..75a2bda46 100644
--- a/data/js/options.ui.js
+++ b/data/js/options.ui.js
@@ -120,6 +120,7 @@ define(function(require, exports, module) {
$('#documentPropertiesKeyBinding').val(TSCORE.Config.getPropertiesDocumentKeyBinding());
$('#showSearchKeyBinding').val(TSCORE.Config.getSearchKeyBinding());
$('#perspectiveList').empty();
+ $('#writeTagsToFiles').attr('checked', TSCORE.Config.getWriteTagsToFile());
TSCORE.Config.getPerspectives().forEach(function(value) {
addPerspective($('#perspectiveList'), value.id);
});
@@ -184,6 +185,7 @@ define(function(require, exports, module) {
TSCORE.switchInterfaceLanguage(interfaceLang);
TSCORE.Config.setPerspectives(collectPerspectivesData());
TSCORE.Config.setSupportedFileTypes(collectSupportedFileTypesData());
+ TSCORE.Config.setWriteTagsToFile($('#writeTagsToFiles').is(':checked'));
TSCORE.Config.saveSettings();
}
diff --git a/data/js/settings.api.js b/data/js/settings.api.js
index 6c6e93c85..99442e548 100644
--- a/data/js/settings.api.js
+++ b/data/js/settings.api.js
@@ -968,6 +968,16 @@ define(function(require, exports, module) {
}
}
+ var getWriteTagsToFile = function() {
+ if (exports.Settings.writeTagsToFile === undefined) {
+ exports.Settings.writeTagsToFile = exports.DefaultSettings.writeTagsToFile;
+ saveSettings();
+ }
+ return exports.Settings.writeTagsToFile;
+ };
+ var setWriteTagsToFile = function(value) {
+ exports.Settings.writeTagsToFile = value;
+ };
// Public API definition
exports.upgradeSettings = upgradeSettings;
exports.getPerspectives = getPerspectives;
@@ -1070,4 +1080,6 @@ define(function(require, exports, module) {
exports.loadDefaultSettings = loadDefaultSettings;
exports.saveSettings = saveSettings;
exports.addTagGroup = addTagGroup;
+ exports.setWriteTagsToFile = setWriteTagsToFile;
+ exports.getWriteTagsToFile = getWriteTagsToFile;
});
diff --git a/data/js/tagutils.js b/data/js/tagutils.js
index 3511b0d5f..d979667a0 100644
--- a/data/js/tagutils.js
+++ b/data/js/tagutils.js
@@ -335,7 +335,7 @@ define(function(require, exports, module) {
function writeTagsToFile(filePath, tags) {
console.log('Add the tags to: ' + filePath);
- if (TSCORE.Config.DefaultSettings.writeTagsToFile !== true) {
+ if (TSCORE.Config.getWriteTagsToFile() !== true) {
TSCORE.Meta.addMetaTags(filePath, tags);
TSCORE.PerspectiveManager.updateFileUI(filePath, filePath);
return;
@@ -441,7 +441,7 @@ define(function(require, exports, module) {
function renameTag(filePath, oldTag, newTag) {
console.log('Rename tag for file: ' + filePath);
- if (TSCORE.Config.DefaultSettings.writeTagsToFile !== true) {
+ if (TSCORE.Config.getWriteTagsToFile() !== true) {
TSCORE.Meta.reanmeMetaTag(filePath, oldTag, newTag);
TSCORE.PerspectiveManager.updateFileUI(filePath, filePath);
}
@@ -479,7 +479,7 @@ define(function(require, exports, module) {
function removeTag(filePath, tagName) {
console.log('Removing tag: ' + tagName + ' from ' + filePath);
- if (TSCORE.Config.DefaultSettings.writeTagsToFile !== true) {
+ if (TSCORE.Config.getWriteTagsToFile() !== true) {
TSCORE.Meta.removeMetaTag(filePath, tagName);
TSCORE.PerspectiveManager.updateFileUI(filePath, filePath);
}
diff --git a/data/locales/en_US/ns.dialogs.json b/data/locales/en_US/ns.dialogs.json
index 07aafeb88..2f0b8ee1c 100644
--- a/data/locales/en_US/ns.dialogs.json
+++ b/data/locales/en_US/ns.dialogs.json
@@ -95,6 +95,7 @@
"locationPathSelectFolder": "Select local folder",
"optionsTitle": "Options",
"generalTab": "General",
+ "proTab": "PRO",
"perspectivesTab": "Perspectives",
"fileTypeTab": "File Types",
"keyBindingsTab": "Key Bindings",
@@ -145,6 +146,7 @@
"operationNotPermittedInEditModeAlert": "This operation is not permitted because the document has been already changed.",
"exportTagGroupsButton": "Export Tag Groups as JSON",
"showMainMenu": "Show main menu (restart needed)",
+ "writeTagsToFiles": "Write tags to files",
"invalidImportFile": "The imported file has invalid format",
"importGroupTagsTitle": "Import tags from file",
"-": "-"
diff --git a/data/templates/OptionsDialog.html b/data/templates/OptionsDialog.html
index a70353238..1fd9556be 100644
--- a/data/templates/OptionsDialog.html
+++ b/data/templates/OptionsDialog.html
@@ -10,6 +10,9 @@
<div class="modal-body form" id="optionsAccordion" style="">
<ul class="nav nav-tabs" style="margin-bottom: 15px;">
<li><a href="#general" data-toggle="tab" class="optionsTitle" data-i18n="ns.dialogs:generalTab"></a></li>
+ {{#if isProVersion}}
+ <li><a href="#pro" data-toggle="tab" class="optionsTitle" data-i18n="ns.dialogs:proTab"></a></li>
+ {{/if}}
<li><a href="#perspectives" data-toggle="tab" class="optionsTitle" data-i18n="ns.dialogs:perspectivesTab"></a></li>
<li><a href="#filetypes" data-toggle="tab" class="optionsTitle" data-i18n="ns.dialogs:fileTypeTab"></a></li>
<li><a href="#keyBindings" data-toggle="tab" class="optionsTitle" data-i18n="ns.dialogs:keyBindingsTab"></a></li>
@@ -65,7 +68,22 @@
<div class="col-sm-9" style="margin-top: 0;" data-i18n="ns.dialogs:showMainMenu"></div>
</div>
</div>
-
+ {{#if isProVersion}}
+ <div class="tab-pane active" id="pro" style="height: 100%;">
+ <div class='form-group row' style="margin: 15px 0 0 0;">
+ <div class="col-sm-2">
+ <div class="onoffswitch">
+ <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="writeTagsToFiles" checked>
+ <label class="onoffswitch-label" for="writeTagsToFiles">
+ <span class="onoffswitch-inner"></span>
+ <span class="onoffswitch-switch"></span>
+ </label>
+ </div>
+ </div>
+ <div class="col-sm-9" style="margin-top: 0;" data-i18n="ns.dialogs:writeTagsToFiles"></div>
+ </div>
+ </div>
+ {{/if}}
<div class="tab-pane" id="perspectives" style="height: 100%;">
<button class='btn btn-default' id='addPerspectiveButton'>
<i class='fa fa-plus'></i>&nbsp;<span data-i18n="ns.dialogs:addPerspectiveButton"></span>