From 9a0a461edbd3631e27319d3e82e3a5fd6941bb46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20=C3=98sthus?= Date: Mon, 3 Nov 2014 21:37:40 +0100 Subject: [PATCH] Refactored all ```handleFoo``` to ```onFoo``` based on feedback from @jari --- public/js/components/ErrorMessages.jsx | 31 +++++++++---------- public/js/components/TabView.jsx | 4 +-- public/js/components/form/TextInput.jsx | 2 +- .../strategy/StrategiesComponent.jsx | 14 ++++----- .../js/components/strategy/StrategyForm.jsx | 10 +++--- 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/public/js/components/ErrorMessages.jsx b/public/js/components/ErrorMessages.jsx index e7340a31a2..cf3b0ff58b 100644 --- a/public/js/components/ErrorMessages.jsx +++ b/public/js/components/ErrorMessages.jsx @@ -12,23 +12,22 @@ var ErrorMessages = React.createClass({ return (
-
-
-
-
-
- - -
-
-
    {errorNodes}
-
-
+
+
+
+
+
+ + +
+
+
    {errorNodes}
+
+
+
+
-
-
); } diff --git a/public/js/components/TabView.jsx b/public/js/components/TabView.jsx index f07695a27f..dc031a68a7 100644 --- a/public/js/components/TabView.jsx +++ b/public/js/components/TabView.jsx @@ -21,7 +21,7 @@ var TabView = React.createClass({ return {activeTab: activeTab}; }, - handleChangeTab: function(tabPane) { + onChangeTab: function(tabPane) { this.setState({activeTab: tabPane}); }, @@ -30,7 +30,7 @@ var TabView = React.createClass({ return (
  • {tabPane.name} + onClick={this.onChangeTab.bind(this, tabPane)}>{tabPane.name}
  • ); diff --git a/public/js/components/form/TextInput.jsx b/public/js/components/form/TextInput.jsx index 739a9bf429..49af299b30 100644 --- a/public/js/components/form/TextInput.jsx +++ b/public/js/components/form/TextInput.jsx @@ -27,7 +27,7 @@ var TextInput = React.createClass({ render: function() { return ( -
    +
    ) + return () }, renderCreateButton: function() { return ( - + ); } }); diff --git a/public/js/components/strategy/StrategyForm.jsx b/public/js/components/strategy/StrategyForm.jsx index 2a46c3f790..4c6e66679a 100644 --- a/public/js/components/strategy/StrategyForm.jsx +++ b/public/js/components/strategy/StrategyForm.jsx @@ -32,17 +32,17 @@ var StrategyForm = React.createClass({ } }); - this.props.handleSave(strategy); + this.props.onSave(strategy); }, - handleAddParam: function(event) { + onAddParam: function(event) { event.preventDefault(); var id = this.state.parameters.length + 1; var params = this.state.parameters.concat([{id:id, name: "param_" + id, label: "Parameter " +id}]); this.setState({parameters: params}); }, - handleRemoveParam: function(event) { + onRemoveParam: function(event) { event.preventDefault(); var id = this.state.parameters.length + 1; var params = this.state.parameters.slice(0, -1); @@ -118,14 +118,14 @@ var StrategyForm = React.createClass({ renderAddLink: function() { if(this.state.parameters.length < this.props.maxParams) { - return + Add required parameter; + return + Add required parameter; } }, renderRemoveLink: function() { if(this.state.parameters.length > 0) { return ( ); }