mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
* can show tags from all lists in tag cloud
This commit is contained in:
parent
765991eb68
commit
681d06a31d
6 changed files with 60 additions and 11 deletions
|
|
@ -14,7 +14,16 @@ var sortOrder; //save task order before dragging
|
|||
var searchTimer;
|
||||
var objPrio = {};
|
||||
var lastClickedNodeId = 0;
|
||||
var flag = { needAuth:false, isLogged:false, tagsChanged:true, readOnly:false, editFormChanged:false, firstLoad:true, dontChangeHistoryOnce:false };
|
||||
var flag = {
|
||||
needAuth: false,
|
||||
isLogged: false,
|
||||
tagsChanged: true,
|
||||
readOnly: false,
|
||||
editFormChanged: false,
|
||||
firstLoad: true,
|
||||
dontChangeHistoryOnce: false,
|
||||
showTagsFromAllLists: false
|
||||
};
|
||||
var taskCnt = { total:0, past: 0, today:0, soon:0 };
|
||||
var tabLists = {
|
||||
_lists: {},
|
||||
|
|
@ -263,6 +272,7 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
});
|
||||
|
||||
$('#tagcloudbtn').click(function(){
|
||||
$('#tagcloudAllLists').prop('checked', flag.showTagsFromAllLists);
|
||||
if(!_mtt.menus.tagcloud) _mtt.menus.tagcloud = new mttMenu('tagcloud', {
|
||||
beforeShow: function(){
|
||||
if(flag.tagsChanged) {
|
||||
|
|
@ -286,6 +296,13 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
return false;
|
||||
});
|
||||
|
||||
$('#tagcloudAllLists').click(function(){
|
||||
flag.showTagsFromAllLists = this.checked;
|
||||
$('#tagcloudcontent').html('');
|
||||
$('#tagcloudload').show();
|
||||
loadTags(curList.id, function(){$('#tagcloudload').hide();});
|
||||
});
|
||||
|
||||
$('#mtt-notes-show').click(function(){
|
||||
toggleAllNotes(1);
|
||||
this.blur();
|
||||
|
|
@ -1816,13 +1833,14 @@ function addEditTag(tag)
|
|||
|
||||
function loadTags(listId, callback)
|
||||
{
|
||||
if (flag.showTagsFromAllLists) listId = -1;
|
||||
_mtt.db.request('tagCloud', {list:listId}, function(json){
|
||||
if (!parseInt(json.total)) tagsList = [];
|
||||
else tagsList = json.items;
|
||||
var cloud = '';
|
||||
tagsList.forEach( item => {
|
||||
// item.tag is escaped with htmlspecialchars()
|
||||
cloud += ' <a href="#" class="tag" data-tag="' + item.tag + '" data-tag-id="' + item.id + '">' + item.tag + '</a>';
|
||||
cloud += ' <span class="tag" data-tag="' + item.tag + '" data-tag-id="' + item.id + '">' + item.tag + '</span>';
|
||||
});
|
||||
$('#tagcloudcontent').html(cloud)
|
||||
flag.tagsChanged = false;
|
||||
|
|
|
|||
|
|
@ -732,37 +732,57 @@ h3.page-title a.mtt-back-button {
|
|||
|
||||
#tagcloudbtn { font-size:1rem; font-weight:normal; margin-left:auto; }
|
||||
#mtt.show-all-tasks #tagcloudbtn { display:none; }
|
||||
#tagcloudload { display:none; height:24px; background:url(images/loading48.gif) center no-repeat; background-size:24px 24px; }
|
||||
#tagcloud {
|
||||
overflow: hidden; z-index:100;
|
||||
background-color:var(--color-menu);
|
||||
border:1px solid var(--color-border-default);
|
||||
padding:5px;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
text-align: center;
|
||||
box-shadow: var(--color-popup-shadow);
|
||||
border-radius: 5px;
|
||||
}
|
||||
#tagcloud.mtt-left-adjusted { margin-left:5px; }
|
||||
#tagcloud.mtt-right-adjusted { margin-right:5px; }
|
||||
#tagcloud.mtt-left-adjusted.mtt-right-adjusted { margin-bottom:5px; }
|
||||
#tagcloud > div {
|
||||
padding:5px;
|
||||
}
|
||||
#tagcloud .tag {
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
line-height:160%;
|
||||
color: var(--color-text-default);
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#tagcloud .tag:hover {
|
||||
background-color:var(--color-taglist-text-hover-bg);
|
||||
color: var(--color-taglist-text-hover);
|
||||
}
|
||||
|
||||
#tagcloudcancel { float:right; }
|
||||
#tagcloudload {
|
||||
display:none;
|
||||
height:24px;
|
||||
background:url(images/loading48.gif) center no-repeat;
|
||||
background-size:24px 24px;
|
||||
}
|
||||
#tagcloud .actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid var(--color-menu-border);
|
||||
}
|
||||
#tagcloud .actions > *:first-child {
|
||||
flex-grow: 1;
|
||||
}
|
||||
#tagcloudcancel span {
|
||||
mask: url(images/closetag.svg) no-repeat; -webkit-mask: url(images/closetag.svg) no-repeat;
|
||||
background-color: var(--color-btn-reduced);
|
||||
}
|
||||
#tagcloudcontent {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
|
||||
.ui-datepicker {
|
||||
|
|
|
|||
|
|
@ -19,8 +19,12 @@ class TagsController extends ApiController {
|
|||
checkReadAccess($listId);
|
||||
$db = DBConnection::instance();
|
||||
|
||||
$q = $db->dq("SELECT name,tag_id,COUNT(tag_id) AS tags_count FROM {$db->prefix}tag2task INNER JOIN {$db->prefix}tags ON tag_id=id ".
|
||||
"WHERE list_id=$listId GROUP BY (tag_id) ORDER BY tags_count DESC");
|
||||
$sqlWhere = ($listId == -1) ? "" : "WHERE list_id=$listId";
|
||||
$q = $db->dq("SELECT name,tag_id,COUNT(tag_id) AS tags_count
|
||||
FROM {$db->prefix}tag2task INNER JOIN {$db->prefix}tags ON tag_id=id
|
||||
$sqlWhere
|
||||
GROUP BY (tag_id)
|
||||
ORDER BY tags_count DESC");
|
||||
$at = array();
|
||||
$ac = array();
|
||||
while ($r = $q->fetchAssoc()) {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
"public_tasks": "Public Tasks",
|
||||
"tagcloud": "Tags",
|
||||
"tagfilter_cancel": "cancel filter",
|
||||
"showTagsFromAllLists": "Show tags from all lists",
|
||||
"sortByHand": "Sort by hand",
|
||||
"sortByPriority": "Sort by priority",
|
||||
"sortByDueDate": "Sort by due date",
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
"public_tasks": "Опубликованные задачи",
|
||||
"tagcloud": "Теги",
|
||||
"tagfilter_cancel": "отменить фильтр по тегу",
|
||||
"showTagsFromAllLists": "Показать теги из всех списков",
|
||||
"sortByHand": "Сортировка вручную",
|
||||
"sortByPriority": "Сортировка по приоритету",
|
||||
"sortByDueDate": "Сортировка по сроку",
|
||||
|
|
|
|||
|
|
@ -212,9 +212,14 @@ $().ready(function(){
|
|||
</div>
|
||||
|
||||
<div id="tagcloud" style="display:none">
|
||||
<a id="tagcloudcancel" class="mtt-img-button"><span></span></a>
|
||||
<div id="tagcloudload"></div>
|
||||
<div id="tagcloudcontent"></div>
|
||||
<div class="actions">
|
||||
<div><label><input id="tagcloudAllLists" type="checkbox" /> <?php _e('showTagsFromAllLists');?></label></div>
|
||||
<div id="tagcloudcancel" class="mtt-img-button"><span></span></div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div id="tagcloudload"></div>
|
||||
<div id="tagcloudcontent"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue