     @bind 'blinkTitle', (e, state) ->
       unless window.isActive
         if state == 1
-          document.title = "[new!] - #{context.title}";
+          document.title = "[new!] - #{context.title}"
           state = 0
         else
           document.title = context.title

    @bind 'topicId', ->
      current_user.topic_id = @params['id']

    # routes
    #
    @get '/', ->
      @trigger 'getAndShow',  {target: '#contents'}

    @get 'topics', ->
      @trigger 'getAndShow',  {target: 'aside'}

    @get 'topics/new', ->
      @trigger 'getAndShow', {target: 'aside'}

    @get 'topics/page/:page_id', ->
      @trigger 'getAndShow', {target: '#contents', hash: '#contents'}

    @get 'topics/:id', ->
      @trigger 'getAndShowJson', {target: '#contents', hash: '#contents', type: 'posts'}
      @trigger 'topicId'
      @trigger 'subscribeToWS',  {id: @params['id']}

    @get 'topics/:id/edit', ->
      @trigger 'getAndShow', {target: 'aside'}

    @get 'topics/:id/page/:page_id', ->
      @trigger 'getAndShow', {target: '#contents', hash: window.location.hash || '#contents'}
      @trigger 'topicId'
      @trigger 'subscribeToWS',  {id: @params['id']}

    @get 'topics/:id/posts/:post_id/edit', ->
      @trigger 'getAndReplace', {target: @params['post_id']}

    @get 'dashboard', ->
      @trigger 'getAndShow', {target: 'aside'}

    @get 'smilies', ->
      @trigger 'getAndShow', {target: 'aside'}

    @get 'smilies/new', ->
      @trigger 'getAndShow', {target: 'aside'}

    @get 'users/:id', ->
      @trigger 'getAndShowJson', {target: 'aside', type: 'user'}

    @post '/topics', ->
      @trigger 'postAndShow'
      @trigger 'emptyAside'
      return

    @post '/topics/:id/posts',->
      @trigger 'postAndAdd', { target: '#posts', hash:'#new_post'}
      return

    @put '/topics/:id/add_member',->
      @trigger 'postAndAdd'
      return

    @put '/topics/:id/rm_member',->
      @trigger 'postAndAdd'
      return

    @put 'topics/:id', ->
      @trigger 'postAndAdd', {target: '#contents'}
      return

    @put 'topics/:id/posts/:post_id', ->
      @trigger 'postAndReplace'
      return

    @del 'topics/:id/posts/:post_id', ->
      @trigger 'deletePost'
      return

    @get 'logout', (e) ->
      window.location = e.path

  $(->
    #app.run()
  )

    @bind 'hideLoadingNotification', ->
      $('.loading').hide()

    @bind 'updateTitle', ->
      title = $('.page-title').attr 'title'
      $("#page-title").html title
