From aece802c32b638f805a57496a89e8ab1edc6223c Mon Sep 17 00:00:00 2001
From: Tom Willemse
Date: Sun, 7 Jul 2013 22:36:51 +0200
Subject: Reload stories immediately
Reload the stories list immediately after successfully adding a new
story.
---
static/js/main.js | 53 ++++++++++++++++++++++++++++++-----------------------
1 file changed, 30 insertions(+), 23 deletions(-)
(limited to 'static')
diff --git a/static/js/main.js b/static/js/main.js
index 60988df..255e537 100644
--- a/static/js/main.js
+++ b/static/js/main.js
@@ -221,30 +221,11 @@ var StoryRow = React.createClass({
});
var StoryTable = React.createClass({
- loadStoriesFromServer: function() {
- $.ajax({
- url: this.props.url,
- mimeType: 'textPlain',
- success: function(data) {
- this.setState({data: eval(data)});
- }.bind(this)
- });
- },
- getInitialState: function() {
- return {data: []};
- },
- componentWillMount: function() {
- this.loadStoriesFromServer();
- setInterval(
- this.loadStoriesFromServer.bind(this),
- this.props.pollInterval
- );
- },
handleMoved: React.autoBind(function(direction) {
this.loadStoriesFromServer();
}),
render: function() {
- var storyNodes = this.state.data.map(function (story) {
+ var storyNodes = this.props.data.map(function (story) {
return