Fixed lookup of relation in generic table generation.
This commit is contained in:
parent
53ae52a96c
commit
fe749fe4cc
2 changed files with 8 additions and 10 deletions
|
@ -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 ] )
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue