|
|
@ -20,6 +20,7 @@ define([
|
|
|
|
var $iframe = $('#pad-iframe').contents();
|
|
|
|
var $iframe = $('#pad-iframe').contents();
|
|
|
|
var $body = $iframe.find('body');
|
|
|
|
var $body = $iframe.find('body');
|
|
|
|
var ifrw = $('#pad-iframe')[0].contentWindow;
|
|
|
|
var ifrw = $('#pad-iframe')[0].contentWindow;
|
|
|
|
|
|
|
|
var $list = $iframe.find('#tasksList');
|
|
|
|
|
|
|
|
|
|
|
|
var onReady = function () {
|
|
|
|
var onReady = function () {
|
|
|
|
|
|
|
|
|
|
|
@ -28,7 +29,13 @@ define([
|
|
|
|
var deleteTask = function(id) {
|
|
|
|
var deleteTask = function(id) {
|
|
|
|
todo.remove(id);
|
|
|
|
todo.remove(id);
|
|
|
|
|
|
|
|
|
|
|
|
APP.display();
|
|
|
|
var $els = $list.find('.cp-task').filter(function (i, el) {
|
|
|
|
|
|
|
|
return $(el).data('id') === id;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$els.fadeOut(null, function () {
|
|
|
|
|
|
|
|
$els.remove();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
//APP.display();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// TODO make this actually work, and scroll to bottom...
|
|
|
|
// TODO make this actually work, and scroll to bottom...
|
|
|
@ -55,39 +62,47 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var display = APP.display = function () {
|
|
|
|
var addTaskUI = function (el, animate) {
|
|
|
|
var $list = $iframe.find('#tasksList');
|
|
|
|
var $taskDiv = $('<div>', {
|
|
|
|
|
|
|
|
'class': 'cp-task'
|
|
|
|
$list.empty();
|
|
|
|
}).appendTo($list);
|
|
|
|
|
|
|
|
$taskDiv.data('id', el);
|
|
|
|
|
|
|
|
|
|
|
|
APP.lm.proxy.order.forEach(function(el) {
|
|
|
|
var $box = makeCheckbox(el, function (state) {
|
|
|
|
var $taskDiv = $('<div>', {
|
|
|
|
display();
|
|
|
|
'class': 'cp-task'
|
|
|
|
})
|
|
|
|
}).appendTo($list);
|
|
|
|
.appendTo($taskDiv);
|
|
|
|
|
|
|
|
|
|
|
|
var $box = makeCheckbox(el, function (state) {
|
|
|
|
var entry = APP.lm.proxy.data[el];
|
|
|
|
display();
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.appendTo($taskDiv);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entry = APP.lm.proxy.data[el];
|
|
|
|
if (entry.state) {
|
|
|
|
|
|
|
|
$taskDiv.addClass('cp-task-complete');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (entry.state) {
|
|
|
|
$('<span>', { 'class': 'cp-task-text' })
|
|
|
|
$taskDiv.addClass('cp-task-complete');
|
|
|
|
.text(entry.task)
|
|
|
|
}
|
|
|
|
.appendTo($taskDiv);
|
|
|
|
|
|
|
|
/*$('<span>', { 'class': 'cp-task-date' })
|
|
|
|
|
|
|
|
.text(new Date(entry.ctime).toLocaleString())
|
|
|
|
|
|
|
|
.appendTo($taskDiv);*/
|
|
|
|
|
|
|
|
$('<button>', {
|
|
|
|
|
|
|
|
'class': 'fa fa-times cp-task-remove btn btn-danger'
|
|
|
|
|
|
|
|
}).appendTo($taskDiv).on('click', function() {
|
|
|
|
|
|
|
|
deleteTask(el);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('<span>', { 'class': 'cp-task-text' })
|
|
|
|
if (animate) {
|
|
|
|
.text(entry.task)
|
|
|
|
$taskDiv.hide();
|
|
|
|
.appendTo($taskDiv);
|
|
|
|
window.setTimeout(function () {
|
|
|
|
/*
|
|
|
|
// ???
|
|
|
|
$('<span>', { 'class': 'cp-task-date' })
|
|
|
|
$taskDiv.fadeIn();
|
|
|
|
.text(new Date(entry.ctime).toLocaleDateString())
|
|
|
|
}, 0);
|
|
|
|
.appendTo($taskDiv);*/
|
|
|
|
}
|
|
|
|
$('<button>', {
|
|
|
|
};
|
|
|
|
'class': 'fa fa-times cp-task-remove btn btn-danger'
|
|
|
|
var display = APP.display = function () {
|
|
|
|
}).appendTo($taskDiv).on('click', function() {
|
|
|
|
$list.empty();
|
|
|
|
deleteTask(el);
|
|
|
|
APP.lm.proxy.order.forEach(function (el) {
|
|
|
|
});
|
|
|
|
addTaskUI(el);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
//scrollTo('300px');
|
|
|
|
//scrollTo('300px');
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -101,10 +116,12 @@ define([
|
|
|
|
"mtime": +new Date()
|
|
|
|
"mtime": +new Date()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
todo.add(Cryptpad.createChannelId(), obj);
|
|
|
|
var id = Cryptpad.createChannelId();
|
|
|
|
|
|
|
|
todo.add(id, obj);
|
|
|
|
|
|
|
|
|
|
|
|
$input.val("");
|
|
|
|
$input.val("");
|
|
|
|
display();
|
|
|
|
addTaskUI(id, true);
|
|
|
|
|
|
|
|
//display();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var $formSubmit = $iframe.find('.cp-create-form button').on('click', addTask);
|
|
|
|
var $formSubmit = $iframe.find('.cp-create-form button').on('click', addTask);
|
|
|
|