     app.leftMiddleRegion.show(channelCollectionView)
     channelCollectionView.setActive('profile')
 
-
   showUserLarge: (user) ->
     userLargeView = new UserLargeView(model: user);
     app.leftTopRegion.show(userLargeView);

  profile_options: (username) ->
    title: 'About ' + username
    active_tab: 'show'
    mainRegion: (user) =>
      @makePermalinkEvent( user.get('username') )

      new ProfileView
        model: user
        collection: window.Channels.orderedByAuthority()
        created_facts_view: @getFactsView user.created_facts()

  notification_options: (username)->
    title: 'Notification Settings'
    active_tab: 'notification-settings'
    mainRegion: (user) ->
      new NotificationSettingsView model: user

  showPage: (username, options) ->
    app.leftBottomRegion.close()


  routes: ['showProfile', 'showNotificationSettings', 'showFact']

  onShow:   -> @profile_views = new Backbone.Factlink.DetachedViewCache
  onClose:  -> @profile_views.cleanup()
  onAction: -> @unbindFrom @permalink_event if @permalink_event?

  # CACHE HELPERS
  restoreProfileView: (username, new_callback) ->
    view = @profile_views.switchCacheView( username )
    $('body').scrollTo(@last_profile_status.scrollTop) if view == @last_profile_status?.view
    delete @last_profile_status
    @profile_views.clear()
    @profile_views.renderCacheView( username, new_callback() ) if not view?

  # ACTIONS
  showProfile: (username) -> @showPage username, @profile_options(username)
  showNotificationSettings: (username) -> @showPage username, @notification_options(username)

  showFact: (slug, fact_id)->
    @main = new TabbedMainRegionLayout();
    app.mainRegion.show(@main)

