From d6a9873bd04065cbbdbcec04f5cbd6ed19d5b877 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Fri, 18 Dec 2015 15:13:01 +0100 Subject: [PATCH] Use object to construct TransitionModel to improve readability --- .../accordion_list_item_table_editions.js | 7 ++++++- js/components/ascribe_table/models/table_models.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js b/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js index 761134e3..1477239f 100644 --- a/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js +++ b/js/components/ascribe_accordion_list/accordion_list_item_table_editions.js @@ -113,7 +113,12 @@ let AccordionListItemTableEditions = React.createClass({ showExpandOption = true; } - let transition = new TransitionModel('editions', 'editionId', 'bitcoin_id', (e) => e.stopPropagation() ); + const transition = new TransitionModel({ + to: 'editions', + queryKey: 'editionId', + valueKey: 'bitcoin_id', + callback: (e) => e.stopPropagation() + }); const columnList = [ new ColumnModel( diff --git a/js/components/ascribe_table/models/table_models.js b/js/components/ascribe_table/models/table_models.js index b675d14e..9083b911 100644 --- a/js/components/ascribe_table/models/table_models.js +++ b/js/components/ascribe_table/models/table_models.js @@ -28,7 +28,7 @@ export class ColumnModel { * our selfes, using this TransitionModel. */ export class TransitionModel { - constructor(to, queryKey, valueKey, callback) { + constructor({ to, queryKey, valueKey, callback }) { this.to = to; this.queryKey = queryKey; this.valueKey = valueKey; @@ -38,4 +38,4 @@ export class TransitionModel { toReactRouterLink(queryValue) { return '/' + this.to + '/' + queryValue; } -} \ No newline at end of file +}