TagSpaces is an offline, open source, document manager with tagging support
tag group color
kristiyandde0b681034357
diff --git a/data/index.html b/data/index.htmlindex bb05d5dac..881bf7aae 100644--- a/data/index.html+++ b/data/index.html@@ -720,7 +720,7 @@<div class="modal-body form"><form role="form" data-toggle="validator"><div class="form-group">- <label class="control-label" for="tags" data-i18n="ns.dialogs:tagOperationTag"></label>+ <label class="control-label" for="tags" data-i18n="ns.common:tagOperationTag"></label><input class="form-control" type="text" name="tags" id="tags" autocomplete="off"data-i18n="[placeholder]ns.dialogs:tagOperationTagsPlaceholder"/><p class="help-block" data-i18n="ns.dialogs:editTagNamesRestrictionsHelp"></p>@@ -731,7 +731,7 @@<button id="cleanTagsButton" class="btn btn-danger pull-left" data-dismiss="modal" aria-hidden="true"data-i18n="ns.dialogs:tagOperationCleanTags"></button><button class="btn btn-default cancelButton" data-dismiss="modal" aria-hidden="true">- <i class="fa fa-times fa-lg"></i><span data-i18n="ns.dialogs:cancel"></span>+ <i class="fa fa-times fa-lg"></i><span data-i18n="ns.common:cancel"></span></button><button id="removeTagsButton" class="btn btn-warning" data-dismiss="modal" aria-hidden="true"data-i18n="ns.dialogs:tagOperationRemoveTag"></button>@@ -895,6 +895,47 @@pattern='^([^"]){1,}$' data-i18n="[data-error]ns.dialogs:tagGroupNameHelp" required/><p class="help-block with-errors"></p></div>+ <div class="form-group">+ <label class="control-label" for="tagGroupBackgroundColor" data-i18n="ns.dialogs:backgroundColor"></label>+ <input type="color" class="form-control" id="tagGroupBackgroundColor" style="padding: 0">+ <select class="form-control" id="tagGroupBackgroundColorChooser">+ <option value="#ffffff">#ffffff</option>+ <option value="#000000">#000000</option>+ <option value="#ac725e">#ac725e</option>+ <option value="#d06b64">#d06b64</option>+ <option value="#f83a22">#f83a22</option>+ <option value="#fa573c">#fa573c</option>+ <option value="#ff7537">#ff7537</option>+ <option value="#ffad46">#ffad46</option>+ <option value="#42d692">#42d692</option>+ <option value="#008000">#008000</option>+ <option value="#7bd148">#7bd148</option>+ <option value="#fad165">#fad165</option>+ <option value="#FFCC24">#FFCC24</option>+ <option value="#92e1c0">#92e1c0</option>+ <option value="#9fe1e7">#9fe1e7</option>+ <option value="#9fc6e7">#9fc6e7</option>+ <option value="#4986e7">#4986e7</option>+ <option value="#9a9cff">#9a9cff</option>+ <option value="#b99aff">#b99aff</option>+ <option value="#c2c2c2">#c2c2c2</option>+ <option value="#cabdbf">#cabdbf</option>+ <option value="#cca6ac">#cca6ac</option>+ <option value="#f691b2">#f691b2</option>+ <option value="#cd74e6">#cd74e6</option>+ <option value="#a47ae2">#a47ae2</option>+ </select>+ </div>+ <div class="form-group">+ <label class="control-label" for="tagGroupForegroundColor" data-i18n="ns.dialogs:foregroundColor"></label>+ <input type="color" class="form-control" id="tagGroupForegroundColor" style="padding: 0">+ <select class="form-control" id="tagGroupForegroundColorChooser">+ <option value="#ffffff">#ffffff</option>+ <option value="#cccccc">#cccccc</option>+ <option value="#333333">#333333</option>+ <option value="#000000">#000000</option>+ </select>+ </div></form></div><div class="modal-footer">diff --git a/data/js/settings.api.js b/data/js/settings.api.jsindex 62e9b919e..34ed15d98 100644--- a/data/js/settings.api.js+++ b/data/js/settings.api.js@@ -1069,8 +1069,8 @@ define(function(require, exports, module) {newTagModel.color = newTagColor;newTagModel.textcolor = newTagTextColor;} else {- newTagModel.color = getDefaultTagColor();- newTagModel.textcolor = getDefaultTagTextColor();+ newTagModel.color = value.color !== undefined ? value.color : getDefaultTagColor();+ newTagModel.textcolor = value.color !== undefined ? value.color : getDefaultTagTextColor();}value.children.push(newTagModel);} else {@@ -1082,10 +1082,12 @@ define(function(require, exports, module) {return true;}- function editTagGroup(tagData, tagGroupName) {+ function editTagGroup(tagData, tagGroupName, tagGroupColor, tagGroupTextColor) {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;break;}}@@ -1122,6 +1124,8 @@ define(function(require, exports, module) {function createTagGroup(tagData, tagGroupName) {var newTagGroupModel = JSON.parse(JSON.stringify(tagGroupTemplate));newTagGroupModel.title = tagGroupName;+ newTagGroupModel.color = exports.Settings.tagGroups.color;+ newTagGroupModel.textcolor = exports.Settings.tagGroups.textcolor;//newTagGroupModel.children = [];newTagGroupModel.key = '' + TSCORE.Utils.getRandomInt(10000, 99999);console.log('Creating taggroup: ' + JSON.stringify(newTagGroupModel) + ' with key: ' + newTagGroupModel.key);diff --git a/data/js/tags.ui.js b/data/js/tags.ui.jsindex f0c07abbe..5acda917a 100644--- a/data/js/tags.ui.js+++ b/data/js/tags.ui.js@@ -19,34 +19,34 @@ define(function(require, exports, module) {var tagGroupsTmpl = Handlebars.compile('{{#each tagGroups}}' +'<div class="accordion-group disableTextSelection tagGroupContainer">' +- '<div class="accordion-heading btn-group ui-droppable tagGroupContainerHeading flexLayout" key="{{key}}">' +- '<button class="btn btn-link btn-lg tagGroupIcon" data-toggle="collapse" data-target="#tagButtons{{@index}}" data-i18n="[title]ns.common:toggleTagGroup" title="{{../toggleTagGroup}}">' +- '<i class="fa fa-tags fa-fw"></i>' +- '</button>' +- '<button class="btn btn-link tagGroupTitle flexMaxWidth" data-toggle="collapse" data-target="#tagButtons{{@index}}" key="{{key}}">{{title}} ' +- '<sup><span class="badge" style="font-size: 9px;" data-i18n="[title]ns.common:tagGroupTagsCount">{{children.length}}</span></sup></button>' +- '<button class="btn btn-link btn-lg tagGroupActions" key="{{key}}" data-i18n="[title]ns.common:tagGroupOperations" title="{{../tagGroupOperations}}">' +- '<b class="fa fa-ellipsis-v"></b>' +- '</button>' +- '</div>' +- '{{#if collapse}}' +- '<div class="accordion-body collapse" id="tagButtons{{@index}}">' +- '{{else}}' +- '<div class="accordion-body collapse in" id="tagButtons{{@index}}">' +- '{{/if}}' +- '<div class="accordion-inner" id="tagButtonsContent{{@index}}" style="padding: 2px;">' +- '<div>' +- '{{#each children}}' +- '<a class="btn btn-sm tagButton" tag="{{title}}" parentkey="{{../key}}" style="{{style}}" title="{{description}}" >' +- '<span class="{{icon}}" /> ' +- '{{title}}' +- '{{#if count}} <span class="badge" style="font-size: 9px; background-color: rgba(187, 187, 187, 0.26);" data-i18n="[title]ns.common:tagGroupTagsCount1">{{count}}</span>{{/if}}' +- ' <span class="fa fa-ellipsis-v"></span>' +- '</a>' +- '{{/each}}' +- '</div>' +- '</div>' +- '</div>' ++ '<div class="accordion-heading btn-group ui-droppable tagGroupContainerHeading flexLayout" key="{{key}}">' ++ '<button class="btn btn-link btn-lg tagGroupIcon" data-toggle="collapse" data-target="#tagButtons{{@index}}" data-i18n="[title]ns.common:toggleTagGroup" title="{{../toggleTagGroup}}">' ++ '<i class="fa fa-tags fa-fw"></i>' ++ '</button>' ++ '<button class="btn btn-link tagGroupTitle flexMaxWidth" data-toggle="collapse" data-target="#tagButtons{{@index}}" key="{{key}}">{{title}} ' ++ '<sup><span class="badge" style="font-size: 9px;" data-i18n="[title]ns.common:tagGroupTagsCount">{{children.length}}</span></sup></button>' ++ '<button class="btn btn-link btn-lg tagGroupActions" key="{{key}}" data-i18n="[title]ns.common:tagGroupOperations" title="{{../tagGroupOperations}}">' ++ '<b class="fa fa-ellipsis-v"></b>' ++ '</button>' ++ '</div>' ++ '{{#if collapse}}' ++ '<div class="accordion-body collapse" id="tagButtons{{@index}}">' ++ '{{else}}' ++ '<div class="accordion-body collapse in" id="tagButtons{{@index}}">' ++ '{{/if}}' ++ '<div class="accordion-inner" id="tagButtonsContent{{@index}}" style="padding: 2px;">' ++ '<div>' ++ '{{#each children}}' ++ '<a class="btn btn-sm tagButton" tag="{{title}}" parentkey="{{../key}}" style="{{style}}" title="{{description}}" >' ++ '<span class="{{icon}}" /> ' ++ '{{title}}' ++ '{{#if count}} <span class="badge" style="font-size: 9px; background-color: rgba(187, 187, 187, 0.26);" data-i18n="[title]ns.common:tagGroupTagsCount1">{{count}}</span>{{/if}}' ++ ' <span class="fa fa-ellipsis-v"></span>' ++ '</a>' ++ '{{/each}}' ++ '</div>' ++ '</div>' ++ '</div>' +'</div>' +'{{/each}}');@@ -55,7 +55,8 @@ define(function(require, exports, module) {function initUI() {- $('#extMenuAddTagAsFilter').click(function() {});+ $('#extMenuAddTagAsFilter').click(function() {+ });// Context menu for the tags in the file table and the file viewer$('#tagMenuAddTagAsFilter').click(function() {@@ -205,7 +206,7 @@ define(function(require, exports, module) {}function createTagGroup() {- TSCORE.Config.createTagGroup(TSCORE.selectedTagData, $('#newTagGroupName').val());+ TSCORE.Config.createTagGroup(TSCORE.selectedTagData, $('#newTagGroupName').val(),$('#tagGroupBackgroundColor').val(),$('#tagGroupForegroundColor').val());generateTagGroups();}@@ -313,16 +314,14 @@ define(function(require, exports, module) {});$tagGroupsContent.find('.tagGroupTitle').each(function() {- $(this)- .on('click', function() {+ $(this).on('click', function() {var areaId = $(this).attr('data-target');if (areaId) {var index = areaId.substring(areaId.length - 1);tagGroups[index].collapse = $(areaId).is(':visible');TSCORE.Config.saveSettings();}- })- .droppable({+ }).droppable({accept: '.tagButton',hoverClass: 'dirButtonActive',drop: function(event, ui) {@@ -382,7 +381,8 @@ define(function(require, exports, module) {var d;if (tagData.type === 'smart') {switch (tagData.functionality) {- case 'geoLocation': {+ case 'geoLocation':+ {$('#viewContainers').on('drop dragend', function(event) {if (TSCORE.selectedTag === 'geoTag') {tagValue = TSCORE.showTagEditDialog();@@ -390,23 +390,27 @@ define(function(require, exports, module) {});break;}- case 'today': {+ case 'today':+ {tagValue = TSCORE.TagUtils.formatDateTime4Tag(new Date(), false);break;}- case 'tomorrow': {+ case 'tomorrow':+ {d = new Date();d.setDate(d.getDate() + 1);tagValue = TSCORE.TagUtils.formatDateTime4Tag(d, false);break;}- case 'yesterday': {+ case 'yesterday':+ {d = new Date();d.setDate(d.getDate() - 1);tagValue = TSCORE.TagUtils.formatDateTime4Tag(d, false);break;}- case 'currentMonth': {+ case 'currentMonth':+ {var cMonth = '' + (new Date().getMonth() + 1);if (cMonth.length === 1) {cMonth = '0' + cMonth;@@ -414,15 +418,18 @@ define(function(require, exports, module) {tagValue = '' + new Date().getFullYear() + cMonth;break;}- case 'currentYear': {+ case 'currentYear':+ {tagValue = '' + new Date().getFullYear();break;}- case 'now': {+ case 'now':+ {tagValue = TSCORE.TagUtils.formatDateTime4Tag(new Date(), true);break;}- default: {+ default:+ {break;}}@@ -507,7 +514,7 @@ define(function(require, exports, module) {}function showImportTagsDialog(tagGroups) {-+require(['text!templates/ImportTagsDialog.html'], function(uiTPL) {if ($('#dialogImportTags').length < 1) {@@ -562,6 +569,28 @@ define(function(require, exports, module) {}function showDialogTagGroupCreate() {++ var $tagGroupBackgroundColorChooser = $('#tagGroupBackgroundColorChooser');+ var $tagGroupBackgroundColor = $('#tagGroupBackgroundColor');+ $tagGroupBackgroundColorChooser.simplecolorpicker({+ picker: false+ });+ $tagGroupBackgroundColorChooser.on('change', function() {+ $tagGroupBackgroundColor.val($tagGroupBackgroundColorChooser.val());+ });++ $tagGroupBackgroundColor.val(TSCORE.Config.getDefaultTagColor());++ var $tagGroupForegroundColorChooser = $('#tagGroupForegroundColorChooser');+ var $tagGroupForegroundColor = $('#tagGroupForegroundColor');+ $tagGroupForegroundColorChooser.simplecolorpicker({+ picker: false+ });+ $tagGroupForegroundColorChooser.on('change', function() {+ $tagGroupForegroundColor.val($tagGroupForegroundColorChooser.val());+ });+ $tagGroupForegroundColor.val(TSCORE.Config.getDefaultTagTextColor());+$('#newTagGroupName').val('');$('#formTagGroupCreate').validator();$('#formTagGroupCreate').off();diff --git a/data/locales/en_US/ns.common.json b/data/locales/en_US/ns.common.jsonindex 24b566adb..1bec70d81 100644--- a/data/locales/en_US/ns.common.json+++ b/data/locales/en_US/ns.common.json@@ -252,6 +252,8 @@"exitApp":"Exit","openNewInstance":"New Application Window","documentation":"Documentation",+ "backgroundColor":"Default tag background color",+ "foregroundColor":"Default tag text color","-": "-"}