refactor sidebar and finish migration of notes

This commit is contained in:
Reinier Balt 2010-11-24 22:01:23 +01:00
parent 94b5aa2346
commit ea1ca130f1
18 changed files with 138 additions and 97 deletions

View file

@ -106,6 +106,13 @@ var IntegrationsPage = {
var NotesPage = {
setup_behavior: function() {
/* Add note */
$(".add_note_link a").live('click', function(){
$('#new-note').show();
$('textarea#note_body').val('');
$('textarea#note_body').focus();
});
/* delete button for note */
$('a.delete_note_button').live('click', function(evt){
evt.preventDefault();
@ -126,7 +133,13 @@ var NotesPage = {
/* cancel button when editing a note */
$('.edit-note-form a.negative').live('click', function(){
dom_id = this.id.substr(14);
$('#'+dom_id).toggle(); $('#edit_'+dom_id).hide();
/* dom_id == 'note_XX' on notes page and just 'note' on project page */
if (dom_id == 'note') {
$('#new-note').hide();
} else {
$('#'+dom_id).toggle();
$('#edit_'+dom_id).hide();
}
return false;
});
@ -753,12 +766,6 @@ $(document).ready(function() {
'Create a new project »', 'Add a project');
});
$(".add_note_link a").live('click', function(){
$('#new-note').show();
$('#new-note form').clearForm();
$('#new-note form input:text:first').focus();
});
$("#list-active-projects").sortable({handle: '.handle', update: update_order});
$("#list-hidden-projects").sortable({handle: '.handle', update: update_order});
$("#list-completed-projects").sortable({handle: '.handle', update: update_order});