From 57959900bc921b799deceaab82c9eb3458efbe26 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 28 Oct 2015 10:58:12 +0100 Subject: [PATCH] Small code layout improvement. --- .../controllers/_application_controller_table.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.coffee index 5e3f5799f..ac3a5d956 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.coffee @@ -355,7 +355,7 @@ class App.ControllerTable extends App.Controller if unit is '%' percentage = parseInt col.width, 10 - col.width = percentage / 100 * @el.width() + "px" + col.width = percentage / 100 * @el.width() + 'px' return col @@ -366,14 +366,14 @@ class App.ControllerTable extends App.Controller headers = _.map headers, (col) => if !col.unresizable value = parseInt col.width, 10 - col.width = Math.max(@minColWidth, value - shrinkBy) + "px" + col.width = Math.max(@minColWidth, value - shrinkBy) + 'px' return col # give left-over space from rounding to last column to get to 100% roundingLeftOver = @el.width() - @getHeaderWidths headers # but only if there is something left over (will get negative when there are too many columns for each column to stay in their min width) if roundingLeftOver > 0 - headers[headers.length - 1].width = parseInt(headers[headers.length - 1].width, 10) + roundingLeftOver + "px" + headers[headers.length - 1].width = parseInt(headers[headers.length - 1].width, 10) + roundingLeftOver + 'px' return headers @@ -383,16 +383,16 @@ class App.ControllerTable extends App.Controller , 0 getHeaderWidths: (headers) -> - widths = _.reduce headers, (memo, col, i) => + widths = _.reduce headers, (memo, col, i) => if col.width value = parseInt col.width, 10 unit = col.width.match(/[px|%]+/)[0] else # !!! sets the width to default width if not set - headers[i].width = @baseColWidth+'px' + headers[i].width = @baseColWidth + 'px' value = @baseColWidth unit = 'px' - + return if unit is 'px' then memo + value else memo , 0