* show "no tags" in tag cloud and task editor

This commit is contained in:
maxpozdeev 2023-08-14 13:37:39 +03:00
parent 3b76ff34a5
commit ec5e380c51
6 changed files with 17 additions and 6 deletions

View file

@ -1839,11 +1839,12 @@ function toggleEditAllTags(show)
function fillEditAllTags()
{
var a = [];
const a = [];
tagsList.forEach( (item) => {
a.push('<a href="#" class="tag" data-tag="' + item.tag +'">' + item.tag + '</a>');
a.push('<span class="tag" data-tag="' + item.tag +'">' + item.tag + '</span>');
});
$('#alltags .tags-list').html(a.join(', '));
const content = (a.length == 0) ? _mtt.lang.get('noTags') : a.join(', ');
$('#alltags').html(content);
$('#alltags').show();
};
@ -1864,11 +1865,14 @@ function loadTags(listId, callback)
_mtt.db.request('tagCloud', {list:listId}, function(json){
if (!parseInt(json.total)) tagsList = [];
else tagsList = json.items;
var cloud = '';
let cloud = '';
tagsList.forEach( item => {
// item.tag is escaped with htmlspecialchars()
cloud += ' <span class="tag" data-tag="' + item.tag + '" data-tag-id="' + item.id + '">' + item.tag + '</span>';
});
if (cloud == '') {
cloud = _mtt.lang.get('noTags');
}
$('#tagcloudcontent').html(cloud)
flag.tagsChanged = false;
callback();

View file

@ -711,7 +711,11 @@ li.task-row.task-completed .task-note-block .task-note { text-decoration:line-th
padding: 5px;
}
#page_taskedit .form-row-short { float:left; margin-right:12px; }
#alltags .tag { font-weight:bold; color:var(--color-tasklist-tag); }
#alltags .tag {
color:var(--color-tasklist-tag);
text-decoration: underline;
cursor: pointer;
}
#alltags .tag:hover {
background-color:var(--color-taglist-text-hover-bg);
color: var(--color-taglist-text-hover);

View file

@ -126,6 +126,7 @@ class Lang
'denied',
'listNotFound',
'noPublicLists',
'noTags',
'invalidpass',
'addList',
'addListDefault',

View file

@ -194,6 +194,7 @@
"denied": "Access denied",
"listNotFound": "List not found",
"noPublicLists": "No public tasks",
"noTags": "No tags",
"invalidpass": "Wrong password",
"addList": "Create new list",
"addListDefault": "Todo",

View file

@ -194,6 +194,7 @@
"denied": "Доступ запрещен",
"listNotFound": "Список не найден",
"noPublicLists": "Нет опубликованных списков",
"noTags": "Нет тегов",
"invalidpass": "Неверный пароль",
"addList": "Новый список",
"addListDefault": "Todo",

View file

@ -163,7 +163,7 @@ $().ready(function(){
</td>
</tr></table>
</div>
<div class="form-row" id="alltags" style="display:none;"><?php _e('alltags');?> <span class="tags-list"></span></div>
<div class="form-row" id="alltags" style="display:none;"></div>
<div class="form-row form-bottom-buttons">
<button type="submit"><?php _e('save');?></button>
<button class="mtt-back-button"><?php _e('cancel');?></button>