From e4df5998f1fe9056baf0b777fe12cc703695eb18 Mon Sep 17 00:00:00 2001 From: Darwin Date: Thu, 14 Apr 2016 18:01:27 -0700 Subject: [PATCH 1/4] testing small edits --- comments.json | 11 ++++++++--- public/scripts/example.js | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/comments.json b/comments.json index 7bef77ad..95259cf1 100644 --- a/comments.json +++ b/comments.json @@ -1,12 +1,17 @@ [ { "id": 1388534400000, - "author": "Pete Hunt", - "text": "Hey there!" + "author": "Enzalutamide Phase 3", + "text": "Enzalutamide is an androgen receptor inhibitor that blocks multiple steps in the androgen receptor signaling pathway within the tumor cell.1 Enzalutamide currently is approved in the United States, Europe and numerous other countries worldwide for the treatment of patients with metastatic castration-resistant prostate cancer (CRPC), and is being further developed* for earlier stages of prostate cancer, advanced breast cancer and hepatocellular carcinoma." }, { "id": 1420070400000, - "author": "Paul O’Shannessy", + "author": "Talazoparib Phase 3", + "text": "Talazoparib, an orally available poly-ADP ribose polymerase, or PARP, inhibitor, is currently in a Phase 3 clinical trial for the treatment of patients with gBRCA mutated breast cancer (i.e., advanced breast cancer in patients whose BRCA genes contain germline mutations). In addition, we are targeting a number of other solid tumor indications in which to investigate talazoparib, including breast (beyond gBRCA mutations), prostate, small cell lung, and ovarian cancers." + }, + { + "id": 1420070400000, + "author": "Flibanserin Phase 4", "text": "React is *great*!" } ] diff --git a/public/scripts/example.js b/public/scripts/example.js index c249427a..f3422514 100644 --- a/public/scripts/example.js +++ b/public/scripts/example.js @@ -74,7 +74,7 @@ var CommentBox = React.createClass({ render: function() { return (
-

Comments

+

Clinical Trials

@@ -124,13 +124,13 @@ var CommentForm = React.createClass({
From 49a66934aeb54852b142724e83fd77796621fefd Mon Sep 17 00:00:00 2001 From: Darwin Date: Thu, 14 Apr 2016 18:41:06 -0700 Subject: [PATCH 2/4] more random edits --- comments.json | 12 ++-- public/scripts/study.js | 146 ++++++++++++++++++++++++++++++++++++++++ public/study.html | 22 ++++++ server.py | 4 +- 4 files changed, 177 insertions(+), 7 deletions(-) create mode 100644 public/scripts/study.js create mode 100644 public/study.html diff --git a/comments.json b/comments.json index 95259cf1..4e1bffcf 100644 --- a/comments.json +++ b/comments.json @@ -1,17 +1,17 @@ [ { + "text": "Enzalutamide is an androgen receptor inhibitor that blocks multiple steps in the androgen receptor signaling pathway within the tumor cell.1 Enzalutamide currently is approved in the United States, Europe and numerous other countries worldwide for the treatment of patients with metastatic castration-resistant prostate cancer (CRPC), and is being further developed* for earlier stages of prostate cancer, advanced breast cancer and hepatocellular carcinoma.", "id": 1388534400000, - "author": "Enzalutamide Phase 3", - "text": "Enzalutamide is an androgen receptor inhibitor that blocks multiple steps in the androgen receptor signaling pathway within the tumor cell.1 Enzalutamide currently is approved in the United States, Europe and numerous other countries worldwide for the treatment of patients with metastatic castration-resistant prostate cancer (CRPC), and is being further developed* for earlier stages of prostate cancer, advanced breast cancer and hepatocellular carcinoma." + "author": "Enzalutamide Phase 3" }, { + "text": "Talazoparib, an orally available poly-ADP ribose polymerase, or PARP, inhibitor, is currently in a Phase 3 clinical trial for the treatment of patients with gBRCA mutated breast cancer (i.e., advanced breast cancer in patients whose BRCA genes contain germline mutations). In addition, we are targeting a number of other solid tumor indications in which to investigate talazoparib, including breast (beyond gBRCA mutations), prostate, small cell lung, and ovarian cancers.", "id": 1420070400000, - "author": "Talazoparib Phase 3", - "text": "Talazoparib, an orally available poly-ADP ribose polymerase, or PARP, inhibitor, is currently in a Phase 3 clinical trial for the treatment of patients with gBRCA mutated breast cancer (i.e., advanced breast cancer in patients whose BRCA genes contain germline mutations). In addition, we are targeting a number of other solid tumor indications in which to investigate talazoparib, including breast (beyond gBRCA mutations), prostate, small cell lung, and ovarian cancers." + "author": "Talazoparib Phase 3" }, { + "text": "React is *great*!", "id": 1420070400000, - "author": "Flibanserin Phase 4", - "text": "React is *great*!" + "author": "Flibanserin Phase 4" } ] diff --git a/public/scripts/study.js b/public/scripts/study.js new file mode 100644 index 00000000..c9660505 --- /dev/null +++ b/public/scripts/study.js @@ -0,0 +1,146 @@ +/** + * This file provided by Facebook is for non-commercial testing and evaluation + * purposes only. Facebook reserves all rights not expressly granted. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +var Comment = React.createClass({ + rawMarkup: function() { + var rawMarkup = marked(this.props.children.toString(), {sanitize: true}); + return { __html: rawMarkup }; + }, + + render: function() { + return ( +
+

+ {this.props.author} random text +

+ +
+ ); + } +}); + +var CommentBox = React.createClass({ + loadCommentsFromServer: function() { + $.ajax({ + url: this.props.url, + dataType: 'json', + cache: false, + success: function(data) { + this.setState({data: data}); + }.bind(this), + error: function(xhr, status, err) { + console.error(this.props.url, status, err.toString()); + }.bind(this) + }); + }, + handleCommentSubmit: function(comment) { + var comments = this.state.data; + // Optimistically set an id on the new comment. It will be replaced by an + // id generated by the server. In a production application you would likely + // not use Date.now() for this and would have a more robust system in place. + comment.id = Date.now(); + var newComments = comments.concat([comment]); + this.setState({data: newComments}); + $.ajax({ + url: this.props.url, + dataType: 'json', + type: 'POST', + data: comment, + success: function(data) { + this.setState({data: data}); + }.bind(this), + error: function(xhr, status, err) { + this.setState({data: comments}); + console.error(this.props.url, status, err.toString()); + }.bind(this) + }); + }, + getInitialState: function() { + return {data: []}; + }, + componentDidMount: function() { + this.loadCommentsFromServer(); + setInterval(this.loadCommentsFromServer, this.props.pollInterval); + }, + render: function() { + return ( +
+

Clinical Trials

+ + +
+ ); + } +}); + +var CommentList = React.createClass({ + render: function() { + var commentNodes = this.props.data.map(function(comment) { + return ( + + {comment.text} adding random text + + ); + }); + return ( +
+ {commentNodes} +
+ ); + } +}); + +var CommentForm = React.createClass({ + getInitialState: function() { + return {author: '', text: ''}; + }, + handleAuthorChange: function(e) { + this.setState({author: e.target.value}); + }, + handleTextChange: function(e) { + this.setState({text: e.target.value}); + }, + handleSubmit: function(e) { + e.preventDefault(); + var author = this.state.author.trim(); + var text = this.state.text.trim(); + if (!text || !author) { + return; + } + this.props.onCommentSubmit({author: author, text: text}); + this.setState({author: '', text: ''}); + }, + render: function() { + return ( + + + + + + ); + } +}); + +ReactDOM.render( + , + document.getElementById('content') +); diff --git a/public/study.html b/public/study.html new file mode 100644 index 00000000..41295c7d --- /dev/null +++ b/public/study.html @@ -0,0 +1,22 @@ + + + + + React Tutorial + + + + + + + + + +
+ + + + diff --git a/server.py b/server.py index 5cf598df..a978a74f 100644 --- a/server.py +++ b/server.py @@ -15,6 +15,8 @@ app = Flask(__name__, static_url_path='', static_folder='public') app.add_url_rule('/', 'root', lambda: app.send_static_file('index.html')) +app.add_url_rule('/study', 'study', lambda: app.send_static_file('study.html')) + @app.route('/api/comments', methods=['GET', 'POST']) def comments_handler(): @@ -33,4 +35,4 @@ def comments_handler(): return Response(json.dumps(comments), mimetype='application/json', headers={'Cache-Control': 'no-cache', 'Access-Control-Allow-Origin': '*'}) if __name__ == '__main__': - app.run(port=int(os.environ.get("PORT",3000))) + app.run(port=int(os.environ.get("PORT", 3000))) From 76c70a726b902e37971f9ee430dd9f7981b0957a Mon Sep 17 00:00:00 2001 From: Darwin Date: Fri, 15 Apr 2016 04:22:28 -0700 Subject: [PATCH 3/4] ok fine --- comments.json | 5 - public/index.html | 6 +- public/scripts/{example.js => main.js} | 2 + public/scripts/study.js | 146 ------------------------- public/study.html | 22 ---- server.py | 1 - 6 files changed, 4 insertions(+), 178 deletions(-) rename public/scripts/{example.js => main.js} (99%) delete mode 100644 public/scripts/study.js delete mode 100644 public/study.html diff --git a/comments.json b/comments.json index 4e1bffcf..a67fead1 100644 --- a/comments.json +++ b/comments.json @@ -8,10 +8,5 @@ "text": "Talazoparib, an orally available poly-ADP ribose polymerase, or PARP, inhibitor, is currently in a Phase 3 clinical trial for the treatment of patients with gBRCA mutated breast cancer (i.e., advanced breast cancer in patients whose BRCA genes contain germline mutations). In addition, we are targeting a number of other solid tumor indications in which to investigate talazoparib, including breast (beyond gBRCA mutations), prostate, small cell lung, and ovarian cancers.", "id": 1420070400000, "author": "Talazoparib Phase 3" - }, - { - "text": "React is *great*!", - "id": 1420070400000, - "author": "Flibanserin Phase 4" } ] diff --git a/public/index.html b/public/index.html index 34ebddf4..b8d7518b 100644 --- a/public/index.html +++ b/public/index.html @@ -3,7 +3,7 @@ React Tutorial - + @@ -13,10 +13,8 @@
- + diff --git a/public/scripts/example.js b/public/scripts/main.js similarity index 99% rename from public/scripts/example.js rename to public/scripts/main.js index f3422514..7252c61e 100644 --- a/public/scripts/example.js +++ b/public/scripts/main.js @@ -22,6 +22,7 @@ var Comment = React.createClass({

{this.props.author}

+ ); @@ -131,6 +132,7 @@ var CommentForm = React.createClass({ diff --git a/public/scripts/study.js b/public/scripts/study.js deleted file mode 100644 index c9660505..00000000 --- a/public/scripts/study.js +++ /dev/null @@ -1,146 +0,0 @@ -/** - * This file provided by Facebook is for non-commercial testing and evaluation - * purposes only. Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -var Comment = React.createClass({ - rawMarkup: function() { - var rawMarkup = marked(this.props.children.toString(), {sanitize: true}); - return { __html: rawMarkup }; - }, - - render: function() { - return ( -
-

- {this.props.author} random text -

- -
- ); - } -}); - -var CommentBox = React.createClass({ - loadCommentsFromServer: function() { - $.ajax({ - url: this.props.url, - dataType: 'json', - cache: false, - success: function(data) { - this.setState({data: data}); - }.bind(this), - error: function(xhr, status, err) { - console.error(this.props.url, status, err.toString()); - }.bind(this) - }); - }, - handleCommentSubmit: function(comment) { - var comments = this.state.data; - // Optimistically set an id on the new comment. It will be replaced by an - // id generated by the server. In a production application you would likely - // not use Date.now() for this and would have a more robust system in place. - comment.id = Date.now(); - var newComments = comments.concat([comment]); - this.setState({data: newComments}); - $.ajax({ - url: this.props.url, - dataType: 'json', - type: 'POST', - data: comment, - success: function(data) { - this.setState({data: data}); - }.bind(this), - error: function(xhr, status, err) { - this.setState({data: comments}); - console.error(this.props.url, status, err.toString()); - }.bind(this) - }); - }, - getInitialState: function() { - return {data: []}; - }, - componentDidMount: function() { - this.loadCommentsFromServer(); - setInterval(this.loadCommentsFromServer, this.props.pollInterval); - }, - render: function() { - return ( -
-

Clinical Trials

- - -
- ); - } -}); - -var CommentList = React.createClass({ - render: function() { - var commentNodes = this.props.data.map(function(comment) { - return ( - - {comment.text} adding random text - - ); - }); - return ( -
- {commentNodes} -
- ); - } -}); - -var CommentForm = React.createClass({ - getInitialState: function() { - return {author: '', text: ''}; - }, - handleAuthorChange: function(e) { - this.setState({author: e.target.value}); - }, - handleTextChange: function(e) { - this.setState({text: e.target.value}); - }, - handleSubmit: function(e) { - e.preventDefault(); - var author = this.state.author.trim(); - var text = this.state.text.trim(); - if (!text || !author) { - return; - } - this.props.onCommentSubmit({author: author, text: text}); - this.setState({author: '', text: ''}); - }, - render: function() { - return ( -
- - - -
- ); - } -}); - -ReactDOM.render( - , - document.getElementById('content') -); diff --git a/public/study.html b/public/study.html deleted file mode 100644 index 41295c7d..00000000 --- a/public/study.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - React Tutorial - - - - - - - - - -
- - - - diff --git a/server.py b/server.py index a978a74f..c3b89b96 100644 --- a/server.py +++ b/server.py @@ -15,7 +15,6 @@ app = Flask(__name__, static_url_path='', static_folder='public') app.add_url_rule('/', 'root', lambda: app.send_static_file('index.html')) -app.add_url_rule('/study', 'study', lambda: app.send_static_file('study.html')) @app.route('/api/comments', methods=['GET', 'POST']) From 7a74b3c8f8cc3e6856eea383560309b2bf1c890a Mon Sep 17 00:00:00 2001 From: Darwin Date: Fri, 15 Apr 2016 04:28:08 -0700 Subject: [PATCH 4/4] title --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index b8d7518b..d375e80e 100644 --- a/public/index.html +++ b/public/index.html @@ -2,7 +2,7 @@ - React Tutorial + wikipedia.org/wiki/Clinical_trial