mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-07-07 00:06:38 +08:00
tab indents the task; Makes it a child of previous task
This commit is contained in:
@@ -46,7 +46,14 @@ var app = app || {};
|
||||
this.$input.focus();
|
||||
},
|
||||
|
||||
broadcast: function() {
|
||||
broadcast: function(e) {
|
||||
if (e.keyCode == 9) {
|
||||
var parent = this.$el.prev('li').prev('li').find('input').data('id');
|
||||
var current = this.$el.prev('li').find('input').data('id');
|
||||
var model = app.Tasks.get(current);
|
||||
model.set('parent_id',parent);
|
||||
model.save({content: model.get('content'), parent_id: model.get('parent_id')});
|
||||
}
|
||||
socket.emit('task', {
|
||||
id: this.model.id,
|
||||
parent_id: this.model.parent_id,
|
||||
@@ -64,12 +71,13 @@ var app = app || {};
|
||||
|
||||
close: function() {
|
||||
var value = this.$input.val().trim();
|
||||
console.log(this.model);
|
||||
if (value === '') {
|
||||
this.model.destroy();
|
||||
}
|
||||
else
|
||||
this.model.save({content: value, parent_id: this.model.get('parent_id')});
|
||||
else {
|
||||
console.log(this.model.attributes);
|
||||
this.model.save({content: value, parent_id: this.model.attributes.parent_id});
|
||||
}
|
||||
this.$el.removeClass('editing');
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ app.post('/tasks', function(req,res){
|
||||
|
||||
app.put('/tasks/:id', function(req,res){
|
||||
var timestamp = Math.round((new Date()).getTime()/1000);
|
||||
client.query("UPDATE tasks SET content = ?, timestamp = ? WHERE id = ?", [req.body.content,timestamp,req.body.id], function(err, task){
|
||||
client.query("UPDATE tasks SET content = ?, timestamp = ?, parent_id = ? WHERE id = ?", [req.body.content,timestamp,req.body.parent_id,req.body.id], function(err, task){
|
||||
req.body.timestamp = timestamp;
|
||||
res.send(req.body);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user