Moved to module layer, to start not hard coded widgets, to start registured widgets.

This commit is contained in:
Martin Edenhofer 2013-02-20 08:49:46 +01:00
parent 6ea8e8e9ea
commit 73cebf8e4a
5 changed files with 14 additions and 23 deletions

View file

@ -207,3 +207,4 @@ class App.ChatWidget extends App.Controller
) )
@render() @render()
App.Config.set( 'chat', App.ChatWidget, 'Widgets' )

View file

@ -1,5 +1,3 @@
$ = jQuery.sub()
class App.Navigation extends App.Controller class App.Navigation extends App.Controller
constructor: -> constructor: ->
super super
@ -292,3 +290,5 @@ class App.Navigation extends App.Controller
} }
@Config.set( 'NavBarRight', NavBarRight ) @Config.set( 'NavBarRight', NavBarRight )
App.Config.set( 'navigation', App.Navigation, 'Widgets' )

View file

@ -1,5 +1,3 @@
$ = jQuery.sub()
class App.Notify extends Spine.Controller class App.Notify extends Spine.Controller
events: events:
'click .alert': 'destroy' 'click .alert': 'destroy'
@ -58,3 +56,4 @@ class App.Notify extends Spine.Controller
$.noty.closeAll() $.noty.closeAll()
# $(@el).find('.alert').remove(); # $(@el).find('.alert').remove();
App.Config.set( 'notify', App.Notify, 'Widgets' )

View file

@ -13,18 +13,12 @@ class App.Run extends App.Controller
# check if session already exists/try to get session data from server # check if session already exists/try to get session data from server
App.Auth.loginCheck() App.Auth.loginCheck()
# start navigation controller # start widgets
new App.Navigation( el: @el.find('#navigation') ) widgets = App.Config.get( 'Widgets' )
if widgets
# start notify controller for key, widget of widgets
new App.Notify( el: @el.find('#notify') ) @el.append('<div id="' + key + '"></div>')
new widget( el: @el.find("##{key}") )
# start content
new App.Content( el: @el.find('#content') )
# start chat
if App.ChatWidget
new App.ChatWidget( el: @el.find('#chat') )
# bind to fill selected text into # bind to fill selected text into
App.ClipBoard.bind( @el ) App.ClipBoard.bind( @el )
@ -86,3 +80,5 @@ class App.Content extends App.Controller
) )
Spine.Route.setup() Spine.Route.setup()
App.Config.set( 'content', App.Content, 'Widgets' )

View file

@ -1,10 +1,5 @@
<div id="app"> <div id="app"></div>
<div id="navigation"></div>
<div id="notify"></div>
<div id="content"></div>
<div id="chat"></div>
</div>
<div class="container"> <div class="container">
<footer class="footer"> <footer class="footer">