Commit 09a5b84e authored by Pascal Hartig's avatar Pascal Hartig

Merge pull request #1055 from tastejs/react-upgrade-012

React 0.12 upgrade
parents 6b6a0fe7 0af300fe
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
"dependencies": { "dependencies": {
"todomvc-common": "~0.3.0", "todomvc-common": "~0.3.0",
"director": "~1.2.0", "director": "~1.2.0",
"react": "~0.11.0" "react": "~0.12.0"
} }
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* @jsx React.DOM
*/
/*jshint quotmark:false */ /*jshint quotmark:false */
/*jshint white:false */ /*jshint white:false */
/*jshint trailing:false */ /*jshint trailing:false */
...@@ -42,14 +39,14 @@ var app = app || {}; ...@@ -42,14 +39,14 @@ var app = app || {};
return; return;
} }
event.preventDefault();
var val = this.refs.newField.getDOMNode().value.trim(); var val = this.refs.newField.getDOMNode().value.trim();
if (val) { if (val) {
this.props.model.addTodo(val); this.props.model.addTodo(val);
this.refs.newField.getDOMNode().value = ''; this.refs.newField.getDOMNode().value = '';
} }
return false;
}, },
toggleAll: function (event) { toggleAll: function (event) {
...@@ -171,7 +168,7 @@ var app = app || {}; ...@@ -171,7 +168,7 @@ var app = app || {};
var model = new app.TodoModel('react-todos'); var model = new app.TodoModel('react-todos');
function render() { function render() {
React.renderComponent( React.render(
<TodoApp model={model}/>, <TodoApp model={model}/>,
document.getElementById('todoapp') document.getElementById('todoapp')
); );
......
/**
* @jsx React.DOM
*/
/*jshint quotmark:false */ /*jshint quotmark:false */
/*jshint white:false */ /*jshint white:false */
/*jshint trailing:false */ /*jshint trailing:false */
......
/**
* @jsx React.DOM
*/
/*jshint quotmark: false */ /*jshint quotmark: false */
/*jshint white: false */ /*jshint white: false */
/*jshint trailing: false */ /*jshint trailing: false */
...@@ -15,7 +12,7 @@ var app = app || {}; ...@@ -15,7 +12,7 @@ var app = app || {};
var ENTER_KEY = 13; var ENTER_KEY = 13;
app.TodoItem = React.createClass({ app.TodoItem = React.createClass({
handleSubmit: function () { handleSubmit: function (event) {
var val = this.state.editText.trim(); var val = this.state.editText.trim();
if (val) { if (val) {
this.props.onSave(val); this.props.onSave(val);
...@@ -23,7 +20,6 @@ var app = app || {}; ...@@ -23,7 +20,6 @@ var app = app || {};
} else { } else {
this.props.onDestroy(); this.props.onDestroy();
} }
return false;
}, },
handleEdit: function () { handleEdit: function () {
...@@ -42,9 +38,9 @@ var app = app || {}; ...@@ -42,9 +38,9 @@ var app = app || {};
handleKeyDown: function (event) { handleKeyDown: function (event) {
if (event.which === ESCAPE_KEY) { if (event.which === ESCAPE_KEY) {
this.setState({editText: this.props.todo.title}); this.setState({editText: this.props.todo.title});
this.props.onCancel(); this.props.onCancel(event);
} else if (event.which === ENTER_KEY) { } else if (event.which === ENTER_KEY) {
this.handleSubmit(); this.handleSubmit(event);
} }
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment