     @$container.find('.cancel').click (event) =>
       @contextView.showProfile()
     
-    $(containerSelector).find('.context, .profile').click (event) =>
-      if @contextView.profileState() is 'none'
-        @contextView.expandProfile()
-      else
-        @contextView.contractProfile()
+    $(containerSelector).find('.context').click (event) =>
+      @toggleProfile()
     
     $('form#update_profile').bind 'ajax:beforeSend', (xhr, settings)=>
       @contextView.showProfile()

contextController = null

$(document).ready ->
  contextController = new ContextController('#contextPanel')

class ContextController
  constructor: (containerSelector) ->

    
    $('form#update_profile').bind 'ajax:error', (xhr, status, error)->
      $('p.alert').text(error)
  toggleProfile:  ->
    if @contextView.profileState() is 'none'
      @contextView.expandProfile()
    else
      @contextView.contractProfile()

class ContextView
  constructor: (containerSelector) ->
