Commit bf18ccb5 authored by Cheng Lou's avatar Cheng Lou

[React] New react-backbone todomvc with fixes and React version bump

Like #855, bumped React version (along with all the other deps) and made
some fixes.
parent 904aa5a8
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
"name": "todomvc-react-backbone", "name": "todomvc-react-backbone",
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"react": "~0.8.0", "react": "~0.9.0",
"todomvc-common": "~0.1.9", "backbone": "~1.1.2",
"backbone": "~1.1.0",
"backbone.localstorage": "~1.1.7", "backbone.localstorage": "~1.1.7",
"jquery": "~2.0.3", "jquery": "~2.1.0",
"underscore": "~1.5.2" "todomvc-common": "~0.1.9",
"underscore": "~1.6.0"
} }
} }
// Backbone.js 1.1.1 // Backbone.js 1.1.2
// (c) 2010-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors // (c) 2010-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Backbone may be freely distributed under the MIT license. // Backbone may be freely distributed under the MIT license.
...@@ -17,9 +17,8 @@ ...@@ -17,9 +17,8 @@
// Next for Node.js or CommonJS. jQuery may not be needed as a module. // Next for Node.js or CommonJS. jQuery may not be needed as a module.
} else if (typeof exports !== 'undefined') { } else if (typeof exports !== 'undefined') {
var _ = require('underscore'), $; var _ = require('underscore');
try { $ = require('jquery'); } catch(e) {} factory(root, exports, _);
factory(root, exports, _, $);
// Finally, as a browser global. // Finally, as a browser global.
} else { } else {
...@@ -42,7 +41,7 @@ ...@@ -42,7 +41,7 @@
var splice = array.splice; var splice = array.splice;
// Current version of the library. Keep in sync with `package.json`. // Current version of the library. Keep in sync with `package.json`.
Backbone.VERSION = '1.1.1'; Backbone.VERSION = '1.1.2';
// For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns // For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
// the `$` variable. // the `$` variable.
...@@ -1293,7 +1292,7 @@ ...@@ -1293,7 +1292,7 @@
return optional ? match : '([^/?]+)'; return optional ? match : '([^/?]+)';
}) })
.replace(splatParam, '([^?]*?)'); .replace(splatParam, '([^?]*?)');
return new RegExp('^' + route + '(?:\\?(.*))?$'); return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$');
}, },
// Given a route, and a URL fragment that it matches, return the array of // Given a route, and a URL fragment that it matches, return the array of
...@@ -1450,7 +1449,7 @@ ...@@ -1450,7 +1449,7 @@
// but possibly useful for unit testing Routers. // but possibly useful for unit testing Routers.
stop: function() { stop: function() {
Backbone.$(window).off('popstate', this.checkUrl).off('hashchange', this.checkUrl); Backbone.$(window).off('popstate', this.checkUrl).off('hashchange', this.checkUrl);
clearInterval(this._checkUrlInterval); if (this._checkUrlInterval) clearInterval(this._checkUrlInterval);
History.started = false; History.started = false;
}, },
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<script src="bower_components/todomvc-common/base.js"></script> <script src="bower_components/todomvc-common/base.js"></script>
<script src="bower_components/react/react-with-addons.js"></script> <script src="bower_components/react/react-with-addons.js"></script>
<script src="bower_components/react/JSXTransformer.js"></script> <script src="bower_components/react/JSXTransformer.js"></script>
<script src="bower_components/jquery/jquery.js"></script> <script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/underscore/underscore.js"></script> <script src="bower_components/underscore/underscore.js"></script>
<script src="bower_components/backbone/backbone.js"></script> <script src="bower_components/backbone/backbone.js"></script>
<script src="bower_components/backbone.localStorage/backbone.localStorage.js"></script> <script src="bower_components/backbone.localStorage/backbone.localStorage.js"></script>
......
...@@ -74,7 +74,6 @@ var app = app || {}; ...@@ -74,7 +74,6 @@ var app = app || {};
Backbone.history.start(); Backbone.history.start();
this.props.todos.fetch(); this.props.todos.fetch();
this.refs.newField.getDOMNode().focus();
}, },
componentDidUpdate: function () { componentDidUpdate: function () {
...@@ -203,6 +202,7 @@ var app = app || {}; ...@@ -203,6 +202,7 @@ var app = app || {};
id="new-todo" id="new-todo"
placeholder="What needs to be done?" placeholder="What needs to be done?"
onKeyDown={this.handleNewTodoKeyDown} onKeyDown={this.handleNewTodoKeyDown}
autoFocus={true}
/> />
</header> </header>
{main} {main}
......
...@@ -21,7 +21,7 @@ var app = app || {}; ...@@ -21,7 +21,7 @@ var app = app || {};
<button <button
id="clear-completed" id="clear-completed"
onClick={this.props.onClearCompleted}> onClick={this.props.onClearCompleted}>
{''}Clear completed ({this.props.completedCount}){''} Clear completed ({this.props.completedCount})
</button> </button>
); );
} }
...@@ -32,8 +32,7 @@ var app = app || {}; ...@@ -32,8 +32,7 @@ var app = app || {};
return ( return (
<footer id="footer"> <footer id="footer">
<span id="todo-count"> <span id="todo-count">
<strong>{this.props.count}</strong> <strong>{this.props.count}</strong> {activeTodoWord} left
{' '}{activeTodoWord}{' '}left{''}
</span> </span>
<ul id="filters"> <ul id="filters">
<li> <li>
......
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