mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
* move 'All tasks' tab to the left (to be the first tab)
This commit is contained in:
parent
003e1eadb9
commit
57b8666bd2
5 changed files with 50 additions and 29 deletions
16
src/ajax.php
16
src/ajax.php
|
|
@ -18,7 +18,8 @@ if(isset($_GET['loadLists']))
|
|||
if (!is_logged()) $sqlWhere = 'WHERE published=1';
|
||||
else $sqlWhere = '';
|
||||
$t = array();
|
||||
$t['total'] = 0;
|
||||
$t['list'][] = prepareAllTasksList();
|
||||
$t['total'] = 1;
|
||||
$q = $db->dq("SELECT * FROM {$db->prefix}lists $sqlWhere ORDER BY ow ASC, id ASC");
|
||||
while($r = $q->fetch_assoc($q))
|
||||
{
|
||||
|
|
@ -875,6 +876,19 @@ function prepareList($row)
|
|||
);
|
||||
}
|
||||
|
||||
function prepareAllTasksList()
|
||||
{
|
||||
return array(
|
||||
'id' => -1,
|
||||
'name' => htmlarray(__('alltasks')),
|
||||
'sort' => 3,
|
||||
'published' => 0,
|
||||
'showCompl' => 1,
|
||||
'showNotes' => 0,
|
||||
'hidden' => 1,
|
||||
);
|
||||
}
|
||||
|
||||
function getUserListsSimple()
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
|
|
|
|||
|
|
@ -73,12 +73,14 @@ $().ready(function(){
|
|||
|
||||
<div id="lists">
|
||||
<div class="tabs-n-button">
|
||||
<!--
|
||||
<div id="list_all" class="mtt-tab mtt-tabs-alltasks mtt-tabs-hidden">
|
||||
<a href="#alltasks" title="<?php _e('alltasks'); ?>"><span><?php _e('alltasks'); ?></span><div class="list-action"></div></a>
|
||||
</div>-->
|
||||
<ul class="mtt-tabs"></ul>
|
||||
<div class="mtt-tabs-add-button" title="<?php _e('list_new'); ?>"><div class="tab-height-wrapper"><span></span></div></div>
|
||||
</div>
|
||||
<div id="list_all" class="mtt-tab mtt-tabs-alltasks mtt-tabs-hidden">
|
||||
<a href="#alltasks" title="<?php _e('alltasks'); ?>"><span><?php _e('alltasks'); ?></span><div class="list-action"></div></a>
|
||||
</div>
|
||||
|
||||
<div id="tabs_buttons">
|
||||
<div class="tab-height-wrapper">
|
||||
<div class="mtt-tabs-select-button mtt-img-button" title="<?php _e('list_select'); ?>"><span></span></div>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ h3 { border-bottom:2px solid #777777; }
|
|||
.mtt-tab a span { text-align:left; padding:0; max-width:none; font-size:1.3rem; color:#000; }
|
||||
|
||||
.mtt-tabs-add-button { display:none; }
|
||||
#list_all { display:none; }
|
||||
#tabs_buttons { display:none; }
|
||||
#taskview { padding-left:0; font-weight:normal; }
|
||||
#taskview .arrdown { display:none; }
|
||||
|
|
|
|||
|
|
@ -54,8 +54,7 @@ a { color:#0000ff; cursor:pointer; text-decoration:underline; }
|
|||
.tabs-n-button { flex-grow:1; display:flex; align-items:flex-start; }
|
||||
.tab-height-wrapper { box-sizing:border-box; height:2.2rem; display:flex; align-items:center; }
|
||||
.mtt-tabs { list-style:none; padding:0; margin:0; display:flex; justify-content:flex-start; flex-wrap:wrap; }
|
||||
.mtt-tabs li { margin:1px 3px 0 0; }
|
||||
.mtt-tab { background-color:#fbfbfb; border:1px solid #ededed; border-bottom:none; border-top-right-radius:8px; transition:background-color 0.1s ease-in; }
|
||||
.mtt-tab { margin:1px 3px 0 0; background-color:#fbfbfb; border:1px solid #ededed; border-bottom:none; border-top-right-radius:8px; transition:background-color 0.1s ease-in; }
|
||||
.mtt-tab a {
|
||||
margin:0; text-decoration:none; white-space:nowrap; color:#333333; display:inline-block; outline:none;
|
||||
box-sizing:border-box; height:2.2rem; padding:1px 0.3rem 0 0.3rem; display:flex; align-items:center;
|
||||
|
|
@ -68,10 +67,7 @@ a { color:#0000ff; cursor:pointer; text-decoration:underline; }
|
|||
.mtt-tab:hover { background-color:#ddd; }
|
||||
.mtt-tab.mtt-tabs-selected:hover { background-color:#ededed; }
|
||||
.mtt-tabs-hidden { display:none; }
|
||||
.mtt-tabs .mtt-list-sort-placeholder { background-color:#ddd; border:1px solid #aaa; }
|
||||
|
||||
.mtt-tabs-alltasks { margin:1px 3px 0 3px; }
|
||||
.mtt-tabs-alltasks.mtt-tab { border-top-right-radius:0px; border-top-left-radius:8px; }
|
||||
.mtt-tab-sort-placeholder { background-color:#ddd; border-color:#aaa; }
|
||||
|
||||
#tabs_buttons {
|
||||
padding-left:2px; padding-right:2px;
|
||||
|
|
|
|||
|
|
@ -477,20 +477,22 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
}
|
||||
|
||||
$("#tasklist").sortable({
|
||||
items: '> :not(.task-completed)',
|
||||
cancel: 'span,input,a,textarea',
|
||||
delay: 150,
|
||||
start: tasklistSortStart,
|
||||
update: tasklistSortUpdated,
|
||||
placeholder: 'mtt-task-placeholder',
|
||||
cursor: 'grabbing'
|
||||
items: '> :not(.task-completed)',
|
||||
cancel: 'span,input,a,textarea',
|
||||
delay: 150,
|
||||
start: tasklistSortStart,
|
||||
update: tasklistSortUpdated,
|
||||
placeholder: 'mtt-task-placeholder',
|
||||
cursor: 'grabbing'
|
||||
});
|
||||
|
||||
|
||||
$("#lists ul").sortable({
|
||||
delay:150,
|
||||
update:listOrderChanged,
|
||||
placeholder: 'mtt-list-sort-placeholder',
|
||||
delay: 150,
|
||||
update: listOrderChanged,
|
||||
items: '> :not(.mtt-tabs-alltasks)',
|
||||
forcePlaceholderSize : true,
|
||||
placeholder: 'mtt-tab mtt-tab-sort-placeholder',
|
||||
cursor: 'grabbing'
|
||||
});
|
||||
|
||||
|
|
@ -673,11 +675,18 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
// or open first if all list are hidden
|
||||
if(!openListId) openListId = res.list[0].id;
|
||||
|
||||
$.each(res.list, function(i,item){
|
||||
tabLists.add(item);
|
||||
ti += '<li id="list_'+item.id+'" class="mtt-tab'+(item.hidden?' mtt-tabs-hidden':'')+'">'+
|
||||
'<a href="'+_mtt.urlForList(item)+'" title="'+item.name+'"><span>'+item.name+'</span>'+
|
||||
'<div class="list-action"></div></a></li>';
|
||||
$.each(res.list, function(i,item) {
|
||||
if ( item.id == -1) {
|
||||
ti += '<li id="list_all" class="mtt-tab mtt-tabs-alltasks'+(item.hidden?' mtt-tabs-hidden':'')+'">'+
|
||||
'<a href="'+_mtt.urlForList(item)+'" title="'+item.name+'"><span>'+item.name+'</span>'+
|
||||
'<div class="list-action"></div></a></li>';
|
||||
}
|
||||
else {
|
||||
tabLists.add(item);
|
||||
ti += '<li id="list_'+item.id+'" class="mtt-tab'+(item.hidden?' mtt-tabs-hidden':'')+'">'+
|
||||
'<a href="'+_mtt.urlForList(item)+'" title="'+item.name+'"><span>'+item.name+'</span>'+
|
||||
'<div class="list-action"></div></a></li>';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -1292,12 +1301,13 @@ function toggleAllNotes(show)
|
|||
function tabSelect(elementOrId)
|
||||
{
|
||||
var id;
|
||||
if(typeof elementOrId == 'number') id = elementOrId;
|
||||
if (typeof elementOrId == 'number') id = elementOrId;
|
||||
else if(typeof elementOrId == 'string') id = parseInt(elementOrId);
|
||||
else {
|
||||
id = $(elementOrId).attr('id');
|
||||
if(!id) return;
|
||||
id = parseInt(id.split('_', 2)[1]);
|
||||
if (!id ) return;
|
||||
id = id.split('_', 2)[1];
|
||||
if (id === 'all') id = -1;
|
||||
}
|
||||
if ( !tabLists.exists(id) ) {
|
||||
// TODO: handle unknown list
|
||||
|
|
|
|||
Loading…
Reference in a new issue