Fixed lookup of relation in generic table generation.

This commit is contained in:
Martin Edenhofer 2013-10-07 05:53:18 +02:00
parent 53ae52a96c
commit fe749fe4cc
2 changed files with 8 additions and 10 deletions

View file

@ -175,15 +175,6 @@ class App.ControllerGenericIndex extends App.Controller
@el.on( 'click', "[data-type=#{item.dataType}]", callback )
binds[item.dataType] = true
custom: (e) =>
e.preventDefault()
item = $(e.target).item( App[ @genericObject ] )
new App.ControllerGenericEdit(
id: item.id
pageData: @pageData
genericObject: @genericObject
)
edit: (e) =>
e.preventDefault()
item = $(e.target).item( App[ @genericObject ] )

View file

@ -86,8 +86,15 @@ class App.ControllerTable extends App.Controller
for row in overview
if attributes
for attribute in attributes
found = false
if row is attribute.name
found = true
dataTypesAttribute = _.clone(attribute)
else if row + '_id' is attribute.name
found = true
dataTypesAttribute = _.clone(attribute)
dataTypesAttribute['name'] = row
if found
dataTypesAttribute['type'] = 'link'
if !dataTypesAttribute['dataType']
dataTypesAttribute['dataType'] = 'edit'
@ -128,7 +135,7 @@ class App.ControllerTable extends App.Controller
record = App[ attribute.relation ].find( object[rowWithoutId] )
object[row.name] = record.name
@log 'debug', 'table', 'header', header, 'overview', dataTypesForCols, 'objects', data.objects
@log 'error', 'table', 'header', header, 'overview', dataTypesForCols, 'objects', data.objects
table = App.view('generic/table')(
header: header
overview: dataTypesForCols