append new items to the top of the todo

This commit is contained in:
ansuz 2017-07-26 15:37:16 +02:00
parent 69eaccbdef
commit 9734a4db80
2 changed files with 7 additions and 2 deletions

View File

@ -77,7 +77,12 @@ define([
var addTaskUI = function (el, animate) { var addTaskUI = function (el, animate) {
var $taskDiv = $('<div>', { var $taskDiv = $('<div>', {
'class': 'cp-task' 'class': 'cp-task'
}).appendTo($list); });
if (animate) {
$taskDiv.prependTo($list);
} else {
$taskDiv.appendTo($list);
}
$taskDiv.data('id', el); $taskDiv.data('id', el);
makeCheckbox(el, function (/*state*/) { makeCheckbox(el, function (/*state*/) {

View File

@ -47,7 +47,7 @@ define([
if (!Array.isArray(proxy.order)) { if (!Array.isArray(proxy.order)) {
throw new Error('expected an array'); throw new Error('expected an array');
} }
proxy.order.push(id); proxy.order.unshift(id);
proxy.data[id] = obj; proxy.data[id] = obj;
}; };