From cc93ec7e3f1aa007a4a741d3edaaf9b51fff9d9b Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 12 Jun 2013 09:27:50 +0200 Subject: [PATCH] Moved widgets to 3 categories. nav, widget and footer. --- .../app/controllers/footer.js.coffee | 2 +- .../app/controllers/navigation.js.coffee | 2 +- .../lib/app_post/interface_handle.js.coffee | 29 ++++++++++++------- .../app/lib/app_post/task_manager.js.coffee | 2 +- .../javascripts/app/views/footer.jst.eco | 4 +-- app/assets/stylesheets/zzz.css | 3 +- app/views/init/index.html.erb | 10 +++++-- doc/app_events.txt | 12 ++++++-- .../agent_ticket_actions_simple_test.rb | 12 ++++---- 9 files changed, 47 insertions(+), 29 deletions(-) diff --git a/app/assets/javascripts/app/controllers/footer.js.coffee b/app/assets/javascripts/app/controllers/footer.js.coffee index c0e146899..7cde64fb9 100644 --- a/app/assets/javascripts/app/controllers/footer.js.coffee +++ b/app/assets/javascripts/app/controllers/footer.js.coffee @@ -12,4 +12,4 @@ class App.Footer extends App.Controller render: () -> @html App.view('footer')() -App.Config.set( 'zzzfooter', App.Footer, 'Widgets' ) +App.Config.set( 'footer', App.Footer, 'Footers' ) diff --git a/app/assets/javascripts/app/controllers/navigation.js.coffee b/app/assets/javascripts/app/controllers/navigation.js.coffee index 91e22ea7a..c7fbe4a5d 100644 --- a/app/assets/javascripts/app/controllers/navigation.js.coffee +++ b/app/assets/javascripts/app/controllers/navigation.js.coffee @@ -342,4 +342,4 @@ class App.Navigation extends App.Controller @Config.set( 'NavBarRight', NavBarRight ) -App.Config.set( 'navigation', App.Navigation, 'Widgets' ) +App.Config.set( 'navigation', App.Navigation, 'Navigations' ) diff --git a/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee b/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee index 1cfa88692..bb9ffbf99 100644 --- a/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee @@ -21,24 +21,31 @@ class App.Run extends App.Controller # check if session already exists/try to get session data from server App.Auth.loginCheck() + # start navbars + @setupWidget( 'Navigations', 'nav', @el.find('nav') ) + # start widgets - App.Event.trigger('widget:init') - widgets = App.Config.get( 'Widgets' ) - if widgets - sortedKeys = [] - for key, value of widgets - sortedKeys.push key - sortedKeys = sortedKeys.sort() - for key in sortedKeys - @el.append('
') - new widgets[key]( el: @el.find("##{key}") ) - App.Event.trigger('widget:ready') + @setupWidget( 'Widgets', 'widget', @el.find('section') ) + + # start widgets + @setupWidget( 'Footers', 'footer', @el.find('footer') ) # bind to fill selected text into App.ClipBoard.bind( @el ) App.Event.trigger('app:ready') + setupWidget: (config, event, el) -> + + # start widgets + App.Event.trigger( event + ':init') + widgets = App.Config.get( config ) + if widgets + for key, widget of widgets + el.append('
') + new widget( el: el.find("##{key}") ) + App.Event.trigger( event + ':ready') + class App.Content extends App.Controller className: 'container' diff --git a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee index 68f3744e7..8a36cf315 100644 --- a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee @@ -107,7 +107,7 @@ class _Singleton extends App.Controller # create div for permanent content if !$("#content_permanent")[0] - $('#app').append('
') + $('#app section').append('
') # empty static content if task is shown if active diff --git a/app/assets/javascripts/app/views/footer.jst.eco b/app/assets/javascripts/app/views/footer.jst.eco index dc72ac441..c16b158da 100644 --- a/app/assets/javascripts/app/views/footer.jst.eco +++ b/app/assets/javascripts/app/views/footer.jst.eco @@ -1,4 +1,4 @@ - + diff --git a/app/assets/stylesheets/zzz.css b/app/assets/stylesheets/zzz.css index c0501e234..327529538 100644 --- a/app/assets/stylesheets/zzz.css +++ b/app/assets/stylesheets/zzz.css @@ -247,8 +247,7 @@ form { } footer { - padding-top: 17px; - border-top: 1px solid #EEE; + padding-top: 10px; } .search-query { diff --git a/app/views/init/index.html.erb b/app/views/init/index.html.erb index 113f0a8de..8d1cfe9cc 100644 --- a/app/views/init/index.html.erb +++ b/app/views/init/index.html.erb @@ -1,5 +1,11 @@ -
-
+
+ +
+
+
+
+ +