{"action":"created","comment":{"url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/pulls/comments/26896692","id":26896692,"diff_hunk":"@@ -0,0 +1,200 @@\n+\"use strict\";\n+/*global React*/\n+\n+var FormPage = React.createClass({\n+  getInitialState: function() {\n+    return({ShopList: []});\n+  },\n+  componentDidMount: function() {\n+\n+    //BTW: currently loads most recent list on refresh\n+\n+    $.getJSON('/shoppinglist/getlist', function(data) {\n+      this.setState({ShopList: data});\n+      console.log('ShopList');\n+      console.log(data);\n+    }.bind(this));\n+  },\n+  render: function() {\n+    var showList = [];\n+    var currList = this.state.ShopList;\n+    console.log('currList');\n+    console.log(currList[currList.length-1]);\n+    var currTitle = '';\n+    if (currList.length > 0) {\n+    currTitle = currList[currList.length-1].shoplisttitle;\n+    console.log('currtitle');\n+    console.log(currTitle);\n+      for (var i = 0; i < currList[currList.length-1].items.length; i++) {\n+        showList.push(<tr>);\n+        showList.push(<td>{currList[currList.length-1].items[i].owner}</td>);\n+        showList.push(<td>{currList[currList.length-1].items[i].item}</td>);\n+        showList.push(<td><button onClick={this._handleDelete} rel={currList[currList.length-1].items[i]._id} className=\"btn btn-primary\">x</button></td>);\n+        showList.push(</tr>);\n+    }\n+    }\n+    return (\n+    <div>\n+    <form>\n+      <input type=\"text\" ref=\"namefield\" placeholder=\"enter name..\"/>\n+      <br/>\n+      <textarea rows=\"10\" cols=\"80\" ref=\"itemfield\" placeholder=\"enter item..\"/>\n+      <br/>\n+      <button className=\"btn btn-primary\" onClick={this._addItems}>add item(s)</button>\n+      <button className=\"btn btn-primary\" onClick={this._createNew}>create new list</button>\n+      <button id=\"titlesubmit\" className=\"btn btn-primary\" style={{display:'none'}} onClick={this._postNew}>post new list</button>\n+    </form>\n+    <table className=\"table\">\n+      <thead>\n+      <h1>{currTitle}</h1>\n+      </thead>\n+      <tbody>\n+        {showList}\n+      </tbody>\n+    </table>\n+    </div>\n+   );\n+  },\n+  _handleDelete: function(event){\n+    event.preventDefault();\n+    console.log('inside DELETE');\n+    var itemId = $(event.target).attr('rel');\n+    $.ajax({\n+      type: 'DELETE',\n+      url: '/shoppinglist/deleteitem/' + itemId,\n+      success: function(shoptitle) {\n+        console.log('success DELETE');\n+\n+        console.log('current shoplist title');\n+        console.log(shoptitle);\n+\n+        $.getJSON('/shoppinglist/getlist', function(data) {\n+          console.log('in GET in DELETE');\n+          console.log('data');\n+          console.log(data);\n+\n+          data.forEach( function(shopObj) {\n+            console.log('shoplisttitle of shopobj');\n+            console.log(shopObj.shoplisttitle);\n+\n+            if (shopObj.shoplisttitle === shoptitle) {\n+\n+              this.setState({ShopList: [shopObj]});\n+            }\n+          }.bind(this));\n+\n+        }.bind(this));\n+\n+      }.bind(this),\n+      error: function(xhr, status, err) {\n+        console.error(this.props.url, status, err.toString());\n+      }.bind(this)\n+    });\n+  },\n+  _createNew: function(event) {\n+    event.preventDefault();\n+    $('#titlefield').val = '';\n+    $('#titlefield').show();\n+    $('#titlesubmit').show();\n+  },\n+  _postNew: function(event) {\n+    event.preventDefault();\n+    console.log('submitting new');\n+    var addTitle = $('#titlefield').val();\n+    var addName = this.refs.namefield.getDOMNode().value.trim();\n+    var addItems = this.refs.itemfield.getDOMNode().value.trim();\n+\n+    $('#titlefield').hide();\n+    $('#titlesubmit').hide();\n+    this.refs.namefield.getDOMNode().value = '';\n+    this.refs.itemfield.getDOMNode().value = '';\n+    var x = new Date();","path":"public/javascripts/shoppinglist.js","position":111,"original_position":111,"commit_id":"31d18414ff01f9f72a1b9f814ee7be6bbe77d83e","original_commit_id":"31d18414ff01f9f72a1b9f814ee7be6bbe77d83e","user":{"login":"feynmanliang","id":990069,"avatar_url":"https://avatars.githubusercontent.com/u/990069?v=3","gravatar_id":"","url":"https://api.github.com/users/feynmanliang","html_url":"https://github.com/feynmanliang","followers_url":"https://api.github.com/users/feynmanliang/followers","following_url":"https://api.github.com/users/feynmanliang/following{/other_user}","gists_url":"https://api.github.com/users/feynmanliang/gists{/gist_id}","starred_url":"https://api.github.com/users/feynmanliang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feynmanliang/subscriptions","organizations_url":"https://api.github.com/users/feynmanliang/orgs","repos_url":"https://api.github.com/users/feynmanliang/repos","events_url":"https://api.github.com/users/feynmanliang/events{/privacy}","received_events_url":"https://api.github.com/users/feynmanliang/received_events","type":"User","site_admin":false},"body":"Variable names","created_at":"2015-03-21T20:49:03Z","updated_at":"2015-03-21T20:49:03Z","html_url":"https://github.com/Niole-Daycare/Shopping-List/pull/2#discussion_r26896692","pull_request_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/Niole-Daycare/Shopping-List/pulls/comments/26896692"},"html":{"href":"https://github.com/Niole-Daycare/Shopping-List/pull/2#discussion_r26896692"},"pull_request":{"href":"https://api.github.com/repos/Niole-Daycare/Shopping-List/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/pulls/2","id":31677804,"html_url":"https://github.com/Niole-Daycare/Shopping-List/pull/2","diff_url":"https://github.com/Niole-Daycare/Shopping-List/pull/2.diff","patch_url":"https://github.com/Niole-Daycare/Shopping-List/pull/2.patch","issue_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/issues/2","number":2,"state":"open","locked":false,"title":"Updated delete post get","user":{"login":"niole","id":6508755,"avatar_url":"https://avatars.githubusercontent.com/u/6508755?v=3","gravatar_id":"","url":"https://api.github.com/users/niole","html_url":"https://github.com/niole","followers_url":"https://api.github.com/users/niole/followers","following_url":"https://api.github.com/users/niole/following{/other_user}","gists_url":"https://api.github.com/users/niole/gists{/gist_id}","starred_url":"https://api.github.com/users/niole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niole/subscriptions","organizations_url":"https://api.github.com/users/niole/orgs","repos_url":"https://api.github.com/users/niole/repos","events_url":"https://api.github.com/users/niole/events{/privacy}","received_events_url":"https://api.github.com/users/niole/received_events","type":"User","site_admin":false},"body":"open for constructive criticism!","created_at":"2015-03-21T20:43:43Z","updated_at":"2015-03-21T20:49:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"40efd4e0846b61050e1fd1f404eadbb8ae30be94","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/pulls/2/commits","review_comments_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/pulls/2/comments","review_comment_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/issues/2/comments","statuses_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/statuses/31d18414ff01f9f72a1b9f814ee7be6bbe77d83e","head":{"label":"niole:updated-delete-post-get","ref":"updated-delete-post-get","sha":"31d18414ff01f9f72a1b9f814ee7be6bbe77d83e","user":{"login":"niole","id":6508755,"avatar_url":"https://avatars.githubusercontent.com/u/6508755?v=3","gravatar_id":"","url":"https://api.github.com/users/niole","html_url":"https://github.com/niole","followers_url":"https://api.github.com/users/niole/followers","following_url":"https://api.github.com/users/niole/following{/other_user}","gists_url":"https://api.github.com/users/niole/gists{/gist_id}","starred_url":"https://api.github.com/users/niole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niole/subscriptions","organizations_url":"https://api.github.com/users/niole/orgs","repos_url":"https://api.github.com/users/niole/repos","events_url":"https://api.github.com/users/niole/events{/privacy}","received_events_url":"https://api.github.com/users/niole/received_events","type":"User","site_admin":false},"repo":{"id":32111050,"name":"Shopping-List","full_name":"niole/Shopping-List","owner":{"login":"niole","id":6508755,"avatar_url":"https://avatars.githubusercontent.com/u/6508755?v=3","gravatar_id":"","url":"https://api.github.com/users/niole","html_url":"https://github.com/niole","followers_url":"https://api.github.com/users/niole/followers","following_url":"https://api.github.com/users/niole/following{/other_user}","gists_url":"https://api.github.com/users/niole/gists{/gist_id}","starred_url":"https://api.github.com/users/niole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niole/subscriptions","organizations_url":"https://api.github.com/users/niole/orgs","repos_url":"https://api.github.com/users/niole/repos","events_url":"https://api.github.com/users/niole/events{/privacy}","received_events_url":"https://api.github.com/users/niole/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/niole/Shopping-List","description":"Collaborative shopping list app","fork":true,"url":"https://api.github.com/repos/niole/Shopping-List","forks_url":"https://api.github.com/repos/niole/Shopping-List/forks","keys_url":"https://api.github.com/repos/niole/Shopping-List/keys{/key_id}","collaborators_url":"https://api.github.com/repos/niole/Shopping-List/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/niole/Shopping-List/teams","hooks_url":"https://api.github.com/repos/niole/Shopping-List/hooks","issue_events_url":"https://api.github.com/repos/niole/Shopping-List/issues/events{/number}","events_url":"https://api.github.com/repos/niole/Shopping-List/events","assignees_url":"https://api.github.com/repos/niole/Shopping-List/assignees{/user}","branches_url":"https://api.github.com/repos/niole/Shopping-List/branches{/branch}","tags_url":"https://api.github.com/repos/niole/Shopping-List/tags","blobs_url":"https://api.github.com/repos/niole/Shopping-List/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/niole/Shopping-List/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/niole/Shopping-List/git/refs{/sha}","trees_url":"https://api.github.com/repos/niole/Shopping-List/git/trees{/sha}","statuses_url":"https://api.github.com/repos/niole/Shopping-List/statuses/{sha}","languages_url":"https://api.github.com/repos/niole/Shopping-List/languages","stargazers_url":"https://api.github.com/repos/niole/Shopping-List/stargazers","contributors_url":"https://api.github.com/repos/niole/Shopping-List/contributors","subscribers_url":"https://api.github.com/repos/niole/Shopping-List/subscribers","subscription_url":"https://api.github.com/repos/niole/Shopping-List/subscription","commits_url":"https://api.github.com/repos/niole/Shopping-List/commits{/sha}","git_commits_url":"https://api.github.com/repos/niole/Shopping-List/git/commits{/sha}","comments_url":"https://api.github.com/repos/niole/Shopping-List/comments{/number}","issue_comment_url":"https://api.github.com/repos/niole/Shopping-List/issues/comments{/number}","contents_url":"https://api.github.com/repos/niole/Shopping-List/contents/{+path}","compare_url":"https://api.github.com/repos/niole/Shopping-List/compare/{base}...{head}","merges_url":"https://api.github.com/repos/niole/Shopping-List/merges","archive_url":"https://api.github.com/repos/niole/Shopping-List/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/niole/Shopping-List/downloads","issues_url":"https://api.github.com/repos/niole/Shopping-List/issues{/number}","pulls_url":"https://api.github.com/repos/niole/Shopping-List/pulls{/number}","milestones_url":"https://api.github.com/repos/niole/Shopping-List/milestones{/number}","notifications_url":"https://api.github.com/repos/niole/Shopping-List/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/niole/Shopping-List/labels{/name}","releases_url":"https://api.github.com/repos/niole/Shopping-List/releases{/id}","created_at":"2015-03-13T00:24:31Z","updated_at":"2015-03-21T20:26:38Z","pushed_at":"2015-03-21T20:40:33Z","git_url":"git://github.com/niole/Shopping-List.git","ssh_url":"git@github.com:niole/Shopping-List.git","clone_url":"https://github.com/niole/Shopping-List.git","svn_url":"https://github.com/niole/Shopping-List","homepage":null,"size":92,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Niole-Daycare:master","ref":"master","sha":"cd558701dc6c9a7481064c8f2c99d23791c0e431","user":{"login":"Niole-Daycare","id":11449660,"avatar_url":"https://avatars.githubusercontent.com/u/11449660?v=3","gravatar_id":"","url":"https://api.github.com/users/Niole-Daycare","html_url":"https://github.com/Niole-Daycare","followers_url":"https://api.github.com/users/Niole-Daycare/followers","following_url":"https://api.github.com/users/Niole-Daycare/following{/other_user}","gists_url":"https://api.github.com/users/Niole-Daycare/gists{/gist_id}","starred_url":"https://api.github.com/users/Niole-Daycare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Niole-Daycare/subscriptions","organizations_url":"https://api.github.com/users/Niole-Daycare/orgs","repos_url":"https://api.github.com/users/Niole-Daycare/repos","events_url":"https://api.github.com/users/Niole-Daycare/events{/privacy}","received_events_url":"https://api.github.com/users/Niole-Daycare/received_events","type":"Organization","site_admin":false},"repo":{"id":32110954,"name":"Shopping-List","full_name":"Niole-Daycare/Shopping-List","owner":{"login":"Niole-Daycare","id":11449660,"avatar_url":"https://avatars.githubusercontent.com/u/11449660?v=3","gravatar_id":"","url":"https://api.github.com/users/Niole-Daycare","html_url":"https://github.com/Niole-Daycare","followers_url":"https://api.github.com/users/Niole-Daycare/followers","following_url":"https://api.github.com/users/Niole-Daycare/following{/other_user}","gists_url":"https://api.github.com/users/Niole-Daycare/gists{/gist_id}","starred_url":"https://api.github.com/users/Niole-Daycare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Niole-Daycare/subscriptions","organizations_url":"https://api.github.com/users/Niole-Daycare/orgs","repos_url":"https://api.github.com/users/Niole-Daycare/repos","events_url":"https://api.github.com/users/Niole-Daycare/events{/privacy}","received_events_url":"https://api.github.com/users/Niole-Daycare/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Niole-Daycare/Shopping-List","description":"Collaborative shopping list app","fork":false,"url":"https://api.github.com/repos/Niole-Daycare/Shopping-List","forks_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/forks","keys_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/teams","hooks_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/hooks","issue_events_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/issues/events{/number}","events_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/events","assignees_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/assignees{/user}","branches_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/branches{/branch}","tags_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/tags","blobs_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/git/refs{/sha}","trees_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/statuses/{sha}","languages_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/languages","stargazers_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/stargazers","contributors_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/contributors","subscribers_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/subscribers","subscription_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/subscription","commits_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/commits{/sha}","git_commits_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/git/commits{/sha}","comments_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/comments{/number}","issue_comment_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/issues/comments{/number}","contents_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/contents/{+path}","compare_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/merges","archive_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/downloads","issues_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/issues{/number}","pulls_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/pulls{/number}","milestones_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/milestones{/number}","notifications_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/labels{/name}","releases_url":"https://api.github.com/repos/Niole-Daycare/Shopping-List/releases{/id}","created_at":"2015-03-13T00:21:49Z","updated_at":"2015-03-13T00:21:49Z","pushed_at":"2015-03-21T20:43:43Z","git_url":"git://github.com/Niole-Daycare/Shopping-List.git","ssh_url":"git@github.com:Niole-Daycare/Shopping-List.git","clone_url":"https://github.com/Niole-Daycare/Shopping-List.git","svn_url":"https://github.com/Niole-Daycare/Shopping-List","homepage":null,"size":144,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Niole-Daycare/Shopping-List/pulls/2"},"html":{"href":"https://github.com/Niole-Daycare/Shopping-List/pull/2"},"issue":{"href":"https://api.github.com/repos/Niole-Daycare/Shopping-List/issues/2"},"comments":{"href":"https://api.github.com/repos/Niole-Daycare/Shopping-List/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/Niole-Daycare/Shopping-List/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/Niole-Daycare/Shopping-List/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Niole-Daycare/Shopping-List/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/Niole-Daycare/Shopping-List/statuses/31d18414ff01f9f72a1b9f814ee7be6bbe77d83e"}}}}