Small code layout improvemetns.
This commit is contained in:
parent
88a7f3d27d
commit
f1c934caa4
1 changed files with 15 additions and 16 deletions
|
@ -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()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -148,15 +148,15 @@ class App.ControllerGenericIndex extends App.Controller
|
||||||
)
|
)
|
||||||
|
|
||||||
@html App.view('generic/admin/index')(
|
@html App.view('generic/admin/index')(
|
||||||
head: @pageData.objects,
|
head: @pageData.objects,
|
||||||
notes: @pageData.notes,
|
notes: @pageData.notes,
|
||||||
buttons: @pageData.buttons,
|
buttons: @pageData.buttons,
|
||||||
menus: @pageData.menus,
|
menus: @pageData.menus,
|
||||||
)
|
)
|
||||||
|
|
||||||
# append content table
|
# append content table
|
||||||
table = @table(
|
table = @table(
|
||||||
model: @genericObject,
|
model: @genericObject,
|
||||||
objects: objects,
|
objects: objects,
|
||||||
)
|
)
|
||||||
@el.find('.table-overview').append(table)
|
@el.find('.table-overview').append(table)
|
||||||
|
@ -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')
|
@el.find('[data-toggle="tabnav"][href*="/' + @target + '"]').parent().addClass('active')
|
||||||
else
|
|
||||||
@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 )
|
||||||
|
|
Loading…
Reference in a new issue