From 731be8e876752ec4152c30290c263872bddbcfd7 Mon Sep 17 00:00:00 2001 From: Max Pozdeev Date: Thu, 24 Dec 2009 22:05:44 +0300 Subject: [PATCH] + task priority added to context menu --- langs/ru.php | 1 + src/ajax.js | 38 ++++++++++++++++++++++++++----------- src/images/arrright.gif | Bin 0 -> 55 bytes src/index.php | 6 +++--- src/lang/class.default.php | 1 + src/lang/en.php | 1 + src/style.css | 2 ++ 7 files changed, 35 insertions(+), 14 deletions(-) create mode 100644 src/images/arrright.gif diff --git a/langs/ru.php b/langs/ru.php index 8836e1a..6fb0ead 100644 --- a/langs/ru.php +++ b/langs/ru.php @@ -74,6 +74,7 @@ class Lang extends DefaultLang 'action_edit' => "Редактировать", 'action_note' => "Заметка", 'action_delete' => "Удалить", + 'action_priority' => "Приоритет", 'notes' => "Заметки:", 'notes_show' => "Показать", 'notes_hide' => "Скрыть", diff --git a/src/ajax.js b/src/ajax.js index 9ea82bc..f1fd719 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -579,16 +579,21 @@ function prioClick(prio, el) { el.blur(); prio = parseInt(prio); + $('#priopopup').fadeOut('fast'); //.hide(); + setTaskPrio(objPrio.taskId, prio); +} + +function setTaskPrio(id, prio) +{ setAjaxErrorTrigger(); - var nocache = '&rnd='+Math.random(); - $.getJSON('ajax.php?setPrio='+objPrio.taskId+'&prio='+prio+nocache, function(json){ + $.getJSON('ajax.php?setPrio='+id+'&prio='+prio+'&rnd='+Math.random(), function(json){ resetAjaxErrorTrigger(); }); - taskList[objPrio.taskId].prio = prio; - $(objPrio.el).replaceWith(preparePrio(prio, objPrio.taskId)); - $('#priopopup').fadeOut('fast'); //.hide(); - if(sortBy != 0) changeTaskOrder(objPrio.taskId); - $('#taskrow_'+objPrio.taskId).effect("highlight", {color:theme.editTaskFlashColor}, 'normal'); + taskList[id].prio = prio; + var $t = $('#taskrow_'+id); + $t.find('.task-prio').replaceWith(preparePrio(prio, id)); + if(sortBy != 0) changeTaskOrder(id); + $t.effect("highlight", {color:theme.editTaskFlashColor}, 'normal'); } function setSort(v, init) @@ -1130,6 +1135,10 @@ function taskContextClick(el) case 'cmenu_edit': editTask(taskId); break; case 'cmenu_note': toggleTaskNote(taskId); break; case 'cmenu_delete': deleteTask(taskId); break; + case 'cmenu_prio_-1': setTaskPrio(taskId, -1); break; + case 'cmenu_prio_0': setTaskPrio(taskId, 0); break; + case 'cmenu_prio_1': setTaskPrio(taskId, 1); break; + case 'cmenu_prio_2': setTaskPrio(taskId, 2); break; } } @@ -1146,6 +1155,8 @@ function mttMenu(container, options) var submenu = new mttMenu($(this).attr('submenu')); submenu.$caller = $(this); submenu.parent = menu; + if(menu.root) submenu.root = menu.root; //!! be careful with circular references + else submenu.root = menu; menu.submenu = submenu; var showTimer, hideTimer; @@ -1160,11 +1171,16 @@ function mttMenu(container, options) clearTimeout(showTimer); hideTimer = setTimeout(function(){ submenu.hide(); - }, 300); + }, 400); } ); - submenu.container.find('li').each(function() + submenu.container.find('li').click(function() + { + submenu.root.onclick(this); + return false; + }) + .each(function() { $(this).hover( function(){ @@ -1173,7 +1189,7 @@ function mttMenu(container, options) function(){ hideTimer = setTimeout(function(){ submenu.hide(); - }, 300); + }, 400); } ); }); @@ -1186,7 +1202,7 @@ function mttMenu(container, options) this.onclick = function(item) { - if($(item).is('.mtt-disabled')) return; + if($(item).is('.mtt-disabled,.mtt-menu-has-submenu')) return; menu.close(); if(this.options.onclick) this.options.onclick(item); } diff --git a/src/images/arrright.gif b/src/images/arrright.gif new file mode 100644 index 0000000000000000000000000000000000000000..675d2718473ba491a9e17c88bddbe53208a227d8 GIT binary patch literal 55 zcmZ?wbhEHbWM|-HXkY+=|Ns9h{$ycfU|?j>0r5dH3`~43eF+k~p2x))YL*#Vw=!4* E07i!lLjV8( literal 0 HcmV?d00001 diff --git a/src/index.php b/src/index.php index e6fb527..ca2963e 100644 --- a/src/index.php +++ b/src/index.php @@ -217,8 +217,8 @@ $().ajaxStop( function(r,s) {$("#loading").fadeOut();} );