From fe749fe4cc5be8a49450303915b3c6057df2344a Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 7 Oct 2013 05:53:18 +0200 Subject: [PATCH] Fixed lookup of relation in generic table generation. --- .../_application_controller_generic.js.coffee | 9 --------- .../controllers/_application_controller_table.js.coffee | 9 ++++++++- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee index 342596e93..ad9ef94e9 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee @@ -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 ] ) diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee index 2f3e2ae15..66b00a909 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee @@ -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