anchor.diff:      revert: 'invalid'
   
     $('#sidebar ul li a').droppable(dropOptions)
  -  
  +
  +  # rails ujs handlers for patient list creation
     $('#new_own_patient_list').bind
       'ajax:before': (event) ->
         $('input[type="submit"]', event.target).attr 'disabled', 'true'
  
positive.code: jQuery ($) ->
    drop = (event, ui) ->
      patientListId = $(event.target).attr 'data-patient-list-id'
      patientId     = $(ui.helper).attr 'data-patient-id'
      $.ajax
        url: "<%= Rails.application.routes.url_helpers.memberships_path %>"
        type: 'post'
  
negative.code:           membership:
              patient_list: patientListId
            patient_id:   patientId
        error: @onError
    onError: (json) ->
      if json.responseText.match /already/
        alert "Patient is already on the list"
      else
        alert "Could not add patient to list"
  
  jQuery ($) ->
    membershipController = new MembershipController
    dropOptions = 
      tolerance: 'pointer'
      hoverClass: 'drop-hover'
      drop: membershipController.receiveDrop
  
    # provide something to drag
    dragDivHelper = (event) ->
      $target = $(event.target).closest('tr')
      $("""<div class="dragging" data-patient-id="#{$target.attr('data-patient-id')}"></div>""")
        .append($target.find('td:eq(3)').clone())
        .insertAfter('#main table')
  
    $('#main table tr').draggable
      helper: dragDivHelper
      distance: 5
      cursor: 'move'
      cursorAt:
  