From 9df585ee37c48961e94c70f807cdf3d82fa0d79e Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 11 Apr 2012 09:18:51 +0200 Subject: [PATCH] Small improvements. --- .../javascripts/app/controllers/login.js.coffee | 16 ++++------------ .../app/controllers/navigation.js.coffee | 8 ++++---- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/app/controllers/login.js.coffee b/app/assets/javascripts/app/controllers/login.js.coffee index 328cae302..20799e5ae 100644 --- a/app/assets/javascripts/app/controllers/login.js.coffee +++ b/app/assets/javascripts/app/controllers/login.js.coffee @@ -1,10 +1,4 @@ $ = jQuery.sub() -Note = App.Note - -$.fn.item = -> - elementID = $(@).data('id') - elementID or= $(@).parents('[data-id]').data('id') - Note.find(elementID) class Index extends App.Controller events: @@ -63,13 +57,16 @@ class Index extends App.Controller Spine.trigger 'navrebuild', data.session + # rebuild navbar with updated ticket count of overviews + Spine.trigger 'navupdate_remote' + # add notify Spine.trigger 'notify:removeall' Spine.trigger 'notify', { type: 'success', msg: 'Login successfully! Have a nice day!', } - + # redirect to # if window.Config['requested_url'] isnt '' @navigate window.Config['requested_url'] @@ -96,8 +93,3 @@ class Index extends App.Controller ) Config.Routes['login'] = Index - -#class App.Login extends App.Router -# routes: -# 'login': Index -#Config.Controller.push App.Login \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/navigation.js.coffee b/app/assets/javascripts/app/controllers/navigation.js.coffee index cb05e8e26..9c954d7c1 100644 --- a/app/assets/javascripts/app/controllers/navigation.js.coffee +++ b/app/assets/javascripts/app/controllers/navigation.js.coffee @@ -15,14 +15,14 @@ class App.Navigation extends Spine.Controller Spine.bind 'navrebuild', (user) => @log 'navbarrebuild', user @render(user) - @delay( @sync, 1600 ) Spine.bind 'navupdate_remote', (user) => @log 'navupdate_remote' - @sync + @delay( @sync, 500 ) # rerender if new overview data is there - @delay( @sync, 1600 ) + @delay( @sync, 800 ) + @delay( @sync, 2000 ) render: (user) -> # @log 'nav render', Config.NavBar @@ -121,7 +121,7 @@ class App.Navigation extends Spine.Controller clearInterval(@intervalID) if @intervalID # request new data - @intervalID = every 40000, () => + @intervalID = every 30000, () => @ticket_overview() # get data