Skip to content

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

refactoring tag group editing

uggrockef753964f80c
diff --git a/data/js/settings.api.js b/data/js/settings.api.js
index f8dbab1a7..eea0e5797 100644
--- a/data/js/settings.api.js
+++ b/data/js/settings.api.js
@@ -1094,15 +1094,14 @@ define(function(require, exports, module) {
return true;
}
- function editTagGroup(tagData, tagGroupName, tagGroupColor, tagGroupTextColor, checkAllTags) {
+ function editTagGroup(tagData, tagGroupName, tagGroupColor, tagGroupTextColor, propagateColorToTags) {
for (var i = 0; i < exports.Settings.tagGroups.length; i++) {
if (exports.Settings.tagGroups[i].key === tagData.key) {
exports.Settings.tagGroups[i].title = tagGroupName;
exports.Settings.tagGroups[i].color = tagGroupColor;
exports.Settings.tagGroups[i].textcolor = tagGroupTextColor;
- for (var j = 0; j < exports.Settings.tagGroups[i].children.length; j++) {
- if (checkAllTags === true && (exports.Settings.tagGroups[i].children[j].color !== tagData.color ||
- exports.Settings.tagGroups[i].children[j].textcolor !== tagData.textcolor)) {
+ if (propagateColorToTags) {
+ for (var j = 0; j < exports.Settings.tagGroups[i].children.length; j++) {
exports.Settings.tagGroups[i].children[j].color = tagGroupColor;
exports.Settings.tagGroups[i].children[j].textcolor = tagGroupTextColor;
}
diff --git a/data/js/tags.ui.js b/data/js/tags.ui.js
index a2b31ef09..967ff76ff 100644
--- a/data/js/tags.ui.js
+++ b/data/js/tags.ui.js
@@ -15,7 +15,6 @@ define(function(require, exports, module) {
var defaultTagTextColor = "#ffffff";
var TSCORE = require('tscore');
- var checkColorToAllTags;
var tagGroupsTmpl = Handlebars.compile(
'{{#each tagGroups}}' +
@@ -177,7 +176,7 @@ define(function(require, exports, module) {
$('#createTagGroupButton').on("click", createTagGroup);
$('#editTagGroupButton').click(function() {
- TSCORE.Config.editTagGroup(TSCORE.selectedTagData, $('#tagGroupName').val(), $('#editTagGroupBackgroundColor').val(), $('#editTagGroupForegroundColor').val(), checkColorToAllTags);
+ TSCORE.Config.editTagGroup(TSCORE.selectedTagData, $('#tagGroupName').val(), $('#editTagGroupBackgroundColor').val(), $('#editTagGroupForegroundColor').val(), $('#colorChangesToAllTags').prop('checked'));
generateTagGroups();
});
}
@@ -534,7 +533,7 @@ define(function(require, exports, module) {
}
function showDialogEditTagGroup() {
- checkColorToAllTags = $('#colorChangesToAllTags').prop('checked', false);
+ $('#colorChangesToAllTags').prop('checked', false);
var $editTagGroupBackgroundColorChooser = $('#editTagGroupBackgroundColorChooser');
var $editTagGroupBackgroundColor = $('#editTagGroupBackgroundColor');