mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
* sort menu items moved into list menu
This commit is contained in:
parent
14bf436f79
commit
333ab5e001
6 changed files with 21 additions and 32 deletions
28
src/ajax.js
28
src/ajax.js
|
|
@ -11,7 +11,6 @@ var sortOrder; //save task order before dragging
|
|||
var searchTimer;
|
||||
var objPrio = {};
|
||||
var selTask = 0;
|
||||
var sortBy = 0;
|
||||
var flag = { needAuth:false, isLogged:false, tagsChanged:true, windowTaskEditMoved:false, autoTag:true };
|
||||
var taskCnt = { total:0, past: 0, today:0, soon:0 };
|
||||
var tmp = {};
|
||||
|
|
@ -75,7 +74,7 @@ function loadTasks(opts)
|
|||
var tag = filter.tag ? '&t='+encodeURIComponent(filter.tag) : '';
|
||||
var nocache = '&rnd='+Math.random();
|
||||
var setCompl = opts.setCompl != null ? '&setCompl=1' : '';
|
||||
$.getJSON('ajax.php?loadTasks&list='+curList.id+'&compl='+curList.showCompl+'&sort='+sortBy+search+tag+'&tz='+tz+setCompl+nocache, function(json){
|
||||
$.getJSON('ajax.php?loadTasks&list='+curList.id+'&compl='+curList.showCompl+'&sort='+curList.sort+search+tag+'&tz='+tz+setCompl+nocache, function(json){
|
||||
taskList = new Array();
|
||||
taskOrder = new Array();
|
||||
taskCnt.total = taskCnt.past = taskCnt.today = taskCnt.soon = 0;
|
||||
|
|
@ -368,7 +367,7 @@ function saveTask(form)
|
|||
taskList[item.id] = item;
|
||||
var noteExpanded = (item.note != '' && $('#taskrow_'+item.id).is('.task-expanded')) ? 1 : 0;
|
||||
$('#taskrow_'+item.id).replaceWith(prepareTaskStr(item, noteExpanded));
|
||||
if(sortBy != 0) changeTaskOrder(item.id);
|
||||
if(curList.sort != 0) changeTaskOrder(item.id);
|
||||
cancelEdit();
|
||||
refreshTaskCnt();
|
||||
$('#taskrow_'+item.id).effect("highlight", {color:theme.editTaskFlashColor}, 'normal', function(){$(this).css('display','')});
|
||||
|
|
@ -595,31 +594,30 @@ function setTaskPrio(id, prio)
|
|||
taskList[id].prio = prio;
|
||||
var $t = $('#taskrow_'+id);
|
||||
$t.find('.task-prio').replaceWith(preparePrio(prio, id));
|
||||
if(sortBy != 0) changeTaskOrder(id);
|
||||
if(curList.sort != 0) changeTaskOrder(id);
|
||||
$t.effect("highlight", {color:theme.editTaskFlashColor}, 'normal');
|
||||
}
|
||||
|
||||
function setSort(v, init)
|
||||
{
|
||||
if(v == 0) $('#sort>.btnstr').text($('#sortByHand').text());
|
||||
else if(v == 1) $('#sort>.btnstr').text($('#sortByPrio').text());
|
||||
else if(v == 2) $('#sort>.btnstr').text($('#sortByDueDate').text());
|
||||
$('#mylistscontainer .sort-item').removeClass('mtt-item-checked');
|
||||
if(v == 0) $('#sortByHand').addClass('mtt-item-checked');
|
||||
else if(v == 1) $('#sortByPrio').addClass('mtt-item-checked');
|
||||
else if(v == 2) $('#sortByDueDate').addClass('mtt-item-checked');
|
||||
else return;
|
||||
|
||||
if(flag.needAuth && !flag.isLogged) {
|
||||
$("#tasklist").sortable('disable');
|
||||
return;
|
||||
}
|
||||
sortBy = v;
|
||||
if(sortBy==0) $("#tasklist").sortable('enable');
|
||||
curList.sort = v;
|
||||
if(v == 0) $("#tasklist").sortable('enable');
|
||||
else $("#tasklist").sortable('disable');
|
||||
|
||||
if(!init)
|
||||
{
|
||||
curList.sort = sortBy;
|
||||
changeTaskOrder();
|
||||
var nocache = '&rnd='+Math.random();
|
||||
$.post('ajax.php?setSort'+nocache, { list:curList.id, sort:sortBy }, function(json){
|
||||
$.post('ajax.php?setSort'+'&rnd='+Math.random(), { list:curList.id, sort:curList.sort }, function(json){
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
|
|
@ -636,17 +634,17 @@ function changeTaskOrder(id)
|
|||
id = parseInt(id);
|
||||
if(taskOrder.length < 2) return;
|
||||
var oldOrder = taskOrder.slice();
|
||||
if(sortBy == 0) taskOrder.sort( function(a,b){
|
||||
if(curList.sort == 0) taskOrder.sort( function(a,b){
|
||||
if(taskList[a].compl != taskList[b].compl) return taskList[a].compl-taskList[b].compl;
|
||||
return taskList[a].ow-taskList[b].ow
|
||||
});
|
||||
else if(sortBy == 1) taskOrder.sort( function(a,b){
|
||||
else if(curList.sort == 1) taskOrder.sort( function(a,b){
|
||||
if(taskList[a].compl != taskList[b].compl) return taskList[a].compl-taskList[b].compl;
|
||||
if(taskList[a].prio != taskList[b].prio) return taskList[b].prio-taskList[a].prio;
|
||||
if(taskList[a].dueInt != taskList[b].dueInt) return taskList[a].dueInt-taskList[b].dueInt;
|
||||
return taskList[a].ow-taskList[b].ow;
|
||||
});
|
||||
else if(sortBy == 2) taskOrder.sort( function(a,b){
|
||||
else if(curList.sort == 2) taskOrder.sort( function(a,b){
|
||||
if(taskList[a].compl != taskList[b].compl) return taskList[a].compl-taskList[b].compl;
|
||||
if(taskList[a].dueInt != taskList[b].dueInt) return taskList[a].dueInt-taskList[b].dueInt;
|
||||
if(taskList[a].prio != taskList[b].prio) return taskList[b].prio-taskList[a].prio;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
function tplSingleTabLoaded()
|
||||
{
|
||||
var $lc = $('#mylistscontainer');
|
||||
if($lc.find('.mtt-btnmenu-delimiter').length == 0) {
|
||||
$lc.find('ul').append('<li class="mtt-btnmenu-delimiter"></li>');
|
||||
if($lc.find('.list-block-delimiter').length == 0) {
|
||||
$lc.find('ul').append('<li class="mtt-btnmenu-delimiter list-block-delimiter"></li>');
|
||||
} else {
|
||||
$lc.find('.list-ref').remove();
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ function tplSingleTabLoaded()
|
|||
for(var i in tabLists) {
|
||||
ti += '<li class="list-ref '+(i==0?'mtt-item-checked':'')+' list-id-'+tabLists[i].id+'" onClick="tplTabMenuSelect('+tabLists[i].id+','+i+');"><div class="menu-icon"></div><a href="#list'+tabLists[i].id+'" onClick="return false">'+tabLists[i].name+'</a></li>';
|
||||
}
|
||||
$lc.find('.mtt-btnmenu-delimiter').after(ti);
|
||||
$lc.find('.list-block-delimiter').after(ti);
|
||||
}
|
||||
|
||||
function tplSingleTabRenamed(opts)
|
||||
|
|
|
|||
|
|
@ -118,7 +118,6 @@ $().ready(function(){
|
|||
</div>
|
||||
|
||||
<h3>
|
||||
<span id="sort" onClick="btnMenu(this);return false;" class="mtt-btnmenu"><span class="btnstr"></span> <img src="<?php mttinfo('template_uri'); ?>images/arrdown.gif"></span>
|
||||
<span id="taskview" onClick="btnMenu(this);return false;" class="mtt-btnmenu"><span class="btnstr"><?php _e('tasks');?></span> (<span id="total">0</span>) <img src="<?php mttinfo('template_uri'); ?>images/arrdown.gif"></span>
|
||||
<span id="tagcloudbtn" onClick="showTagCloud(this);"><span class="btnstr"><?php _e('tags');?></span> <img src="<?php mttinfo('template_uri'); ?>images/arrdown.gif"></span>
|
||||
<span class="mtt-notes-showhide"><?php _e('notes');?> <a href="#" onClick="toggleAllNotes(1);this.blur();return false;"><?php _e('notes_show');?></a> / <a href="#" onClick="toggleAllNotes(0);this.blur();return false;"><?php _e('notes_hide');?></a></span>
|
||||
|
|
@ -185,14 +184,6 @@ $().ready(function(){
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="sortcontainer" class="mtt-btnmenu-container" style="display:none">
|
||||
<ul>
|
||||
<li id="sortByHand" onClick="setSort(0)"><?php _e('sortByHand');?></li>
|
||||
<li id="sortByPrio" onClick="setSort(1)"><?php _e('sortByPriority');?></li>
|
||||
<li id="sortByDueDate" onClick="setSort(2)"><?php _e('sortByDueDate');?></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="tagcloud" style="display:none">
|
||||
<div id="tagcloudcancel" onClick="cancelTagFilter();tagCloudClose();"><?php _e('tagfilter_cancel');?></div>
|
||||
<div id="tagcloudload"><img src="<?php mttinfo('template_uri'); ?>images/loading1_24.gif"></div>
|
||||
|
|
@ -206,6 +197,10 @@ $().ready(function(){
|
|||
<li class="mtt-need-list" onClick="deleteCurList()"><?php _e('list_delete');?></li>
|
||||
<li class="mtt-need-list" id="btnPublish" onClick="publishCurList()"><div class="menu-icon"></div><?php _e('list_publish');?></li>
|
||||
<li class="mtt-need-list" id="btnShowCompleted" onClick="showCompletedToggle()"><div class="menu-icon"></div><?php _e('list_showcompleted');?></li>
|
||||
<li class="mtt-btnmenu-delimiter"></li>
|
||||
<li class="mtt-need-list sort-item" id="sortByHand" onClick="setSort(0)"><div class="menu-icon"></div><?php _e('sortByHand');?></li>
|
||||
<li class="mtt-need-list sort-item" id="sortByPrio" onClick="setSort(1)"><div class="menu-icon"></div><?php _e('sortByPriority');?></li>
|
||||
<li class="mtt-need-list sort-item" id="sortByDueDate" onClick="setSort(2)"><div class="menu-icon"></div><?php _e('sortByDueDate');?></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ body { height:0; min-height:0; margin:0; }
|
|||
h2{ display: none; }
|
||||
h3 { border-bottom:2px solid #777777; }
|
||||
#lists { display: none; }
|
||||
#toolbar { display: none; }
|
||||
.small-bar { display:none; }
|
||||
.task-actions { display:none; }
|
||||
|
||||
|
|
@ -23,7 +24,6 @@ div.task-note-block { border-left:1px solid #777777; background:none; padding-le
|
|||
#footer_content { border-top:1px solid #777777; background:none; }
|
||||
#footer_content a { text-decoration:none; color:#000000; }
|
||||
|
||||
#sort { display:none; }
|
||||
#tagcloudbtn { display:none; }
|
||||
.mtt-notes-showhide { display:none; }
|
||||
.mtt-btnmenu { border:none; }
|
||||
|
|
|
|||
|
|
@ -55,9 +55,6 @@ a { color:#0000ff; }
|
|||
#msg.mtt-info .msg-text { background-color:#EFC300; }
|
||||
#msg.mtt-info .msg-details { border:1px solid #EFC300;}
|
||||
|
||||
#sort { margin-left:5px; font-size:8pt; font-weight:normal; float:right; }
|
||||
#page_tasks.readonly #sort { display:none; }
|
||||
|
||||
.mtt-notes-showhide { font-size:8pt; font-weight:normal; margin-left:2px; margin-right:2px; }
|
||||
#rss_icon { float:right;margin-top:4px; }
|
||||
#rss_icon img { border:none; }
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ h2 { float:right; }
|
|||
#loading { float:right; }
|
||||
#lists .mtt-tabs { float:right; }
|
||||
#rss_icon { float:left; }
|
||||
#sort { float:left; margin-left:0px; margin-right:5px; }
|
||||
.mtt-tabs li { float:right; margin:1px 0 0 3px; border-left:none; border-right:1px solid #ededed; background:#fbfbfb url(images/tab_hover.gif) no-repeat top left; }
|
||||
.mtt-tabs li.mtt-tabs-selected { border-left:none; border-right:1px solid #ededed; background:#ededed url(images/corner_left.gif) no-repeat top left; }
|
||||
.mtt-htabs { background:url(images/corner_left.gif) no-repeat top left #ededed; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue