Small code layout improvemetns.

This commit is contained in:
Martin Edenhofer 2012-04-13 15:47:42 +02:00
parent 88a7f3d27d
commit f1c934caa4

View file

@ -10,7 +10,6 @@ class App.ControllerGenericNew extends App.ControllerModal
@render() @render()
render: -> render: ->
@log 'ren new', @el
@html App.view('generic/admin/new')( @html App.view('generic/admin/new')(
form: @formGen( model: @genericObject ), form: @formGen( model: @genericObject ),
head: 'New ' + @pageData.object head: 'New ' + @pageData.object
@ -90,6 +89,7 @@ class App.ControllerGenericEdit extends App.ControllerModal
@modalHide() @modalHide()
error: => error: =>
@log 'errors' @log 'errors'
@modalHide() @modalHide()
) )
@ -189,7 +189,7 @@ class App.ControllerLevel2 extends App.Controller
super super
render: -> render: ->
@log 'ttt', @target, @
# set title # set title
@title @page.title @title @page.title
@navupdate @page.nav @navupdate @page.nav
@ -200,21 +200,20 @@ class App.ControllerLevel2 extends App.Controller
type: @type, type: @type,
target: @target, target: @target,
) )
if !@target
@target = @menu[0]['target']
for menu in @menu for menu in @menu
@el.find('.nav-tab-content').append('<div class="tabbable" id="' + menu.target + '">' + menu.name + '</div>') @el.find('.nav-tab-content').append('<div class="tabbable" id="' + menu.target + '"></div>')
if menu.controller if menu.controller && ( @toggleable is true || ( @toggleable is false && menu.target is @target ) )
params = menu.params || {} params = menu.params || {}
params.el = @el.find( '#' + menu.target ) params.el = @el.find( '#' + menu.target )
new menu.controller( params ) new menu.controller( params )
@el.find('.tabbable').addClass('hide') @el.find('.tabbable').addClass('hide')
if @target
@el.find( '#' + @target ).removeClass('hide') @el.find( '#' + @target ).removeClass('hide')
else @el.find('[data-toggle="tabnav"][href*="/' + @target + '"]').parent().addClass('active')
@el.find('.tabbable:first').removeClass('hide')
@el.find('[data-toggle="tabnav"]:first').addClass('active')
toggle: (e) -> toggle: (e) ->
return true if @toggleable is false return true if @toggleable is false
@ -237,7 +236,7 @@ class App.ControllerTabs extends App.Controller
@el.find('.nav-tabs li:first').addClass('active') @el.find('.nav-tabs li:first').addClass('active')
for tab in @tabs for tab in @tabs
@el.find('.tab-content').append('<div class="tab-pane" id="' + tab.target + '">' + tab.target + '</div>') @el.find('.tab-content').append('<div class="tab-pane" id="' + tab.target + '"></div>')
if tab.controller if tab.controller
params = tab.params || {} params = tab.params || {}
params.el = @el.find( '#' + tab.target ) params.el = @el.find( '#' + tab.target )