Permalink
Browse files

Format questions

  • Loading branch information...
andrewdotn committed Aug 21, 2016
1 parent 6dc5466 commit 4ba8f0ad16afc44233c88e0b1bc62f2ca9674aa9
Showing with 14 additions and 4 deletions.
  1. +14 −4 polls_react/polls/templates/polls/index.html
@@ -12,16 +12,26 @@ <h1>New style</h1>
<script src="{% static 'jquery.min.js' %}"></script>
<script type="text/babel">
var pollsData = {{ polls_data|json }};
var Question = React.createClass({
render: function() {
return (<li>{ this.props.data.question_text }</li>);
}
});
var PollBox = React.createClass({
render: function() {
var questionNodes = this.props.data.map(function(question) {
return (<Question data={question}/>);
});
return (
<textarea cols="80" rows="25"
value={JSON.stringify(pollsData)} readOnly>
</textarea>);
<ul>{ questionNodes }</ul>
);
}
});
ReactDOM.render(
<PollBox/>,
<PollBox data={pollsData}/>,
document.getElementById('pollsContent')
);
</script>

0 comments on commit 4ba8f0a

Please sign in to comment.