{"action":"created","comment":{"url":"https://api.github.com/repos/aces/Loris/pulls/comments/39416776","id":39416776,"diff_hunk":"@@ -0,0 +1,380 @@\n+/*The config for the pagination of tables */\n+var Config = React.createClass({\n+    render: function() {\n+        return <div>\n+            <h2>Config</h2>\n+            <label htmlFor=\"pageSize\">Page Size:</label>\n+            <select id=\"pageSize\" value={this.props.pageSize} onChange={this.props.handlePageSizeChange}>\n+                <option value=\"1\">1</option>\n+                <option value=\"2\">2</option>\n+                <option value=\"3\">3</option>\n+                <option value=\"4\">4</option>\n+            </select>\n+        </div>;\n+    }\n+});\n+\n+var PagedRowHeader = React.createClass({\n+    propType:{\n+        'header_row' : React.PropTypes.array.isRequired\n+    },\n+    render: function(){\n+        return <thead>\n+            <tr className=\"info\">\n+\t\t{this.props.header_row.map(function(header_column){\n+            return <th>{header_column}</th>\n+        })}\n+            </tr>\n+        </thead>;\n+    }\n+});\n+\n+var PagedTable = React.createClass({\n+    propTypes:{\n+        'table_headers' : React.PropTypes.array,\n+        'table_rows' : React.PropTypes.array\n+    },\n+    getInitialState: function(){\n+        return{\n+            pageSize: 10,\n+            currentPage: 1\n+        }\n+    },\n+    componentWillReceiveProps: function(nextProps) {\n+        this.setState({\n+            currentPage: 1\n+        })\n+    },\n+    getPage: function(){\n+        var start = this.state.pageSize * (this.state.currentPage - 1);\n+        var end = start + this.state.pageSize;\n+\n+        return{\n+            currentPage: this.state.currentPage,\n+            table_rows: this.props.table_rows.slice(start, end),\n+            numPages: this.getNumPages(),\n+            handleClick: function(pageNum) {\n+                return function() {\n+                    this.handlePageChange(pageNum)\n+                }.bind(this)\n+            }.bind(this)\n+        }\n+    },\n+    getNumPages: function() {\n+        var numPages = Math.floor(this.props.table_rows.length / this.state.pageSize);\n+        if (this.props.table_rows.length % this.state.pageSize > 0){\n+            numPages++\n+        }\n+        return numPages\n+    },\n+    handlePageChange: function(pageNum) {\n+        this.setState({currentPage: pageNum})\n+    },\n+    render:function(){\n+        var page = this.getPage();\n+        var rows_to_map = page.table_rows;\n+        var children_to_map = this.props.children;\n+        var rows_for_current_page = rows_to_map.map(function(row){\n+            var mapped = React.Children.map(children_to_map, function (child) {\n+                return React.cloneElement(child, {\n+                    row: row\n+                });\n+            });\n+            return mapped;\n+        });\n+        if(rows_for_current_page.length){\n+            var table_contents = <table className=\"table table-hover table-primary table-bordered colm-freeze\">\n+                <PagedRowHeader header_row={this.props.table_headers}/>\n+                <tbody>\n+                {rows_for_current_page}\n+                </tbody>\n+            </table>\n+\n+        }\n+        else{\n+            var table_contents = \"There is no data to display\";\n+        }\n+        return <div>\n+        {table_contents}\n+            <nav>\n+\t\t{pager(page)}\n+            </nav>\n+        </div>\n+    }\n+})\n+\n+\n+/**\n+ * Renders a pager component.\n+ */\n+function pager(page) {\n+    var pageLinks = []\n+    if (page.currentPage > 1) {\n+        pageLinks.push(<li onClick={page.handleClick(page.currentPage - 1)}><span>‹</span></li>)\n+        if (page.currentPage > 2) {\n+            pageLinks.push(<li onClick={page.handleClick(1)}><span>1</span></li>)\n+            pageLinks.push(<li><span>...</span></li>)\n+        }\n+    }\n+    if(page.numPages > 1){  pageLinks.push(<li className=\"active\"><span>{page.currentPage}</span></li>)\n+    }\n+    if (page.currentPage < page.numPages) {\n+        pageLinks.push(<li onClick={page.handleClick(page.currentPage + 1)}><span>{page.currentPage + 1}</span></li>)\n+        if (page.currentPage < page.numPages - 1) {\n+            pageLinks.push(<li onClick={page.handleClick(page.currentPage + 2)}><span>{page.currentPage + 2}</span></li>)\n+        }\n+        if(page.currentPage < page.numPages - 2){\n+            pageLinks.push(<li onClick={page.handleClick(page.currentPage + 3)}><span>{page.currentPage + 3}</span></li>)\n+        }\n+        if(page.currentPage < page.numPages - 3){\n+            pageLinks.push(<li className=\"disabled\"><span>...</span></li>)\n+            pageLinks.push(<li onClick={page.handleClick(page.numPages)}><span>{page.numPages}</span></li>)\n+        }\n+        pageLinks.push(<li onClick={page.handleClick(page.currentPage + 1)}><span aria-hidden=\"true\">›</span>\n+        </li>)\n+    }\n+    return <ul className=\"pagination pagination-sm\">{pageLinks}</ul>","path":"htdocs/js/jsx/incompletes_candidates_panel.jsx","position":136,"original_position":136,"commit_id":"e3ffcadf4abf24c947e49507d4d2bffa389cfbda","original_commit_id":"20064f2aef8936e6c62f600e21546d1aa5fb847d","user":{"login":"evanluc","id":3630620,"avatar_url":"https://avatars.githubusercontent.com/u/3630620?v=3","gravatar_id":"","url":"https://api.github.com/users/evanluc","html_url":"https://github.com/evanluc","followers_url":"https://api.github.com/users/evanluc/followers","following_url":"https://api.github.com/users/evanluc/following{/other_user}","gists_url":"https://api.github.com/users/evanluc/gists{/gist_id}","starred_url":"https://api.github.com/users/evanluc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evanluc/subscriptions","organizations_url":"https://api.github.com/users/evanluc/orgs","repos_url":"https://api.github.com/users/evanluc/repos","events_url":"https://api.github.com/users/evanluc/events{/privacy}","received_events_url":"https://api.github.com/users/evanluc/received_events","type":"User","site_admin":false},"body":"No as it doesn't actually link to different pages. It just creates a paged table (you cannot link to specific pages in the table). ","created_at":"2015-09-14T16:46:50Z","updated_at":"2015-09-14T16:46:50Z","html_url":"https://github.com/aces/Loris/pull/1234#discussion_r39416776","pull_request_url":"https://api.github.com/repos/aces/Loris/pulls/1234","_links":{"self":{"href":"https://api.github.com/repos/aces/Loris/pulls/comments/39416776"},"html":{"href":"https://github.com/aces/Loris/pull/1234#discussion_r39416776"},"pull_request":{"href":"https://api.github.com/repos/aces/Loris/pulls/1234"}}},"pull_request":{"url":"https://api.github.com/repos/aces/Loris/pulls/1234","id":44388364,"html_url":"https://github.com/aces/Loris/pull/1234","diff_url":"https://github.com/aces/Loris/pull/1234.diff","patch_url":"https://github.com/aces/Loris/pull/1234.patch","issue_url":"https://api.github.com/repos/aces/Loris/issues/1234","number":1234,"state":"open","locked":false,"title":"Behavioural QC overhaul push (contains bvl sidebar and new data team helper)","user":{"login":"evanluc","id":3630620,"avatar_url":"https://avatars.githubusercontent.com/u/3630620?v=3","gravatar_id":"","url":"https://api.github.com/users/evanluc","html_url":"https://github.com/evanluc","followers_url":"https://api.github.com/users/evanluc/followers","following_url":"https://api.github.com/users/evanluc/following{/other_user}","gists_url":"https://api.github.com/users/evanluc/gists{/gist_id}","starred_url":"https://api.github.com/users/evanluc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evanluc/subscriptions","organizations_url":"https://api.github.com/users/evanluc/orgs","repos_url":"https://api.github.com/users/evanluc/repos","events_url":"https://api.github.com/users/evanluc/events{/privacy}","received_events_url":"https://api.github.com/users/evanluc/received_events","type":"User","site_admin":false},"body":"Looks like it is a HUGE amount of files. It's in fact just\r\n- a few ajax files for the bvl feedback panel\r\n- a bvl feedback panel php class\r\n- some amendments to the previous data team helper php class\r\n- smarty templates for the data team helper and the bvl feedback panel\r\n- react javascript files for the bvl feedback panel and data team helper\r\n\r\nThings to do:\r\nDecide on a new name. Samir doesn't like \"data team helper\" and suggested \"behavioural qc\". Should the entire module be renamed? \r\nI have a separate pull for a selenium test. I will be pushing soon but am having trouble with setting up a static data set. \r\n\r\nDave I am assigning to you specifically for the react stuff. Feel free to re-assign to Zia or Christine after you're done looking it over.\r\n\r\nThe bvl_feedback panel can be tested on : instrument lists, timepoint lists or a specific instrument.","created_at":"2015-09-08T02:44:55Z","updated_at":"2015-09-14T16:46:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74749bd3f0ee8b041472163a18367b1a38119cc5","assignee":{"login":"evanluc","id":3630620,"avatar_url":"https://avatars.githubusercontent.com/u/3630620?v=3","gravatar_id":"","url":"https://api.github.com/users/evanluc","html_url":"https://github.com/evanluc","followers_url":"https://api.github.com/users/evanluc/followers","following_url":"https://api.github.com/users/evanluc/following{/other_user}","gists_url":"https://api.github.com/users/evanluc/gists{/gist_id}","starred_url":"https://api.github.com/users/evanluc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evanluc/subscriptions","organizations_url":"https://api.github.com/users/evanluc/orgs","repos_url":"https://api.github.com/users/evanluc/repos","events_url":"https://api.github.com/users/evanluc/events{/privacy}","received_events_url":"https://api.github.com/users/evanluc/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/aces/Loris/milestones/4","html_url":"https://github.com/aces/Loris/milestones/15.10","labels_url":"https://api.github.com/repos/aces/Loris/milestones/4/labels","id":1050783,"number":4,"title":"15.10","description":"The October Release of Loris.","creator":{"login":"driusan","id":498329,"avatar_url":"https://avatars.githubusercontent.com/u/498329?v=3","gravatar_id":"","url":"https://api.github.com/users/driusan","html_url":"https://github.com/driusan","followers_url":"https://api.github.com/users/driusan/followers","following_url":"https://api.github.com/users/driusan/following{/other_user}","gists_url":"https://api.github.com/users/driusan/gists{/gist_id}","starred_url":"https://api.github.com/users/driusan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/driusan/subscriptions","organizations_url":"https://api.github.com/users/driusan/orgs","repos_url":"https://api.github.com/users/driusan/repos","events_url":"https://api.github.com/users/driusan/events{/privacy}","received_events_url":"https://api.github.com/users/driusan/received_events","type":"User","site_admin":false},"open_issues":24,"closed_issues":67,"state":"open","created_at":"2015-04-02T18:31:49Z","updated_at":"2015-09-11T18:44:21Z","due_on":"2015-10-15T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/aces/Loris/pulls/1234/commits","review_comments_url":"https://api.github.com/repos/aces/Loris/pulls/1234/comments","review_comment_url":"https://api.github.com/repos/aces/Loris/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aces/Loris/issues/1234/comments","statuses_url":"https://api.github.com/repos/aces/Loris/statuses/e3ffcadf4abf24c947e49507d4d2bffa389cfbda","head":{"label":"evanluc:behavioural_qc_push","ref":"behavioural_qc_push","sha":"e3ffcadf4abf24c947e49507d4d2bffa389cfbda","user":{"login":"evanluc","id":3630620,"avatar_url":"https://avatars.githubusercontent.com/u/3630620?v=3","gravatar_id":"","url":"https://api.github.com/users/evanluc","html_url":"https://github.com/evanluc","followers_url":"https://api.github.com/users/evanluc/followers","following_url":"https://api.github.com/users/evanluc/following{/other_user}","gists_url":"https://api.github.com/users/evanluc/gists{/gist_id}","starred_url":"https://api.github.com/users/evanluc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evanluc/subscriptions","organizations_url":"https://api.github.com/users/evanluc/orgs","repos_url":"https://api.github.com/users/evanluc/repos","events_url":"https://api.github.com/users/evanluc/events{/privacy}","received_events_url":"https://api.github.com/users/evanluc/received_events","type":"User","site_admin":false},"repo":{"id":33633726,"name":"Loris","full_name":"evanluc/Loris","owner":{"login":"evanluc","id":3630620,"avatar_url":"https://avatars.githubusercontent.com/u/3630620?v=3","gravatar_id":"","url":"https://api.github.com/users/evanluc","html_url":"https://github.com/evanluc","followers_url":"https://api.github.com/users/evanluc/followers","following_url":"https://api.github.com/users/evanluc/following{/other_user}","gists_url":"https://api.github.com/users/evanluc/gists{/gist_id}","starred_url":"https://api.github.com/users/evanluc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evanluc/subscriptions","organizations_url":"https://api.github.com/users/evanluc/orgs","repos_url":"https://api.github.com/users/evanluc/repos","events_url":"https://api.github.com/users/evanluc/events{/privacy}","received_events_url":"https://api.github.com/users/evanluc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/evanluc/Loris","description":"LORIS is a web-accessible database solution for longitudinal multi-site studies.","fork":true,"url":"https://api.github.com/repos/evanluc/Loris","forks_url":"https://api.github.com/repos/evanluc/Loris/forks","keys_url":"https://api.github.com/repos/evanluc/Loris/keys{/key_id}","collaborators_url":"https://api.github.com/repos/evanluc/Loris/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/evanluc/Loris/teams","hooks_url":"https://api.github.com/repos/evanluc/Loris/hooks","issue_events_url":"https://api.github.com/repos/evanluc/Loris/issues/events{/number}","events_url":"https://api.github.com/repos/evanluc/Loris/events","assignees_url":"https://api.github.com/repos/evanluc/Loris/assignees{/user}","branches_url":"https://api.github.com/repos/evanluc/Loris/branches{/branch}","tags_url":"https://api.github.com/repos/evanluc/Loris/tags","blobs_url":"https://api.github.com/repos/evanluc/Loris/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/evanluc/Loris/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/evanluc/Loris/git/refs{/sha}","trees_url":"https://api.github.com/repos/evanluc/Loris/git/trees{/sha}","statuses_url":"https://api.github.com/repos/evanluc/Loris/statuses/{sha}","languages_url":"https://api.github.com/repos/evanluc/Loris/languages","stargazers_url":"https://api.github.com/repos/evanluc/Loris/stargazers","contributors_url":"https://api.github.com/repos/evanluc/Loris/contributors","subscribers_url":"https://api.github.com/repos/evanluc/Loris/subscribers","subscription_url":"https://api.github.com/repos/evanluc/Loris/subscription","commits_url":"https://api.github.com/repos/evanluc/Loris/commits{/sha}","git_commits_url":"https://api.github.com/repos/evanluc/Loris/git/commits{/sha}","comments_url":"https://api.github.com/repos/evanluc/Loris/comments{/number}","issue_comment_url":"https://api.github.com/repos/evanluc/Loris/issues/comments{/number}","contents_url":"https://api.github.com/repos/evanluc/Loris/contents/{+path}","compare_url":"https://api.github.com/repos/evanluc/Loris/compare/{base}...{head}","merges_url":"https://api.github.com/repos/evanluc/Loris/merges","archive_url":"https://api.github.com/repos/evanluc/Loris/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/evanluc/Loris/downloads","issues_url":"https://api.github.com/repos/evanluc/Loris/issues{/number}","pulls_url":"https://api.github.com/repos/evanluc/Loris/pulls{/number}","milestones_url":"https://api.github.com/repos/evanluc/Loris/milestones{/number}","notifications_url":"https://api.github.com/repos/evanluc/Loris/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/evanluc/Loris/labels{/name}","releases_url":"https://api.github.com/repos/evanluc/Loris/releases{/id}","created_at":"2015-04-08T21:41:15Z","updated_at":"2015-07-28T14:06:27Z","pushed_at":"2015-09-11T14:36:09Z","git_url":"git://github.com/evanluc/Loris.git","ssh_url":"git@github.com:evanluc/Loris.git","clone_url":"https://github.com/evanluc/Loris.git","svn_url":"https://github.com/evanluc/Loris","homepage":"","size":61867,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"aces:master","ref":"master","sha":"26a495ed86aec6b7a9d4ba2a69da0efea66cc306","user":{"login":"aces","id":472868,"avatar_url":"https://avatars.githubusercontent.com/u/472868?v=3","gravatar_id":"","url":"https://api.github.com/users/aces","html_url":"https://github.com/aces","followers_url":"https://api.github.com/users/aces/followers","following_url":"https://api.github.com/users/aces/following{/other_user}","gists_url":"https://api.github.com/users/aces/gists{/gist_id}","starred_url":"https://api.github.com/users/aces/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aces/subscriptions","organizations_url":"https://api.github.com/users/aces/orgs","repos_url":"https://api.github.com/users/aces/repos","events_url":"https://api.github.com/users/aces/events{/privacy}","received_events_url":"https://api.github.com/users/aces/received_events","type":"Organization","site_admin":false},"repo":{"id":1125630,"name":"Loris","full_name":"aces/Loris","owner":{"login":"aces","id":472868,"avatar_url":"https://avatars.githubusercontent.com/u/472868?v=3","gravatar_id":"","url":"https://api.github.com/users/aces","html_url":"https://github.com/aces","followers_url":"https://api.github.com/users/aces/followers","following_url":"https://api.github.com/users/aces/following{/other_user}","gists_url":"https://api.github.com/users/aces/gists{/gist_id}","starred_url":"https://api.github.com/users/aces/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aces/subscriptions","organizations_url":"https://api.github.com/users/aces/orgs","repos_url":"https://api.github.com/users/aces/repos","events_url":"https://api.github.com/users/aces/events{/privacy}","received_events_url":"https://api.github.com/users/aces/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aces/Loris","description":"LORIS is a web-accessible database solution for longitudinal multi-site studies.","fork":false,"url":"https://api.github.com/repos/aces/Loris","forks_url":"https://api.github.com/repos/aces/Loris/forks","keys_url":"https://api.github.com/repos/aces/Loris/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aces/Loris/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aces/Loris/teams","hooks_url":"https://api.github.com/repos/aces/Loris/hooks","issue_events_url":"https://api.github.com/repos/aces/Loris/issues/events{/number}","events_url":"https://api.github.com/repos/aces/Loris/events","assignees_url":"https://api.github.com/repos/aces/Loris/assignees{/user}","branches_url":"https://api.github.com/repos/aces/Loris/branches{/branch}","tags_url":"https://api.github.com/repos/aces/Loris/tags","blobs_url":"https://api.github.com/repos/aces/Loris/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aces/Loris/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aces/Loris/git/refs{/sha}","trees_url":"https://api.github.com/repos/aces/Loris/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aces/Loris/statuses/{sha}","languages_url":"https://api.github.com/repos/aces/Loris/languages","stargazers_url":"https://api.github.com/repos/aces/Loris/stargazers","contributors_url":"https://api.github.com/repos/aces/Loris/contributors","subscribers_url":"https://api.github.com/repos/aces/Loris/subscribers","subscription_url":"https://api.github.com/repos/aces/Loris/subscription","commits_url":"https://api.github.com/repos/aces/Loris/commits{/sha}","git_commits_url":"https://api.github.com/repos/aces/Loris/git/commits{/sha}","comments_url":"https://api.github.com/repos/aces/Loris/comments{/number}","issue_comment_url":"https://api.github.com/repos/aces/Loris/issues/comments{/number}","contents_url":"https://api.github.com/repos/aces/Loris/contents/{+path}","compare_url":"https://api.github.com/repos/aces/Loris/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aces/Loris/merges","archive_url":"https://api.github.com/repos/aces/Loris/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aces/Loris/downloads","issues_url":"https://api.github.com/repos/aces/Loris/issues{/number}","pulls_url":"https://api.github.com/repos/aces/Loris/pulls{/number}","milestones_url":"https://api.github.com/repos/aces/Loris/milestones{/number}","notifications_url":"https://api.github.com/repos/aces/Loris/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aces/Loris/labels{/name}","releases_url":"https://api.github.com/repos/aces/Loris/releases{/id}","created_at":"2010-11-30T14:57:57Z","updated_at":"2015-09-11T19:52:51Z","pushed_at":"2015-09-14T15:07:04Z","git_url":"git://github.com/aces/Loris.git","ssh_url":"git@github.com:aces/Loris.git","clone_url":"https://github.com/aces/Loris.git","svn_url":"https://github.com/aces/Loris","homepage":"","size":70104,"stargazers_count":25,"watchers_count":25,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":38,"forks":40,"open_issues":38,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aces/Loris/pulls/1234"},"html":{"href":"https://github.com/aces/Loris/pull/1234"},"issue":{"href":"https://api.github.com/repos/aces/Loris/issues/1234"},"comments":{"href":"https://api.github.com/repos/aces/Loris/issues/1234/comments"},"review_comments":{"href":"https://api.github.com/repos/aces/Loris/pulls/1234/comments"},"review_comment":{"href":"https://api.github.com/repos/aces/Loris/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aces/Loris/pulls/1234/commits"},"statuses":{"href":"https://api.github.com/repos/aces/Loris/statuses/e3ffcadf4abf24c947e49507d4d2bffa389cfbda"}}}}