         "<li><span class='fa fa-fw " + item.icon + "'></span> " + item.name + "</li>"
 
     $('.token-input-list').hide()  if (current_id isnt null) and (title is '') or (controller_action == 'edit')
+
+    resetNoteForm(reset_content)
+
+    $('#note_cancel').on 'click', ->
+      resetNoteForm(reset_content)

jQuery ->
  controller_name = $('body').data('controller')
  controller_action = $('body').data('action')
  if controller_name == 'notes' || controller_name == 'activities' || controller_name == 'people'
    resetNoteForm(controller_action)

    $('#note_cancel').on 'click', ->
      resetNoteForm(controller_action)

    audience_path = $('#note_object_ids').data('source')
    title = $('#note_object_ids').data('title')

# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

@resetNoteForm = (reset_content = true) ->
  $('#note_content').removeAttr('style')

  if reset_content is true
    $('#note_content').val('')
    $('#note_actions').hide()

  $('#note_object_ids').tokenInput 'clear'

  $('#note_content').on 'click focus', ->
    $('#note_actions').show()
