Moved widgets to 3 categories. nav, widget and footer.

This commit is contained in:
Martin Edenhofer 2013-06-12 09:27:50 +02:00
parent 775af9315d
commit cc93ec7e3f
9 changed files with 47 additions and 29 deletions

View file

@ -12,4 +12,4 @@ class App.Footer extends App.Controller
render: () -> render: () ->
@html App.view('footer')() @html App.view('footer')()
App.Config.set( 'zzzfooter', App.Footer, 'Widgets' ) App.Config.set( 'footer', App.Footer, 'Footers' )

View file

@ -342,4 +342,4 @@ class App.Navigation extends App.Controller
@Config.set( 'NavBarRight', NavBarRight ) @Config.set( 'NavBarRight', NavBarRight )
App.Config.set( 'navigation', App.Navigation, 'Widgets' ) App.Config.set( 'navigation', App.Navigation, 'Navigations' )

View file

@ -21,24 +21,31 @@ 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 navbars
@setupWidget( 'Navigations', 'nav', @el.find('nav') )
# start widgets # start widgets
App.Event.trigger('widget:init') @setupWidget( 'Widgets', 'widget', @el.find('section') )
widgets = App.Config.get( 'Widgets' )
if widgets # start widgets
sortedKeys = [] @setupWidget( 'Footers', 'footer', @el.find('footer') )
for key, value of widgets
sortedKeys.push key
sortedKeys = sortedKeys.sort()
for key in sortedKeys
@el.append('<div id="' + key + '"></div>')
new widgets[key]( el: @el.find("##{key}") )
App.Event.trigger('widget:ready')
# bind to fill selected text into # bind to fill selected text into
App.ClipBoard.bind( @el ) App.ClipBoard.bind( @el )
App.Event.trigger('app:ready') 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('<div id="' + key + '"></div>')
new widget( el: el.find("##{key}") )
App.Event.trigger( event + ':ready')
class App.Content extends App.Controller class App.Content extends App.Controller
className: 'container' className: 'container'

View file

@ -107,7 +107,7 @@ class _Singleton extends App.Controller
# create div for permanent content # create div for permanent content
if !$("#content_permanent")[0] if !$("#content_permanent")[0]
$('#app').append('<div id="content_permanent" class="container"></div>') $('#app section').append('<div id="content_permanent" class="container"></div>')
# empty static content if task is shown # empty static content if task is shown
if active if active

View file

@ -1,4 +1,4 @@
<footer class="footer"> <div>
<p class="pull-right"><a href="javascript:window.scrollTo(0,0);"><%- @T('Back to top') %></a></p> <p class="pull-right"><a href="javascript:window.scrollTo(0,0);"><%- @T('Back to top') %></a></p>
<p><%- @T('Designed and built with all the love in the world') %> <a href="http://twitter.com/zammad_org">@zammad_org</a></p> <p><%- @T('Designed and built with all the love in the world') %> <a href="http://twitter.com/zammad_org">@zammad_org</a></p>
</footer> </div>

View file

@ -247,8 +247,7 @@ form {
} }
footer { footer {
padding-top: 17px; padding-top: 10px;
border-top: 1px solid #EEE;
} }
.search-query { .search-query {

View file

@ -1,5 +1,11 @@
<div id="app"></div> <div id="app">
<div id="splash"><div class="logo">booting...</div></div> <nav></nav>
<section></section>
<footer></footer>
</div>
<div id="splash">
<div class="logo">booting...</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
jQuery(function(){ jQuery(function(){
new App.Run(); new App.Run();

View file

@ -14,10 +14,16 @@
1.4.1) auth:login 1.4.1) auth:login
1.4.2) auth:logout 1.4.2) auth:logout
1.5) widget:init 1.5) nav:init
1.5.1) widget:ready 1.5.1) nav:ready
1.6) app:ready 1.6) widget:init
1.6.1) widget:ready
1.7) footer:init
1.7.1) footer:ready
1.8) app:ready
2) Task 2) Task

View file

@ -218,7 +218,7 @@ class AgentTicketActionSimpleTest < TestCase
# check ticket # check ticket
{ {
:execute => 'match', :execute => 'match',
:css => '.active', :css => '.content_permanent.active',
:value => 'some body 123äöü 222', :value => 'some body 123äöü 222',
:match_result => true, :match_result => true,
}, },
@ -226,22 +226,22 @@ class AgentTicketActionSimpleTest < TestCase
# update ticket # update ticket
{ {
:execute => 'select', :execute => 'select',
:css => '.active select[name="ticket_article_type_id"]', :css => '.content_permanent.active select[name="ticket_article_type_id"]',
:value => 'note', :value => 'note',
}, },
{ {
:execute => 'check', :execute => 'check',
:css => '.active textarea[name="body"]', :css => '.content_permanent.active textarea[name="body"]',
:result => true, :result => true,
}, },
{ {
:execute => 'set', :execute => 'set',
:css => '.active textarea[name="body"]', :css => '.content_permanent.active textarea[name="body"]',
:value => 'some body 1234 äöüß 222', :value => 'some body 1234 äöüß 222',
}, },
{ {
:execute => 'click', :execute => 'click',
:css => '.active button', :css => '.content_permanent.active button',
}, },
{ {
:execute => 'wait', :execute => 'wait',
@ -249,7 +249,7 @@ class AgentTicketActionSimpleTest < TestCase
}, },
{ {
:execute => 'match', :execute => 'match',
:css => '.active .ticket-answer', :css => '.content_permanent.active .ticket-answer',
:value => 'some body 1234 äöüß 222', :value => 'some body 1234 äöüß 222',
:match_result => true, :match_result => true,
}, },