diff --git a/static/js/main.js b/static/js/main.js index 1db43e0..f60531d 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -123,38 +123,44 @@ var StoryTaskForm = React.createClass({ handleSubmit: React.autoBind(function() { var text = this.refs.text.getDOMNode().value.trim(); - this.props.onTaskSubmit({description: text}); + this.props.onTaskSubmit({description: text, + storyId: this.state.storyId}); + $(".taskModal").modal('hide'); this.refs.text.getDOMNode().value = ''; return false; }), + getInitialState: function() { + return {storyId: null}; + }, + setStoryId: React.autoBind(function(id) { + this.setState({storyId: id}); + }), render: function() { return ( -
+ ); } }); var StoryData = React.createClass({ - handleTaskSubmit: React.autoBind(function (task) { - task.storyId = this.state.data.id; - $.post(baseUrl + "stories/tasks/new", task) - .done(function(data) { - if (data.status == "ok") - this.loadStoryFromServer(); - }.bind(this)); - }), loadStoryFromServer: function() { $.get(baseUrl + "stories/" + this.state.data.id) .done(this.setData.bind(this)); @@ -178,14 +184,19 @@ var StoryData = React.createClass({ render: function() { if (this.state.data) { return (