 
     @context.on 'dblclick', "##{@identifier}", (event) ->
       newValue = prompt 'New value'
-      @task = newValue
-      $('p', "##{self.identifier}").html newValue
+      self.update newValue
 
   toString : ->
     @task

    task.display()
    @tasks.push task

class Task
  constructor : (@task, @context) ->
    @identifier = @generateIdentifier()

    "<div id=\"#{@identifier}\" style=\"display: none\">#{@generateInnerHtml()}</div>"

  generateInnerHtml : ->
    "<input type=\"checkbox\" style=\"float: left; width: 20px;\" /> 
      &nbsp;
      <p style=\"float: left\">#{@toString()}</p>
      <div style=\"clear: both\"></div>"

  generateEditHtml : ->
    "<input type=\"text\" value=\"#{@toString()}\" />"
