kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
48 lines
1.3 KiB
15 years ago
|
/**************************************
|
||
|
TASK
|
||
|
***************************************/
|
||
|
|
||
|
RB.Task = Object.create(RB.Story, {
|
||
|
|
||
|
initialize: function(el){
|
||
|
var j; // This ensures that we use a local 'j' variable, not a global one.
|
||
|
|
||
|
this.$ = j = $(el);
|
||
|
this.el = el;
|
||
|
|
||
|
j.addClass("task"); // If node is based on #task_template, it doesn't have the story class yet
|
||
|
|
||
|
// Associate this object with the element for later retrieval
|
||
|
j.data('this', this);
|
||
|
|
||
|
// Observe click events in certain fields
|
||
|
j.find('.editable').bind('mouseup', this.triggerEdit);
|
||
|
},
|
||
|
|
||
|
handleKeyup: function(event){
|
||
|
var j = $(this).parents('.task').first();
|
||
|
var that = j.data('this');
|
||
|
|
||
|
switch(event.which){
|
||
|
case 13 : that.saveEdits(); // Enter
|
||
|
break;
|
||
|
case 27 : that.cancelEdit(); // ESC
|
||
|
break;
|
||
|
default : return true;
|
||
|
}
|
||
|
},
|
||
|
|
||
|
triggerEdit: function(event){
|
||
|
// Get the task since what was clicked was a field
|
||
|
var j = $(this).parents('.task').first();
|
||
|
|
||
|
if(!j.hasClass('editing') && !j.hasClass('dragging')){
|
||
|
j.data('this').edit();
|
||
|
|
||
|
// Focus on the input corresponding to the field clicked
|
||
|
j.find( '.' + $(event.currentTarget).attr('fieldname') + '.editor' ).focus();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
});
|