         @newTaskButtonHandler()
         @newTaskFormInput.val "What do you have to do next ?"
 
+    # "new task" Button behaviour management
     newTaskButtonHandler: () ->
         if !@hasUserTyped || !@newTaskFormInput.val()
             @newTaskFormButton.addClass 'disabled'


        # If the list is empty, we need to show the form
        @taskList.tasks.on 'remove', (collection) =>
            @toggleTaskForm()

        # whether the user has written something or not in the new task form
        @hasUserTyped = false

        else
            @hideTaskForm()

    toggleTaskForm: (updatePreferences, mustFade) ->

        if @newTaskForm.is ':visible'
            @hideTaskForm(updatePreferences, mustFade)
        else
            @showTaskForm(updatePreferences, mustFade)

    showTaskForm: (updatePreferences, mustFade) ->

        if mustFade? && mustFade
            @newTaskForm.fadeIn(1000)
        else
            @newTaskForm.show()

        @toggleButton.text 'Hide the form'
        if updatePreferences? && updatePreferences
            $.cookie('todos_prefs:show_form', 'true')

    hideTaskForm: (updatePreferences, mustFade) ->

        if mustFade? && mustFade
            @newTaskForm.fadeOut(1000)
        else
            @newTaskForm.hide()

        @toggleButton.text 'Show the form'
        if updatePreferences? && updatePreferences
            $.cookie('todos_prefs:show_form', 'false')
