{"action":"created","comment":{"url":"https://api.github.com/repos/HubSpot/Blazar/pulls/comments/54931649","id":54931649,"diff_hunk":"@@ -1,92 +1,161 @@\n import React, {Component, PropTypes} from 'react';\n+import {Link} from 'react-router'\n import classnames from 'classnames';\n import {has, contains} from 'underscore';\n import {truncate} from '../Helpers.js';\n import BuildingIcon from '../shared/BuildingIcon.jsx';\n import Icon from '../shared/Icon.jsx';\n import Star from '../shared/Star.jsx';\n+import BuildStates from '../../constants/BuildStates.js';\n import {buildResultIcon} from '../Helpers.js';\n \n-import {Link} from 'react-router'\n+let initialState = {\n+  expanded: false\n+};\n \n class SidebarItem extends Component {\n \n+  constructor() {\n+    this.state = initialState;\n+  }\n+\n   getItemClasses() {\n     return classnames([\n       'sidebar-item',\n       this.props.classNames\n     ]);\n   }\n+\n+  toggleExpand() {\n+    this.setState({\n+      expanded: !this.state.expanded\n+    });\n+  }\n+\n+  renderExpandText(numberRemaining) {\n+    const {builds} = this.props;\n+\n+    if (builds.length < 4) {\n+      return '';\n+    }\n+\n+    else if (!this.state.expanded) {\n+      return (\n+        <div onClick={this.toggleExpand.bind(this)} className='sidebar-item__and-more'>\n+          show {numberRemaining} more\n+        </div>\n+      );\n+    }\n+\n+    const numberToHide = builds.length - 3;\n+\n+    return (\n+      <div onClick={this.toggleExpand.bind(this)} className='sidebar-item__and-more'>\n+        show {numberToHide} less","path":"BlazarUI/app/scripts/components/sidebar/SidebarItem.jsx","position":null,"original_position":55,"commit_id":"097437e395c43186bf5f2c2213da8ee198bf7447","original_commit_id":"cb0f7695edae4e981db5b6a95e821921b0bae180","user":{"login":"benrlodge","id":3275453,"avatar_url":"https://avatars.githubusercontent.com/u/3275453?v=3","gravatar_id":"","url":"https://api.github.com/users/benrlodge","html_url":"https://github.com/benrlodge","followers_url":"https://api.github.com/users/benrlodge/followers","following_url":"https://api.github.com/users/benrlodge/following{/other_user}","gists_url":"https://api.github.com/users/benrlodge/gists{/gist_id}","starred_url":"https://api.github.com/users/benrlodge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benrlodge/subscriptions","organizations_url":"https://api.github.com/users/benrlodge/orgs","repos_url":"https://api.github.com/users/benrlodge/repos","events_url":"https://api.github.com/users/benrlodge/events{/privacy}","received_events_url":"https://api.github.com/users/benrlodge/received_events","type":"User","site_admin":false},"body":"You can still do `if`s as opposed to a ternary to generate the text, if you find that more readable. My main point is that there is unnecessary duplicate jsx and returns -\r\n\r\n`<div onClick={this.toggleExpand.bind(this)} className='sidebar-item__and-more'>`","created_at":"2016-03-03T19:17:53Z","updated_at":"2016-03-03T19:17:53Z","html_url":"https://github.com/HubSpot/Blazar/pull/117#discussion_r54931649","pull_request_url":"https://api.github.com/repos/HubSpot/Blazar/pulls/117","_links":{"self":{"href":"https://api.github.com/repos/HubSpot/Blazar/pulls/comments/54931649"},"html":{"href":"https://github.com/HubSpot/Blazar/pull/117#discussion_r54931649"},"pull_request":{"href":"https://api.github.com/repos/HubSpot/Blazar/pulls/117"}}},"pull_request":{"url":"https://api.github.com/repos/HubSpot/Blazar/pulls/117","id":61603135,"html_url":"https://github.com/HubSpot/Blazar/pull/117","diff_url":"https://github.com/HubSpot/Blazar/pull/117.diff","patch_url":"https://github.com/HubSpot/Blazar/pull/117.patch","issue_url":"https://api.github.com/repos/HubSpot/Blazar/issues/117","number":117,"state":"open","locked":false,"title":"(WIP) New sidebar","user":{"login":"zdhickman","id":2453653,"avatar_url":"https://avatars.githubusercontent.com/u/2453653?v=3","gravatar_id":"","url":"https://api.github.com/users/zdhickman","html_url":"https://github.com/zdhickman","followers_url":"https://api.github.com/users/zdhickman/followers","following_url":"https://api.github.com/users/zdhickman/following{/other_user}","gists_url":"https://api.github.com/users/zdhickman/gists{/gist_id}","starred_url":"https://api.github.com/users/zdhickman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdhickman/subscriptions","organizations_url":"https://api.github.com/users/zdhickman/orgs","repos_url":"https://api.github.com/users/zdhickman/repos","events_url":"https://api.github.com/users/zdhickman/events{/privacy}","received_events_url":"https://api.github.com/users/zdhickman/received_events","type":"User","site_admin":false},"body":"Old sidebar: \r\n![screen shot 2016-03-03 at 1 23 27 pm](https://cloud.githubusercontent.com/assets/2453653/13504601/295f8586-e143-11e5-978a-4b25b958c1d9.png)\r\n\r\nNew sidebar:\r\n![screen shot 2016-03-03 at 1 23 09 pm](https://cloud.githubusercontent.com/assets/2453653/13504607/2df34c4a-e143-11e5-8f9d-36fd6b0b8958.png)\r\n\r\n\r\nChanges:\r\n- Upped font size from 11px -> 16px\r\n- Combined branches of a common repo into a single sidebar item\r\n- Only display non-success build status icons next to branches\r\n- Inline expanding of sidebar items with >3 branches:\r\n\r\n![screen shot 2016-03-03 at 1 26 10 pm](https://cloud.githubusercontent.com/assets/2453653/13504682/885ac898-e143-11e5-9bd1-452677be6069.png)\r\n\r\n![screen shot 2016-03-03 at 1 25 50 pm](https://cloud.githubusercontent.com/assets/2453653/13504686/8b976426-e143-11e5-9327-15c3549d0c13.png)\r\n\r\n\r\n\r\nTODO:\r\n- [ ] Copy on `show/hide` text\r\n- [ ] Code clean-up\r\n- [ ] Correctly colored links\r\n- [ ] Touch up styling","created_at":"2016-03-03T18:28:13Z","updated_at":"2016-03-03T19:17:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c39ac51166043eb1122f1f2e58414b800c8907ce","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/HubSpot/Blazar/pulls/117/commits","review_comments_url":"https://api.github.com/repos/HubSpot/Blazar/pulls/117/comments","review_comment_url":"https://api.github.com/repos/HubSpot/Blazar/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HubSpot/Blazar/issues/117/comments","statuses_url":"https://api.github.com/repos/HubSpot/Blazar/statuses/097437e395c43186bf5f2c2213da8ee198bf7447","head":{"label":"HubSpot:new-barside","ref":"new-barside","sha":"097437e395c43186bf5f2c2213da8ee198bf7447","user":{"login":"HubSpot","id":326419,"avatar_url":"https://avatars.githubusercontent.com/u/326419?v=3","gravatar_id":"","url":"https://api.github.com/users/HubSpot","html_url":"https://github.com/HubSpot","followers_url":"https://api.github.com/users/HubSpot/followers","following_url":"https://api.github.com/users/HubSpot/following{/other_user}","gists_url":"https://api.github.com/users/HubSpot/gists{/gist_id}","starred_url":"https://api.github.com/users/HubSpot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HubSpot/subscriptions","organizations_url":"https://api.github.com/users/HubSpot/orgs","repos_url":"https://api.github.com/users/HubSpot/repos","events_url":"https://api.github.com/users/HubSpot/events{/privacy}","received_events_url":"https://api.github.com/users/HubSpot/received_events","type":"Organization","site_admin":false},"repo":{"id":38639709,"name":"Blazar","full_name":"HubSpot/Blazar","owner":{"login":"HubSpot","id":326419,"avatar_url":"https://avatars.githubusercontent.com/u/326419?v=3","gravatar_id":"","url":"https://api.github.com/users/HubSpot","html_url":"https://github.com/HubSpot","followers_url":"https://api.github.com/users/HubSpot/followers","following_url":"https://api.github.com/users/HubSpot/following{/other_user}","gists_url":"https://api.github.com/users/HubSpot/gists{/gist_id}","starred_url":"https://api.github.com/users/HubSpot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HubSpot/subscriptions","organizations_url":"https://api.github.com/users/HubSpot/orgs","repos_url":"https://api.github.com/users/HubSpot/repos","events_url":"https://api.github.com/users/HubSpot/events{/privacy}","received_events_url":"https://api.github.com/users/HubSpot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HubSpot/Blazar","description":"An out-of-this world build system!","fork":false,"url":"https://api.github.com/repos/HubSpot/Blazar","forks_url":"https://api.github.com/repos/HubSpot/Blazar/forks","keys_url":"https://api.github.com/repos/HubSpot/Blazar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HubSpot/Blazar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HubSpot/Blazar/teams","hooks_url":"https://api.github.com/repos/HubSpot/Blazar/hooks","issue_events_url":"https://api.github.com/repos/HubSpot/Blazar/issues/events{/number}","events_url":"https://api.github.com/repos/HubSpot/Blazar/events","assignees_url":"https://api.github.com/repos/HubSpot/Blazar/assignees{/user}","branches_url":"https://api.github.com/repos/HubSpot/Blazar/branches{/branch}","tags_url":"https://api.github.com/repos/HubSpot/Blazar/tags","blobs_url":"https://api.github.com/repos/HubSpot/Blazar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HubSpot/Blazar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HubSpot/Blazar/git/refs{/sha}","trees_url":"https://api.github.com/repos/HubSpot/Blazar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HubSpot/Blazar/statuses/{sha}","languages_url":"https://api.github.com/repos/HubSpot/Blazar/languages","stargazers_url":"https://api.github.com/repos/HubSpot/Blazar/stargazers","contributors_url":"https://api.github.com/repos/HubSpot/Blazar/contributors","subscribers_url":"https://api.github.com/repos/HubSpot/Blazar/subscribers","subscription_url":"https://api.github.com/repos/HubSpot/Blazar/subscription","commits_url":"https://api.github.com/repos/HubSpot/Blazar/commits{/sha}","git_commits_url":"https://api.github.com/repos/HubSpot/Blazar/git/commits{/sha}","comments_url":"https://api.github.com/repos/HubSpot/Blazar/comments{/number}","issue_comment_url":"https://api.github.com/repos/HubSpot/Blazar/issues/comments{/number}","contents_url":"https://api.github.com/repos/HubSpot/Blazar/contents/{+path}","compare_url":"https://api.github.com/repos/HubSpot/Blazar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HubSpot/Blazar/merges","archive_url":"https://api.github.com/repos/HubSpot/Blazar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HubSpot/Blazar/downloads","issues_url":"https://api.github.com/repos/HubSpot/Blazar/issues{/number}","pulls_url":"https://api.github.com/repos/HubSpot/Blazar/pulls{/number}","milestones_url":"https://api.github.com/repos/HubSpot/Blazar/milestones{/number}","notifications_url":"https://api.github.com/repos/HubSpot/Blazar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HubSpot/Blazar/labels{/name}","releases_url":"https://api.github.com/repos/HubSpot/Blazar/releases{/id}","deployments_url":"https://api.github.com/repos/HubSpot/Blazar/deployments","created_at":"2015-07-06T18:59:45Z","updated_at":"2016-02-19T14:47:12Z","pushed_at":"2016-03-03T19:05:57Z","git_url":"git://github.com/HubSpot/Blazar.git","ssh_url":"git@github.com:HubSpot/Blazar.git","clone_url":"https://github.com/HubSpot/Blazar.git","svn_url":"https://github.com/HubSpot/Blazar","homepage":null,"size":2507,"stargazers_count":27,"watchers_count":27,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":27,"default_branch":"master"}},"base":{"label":"HubSpot:master","ref":"master","sha":"07c15feb0e78b7dce42d0a1c5e42b01449a080d8","user":{"login":"HubSpot","id":326419,"avatar_url":"https://avatars.githubusercontent.com/u/326419?v=3","gravatar_id":"","url":"https://api.github.com/users/HubSpot","html_url":"https://github.com/HubSpot","followers_url":"https://api.github.com/users/HubSpot/followers","following_url":"https://api.github.com/users/HubSpot/following{/other_user}","gists_url":"https://api.github.com/users/HubSpot/gists{/gist_id}","starred_url":"https://api.github.com/users/HubSpot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HubSpot/subscriptions","organizations_url":"https://api.github.com/users/HubSpot/orgs","repos_url":"https://api.github.com/users/HubSpot/repos","events_url":"https://api.github.com/users/HubSpot/events{/privacy}","received_events_url":"https://api.github.com/users/HubSpot/received_events","type":"Organization","site_admin":false},"repo":{"id":38639709,"name":"Blazar","full_name":"HubSpot/Blazar","owner":{"login":"HubSpot","id":326419,"avatar_url":"https://avatars.githubusercontent.com/u/326419?v=3","gravatar_id":"","url":"https://api.github.com/users/HubSpot","html_url":"https://github.com/HubSpot","followers_url":"https://api.github.com/users/HubSpot/followers","following_url":"https://api.github.com/users/HubSpot/following{/other_user}","gists_url":"https://api.github.com/users/HubSpot/gists{/gist_id}","starred_url":"https://api.github.com/users/HubSpot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HubSpot/subscriptions","organizations_url":"https://api.github.com/users/HubSpot/orgs","repos_url":"https://api.github.com/users/HubSpot/repos","events_url":"https://api.github.com/users/HubSpot/events{/privacy}","received_events_url":"https://api.github.com/users/HubSpot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HubSpot/Blazar","description":"An out-of-this world build system!","fork":false,"url":"https://api.github.com/repos/HubSpot/Blazar","forks_url":"https://api.github.com/repos/HubSpot/Blazar/forks","keys_url":"https://api.github.com/repos/HubSpot/Blazar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HubSpot/Blazar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HubSpot/Blazar/teams","hooks_url":"https://api.github.com/repos/HubSpot/Blazar/hooks","issue_events_url":"https://api.github.com/repos/HubSpot/Blazar/issues/events{/number}","events_url":"https://api.github.com/repos/HubSpot/Blazar/events","assignees_url":"https://api.github.com/repos/HubSpot/Blazar/assignees{/user}","branches_url":"https://api.github.com/repos/HubSpot/Blazar/branches{/branch}","tags_url":"https://api.github.com/repos/HubSpot/Blazar/tags","blobs_url":"https://api.github.com/repos/HubSpot/Blazar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HubSpot/Blazar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HubSpot/Blazar/git/refs{/sha}","trees_url":"https://api.github.com/repos/HubSpot/Blazar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HubSpot/Blazar/statuses/{sha}","languages_url":"https://api.github.com/repos/HubSpot/Blazar/languages","stargazers_url":"https://api.github.com/repos/HubSpot/Blazar/stargazers","contributors_url":"https://api.github.com/repos/HubSpot/Blazar/contributors","subscribers_url":"https://api.github.com/repos/HubSpot/Blazar/subscribers","subscription_url":"https://api.github.com/repos/HubSpot/Blazar/subscription","commits_url":"https://api.github.com/repos/HubSpot/Blazar/commits{/sha}","git_commits_url":"https://api.github.com/repos/HubSpot/Blazar/git/commits{/sha}","comments_url":"https://api.github.com/repos/HubSpot/Blazar/comments{/number}","issue_comment_url":"https://api.github.com/repos/HubSpot/Blazar/issues/comments{/number}","contents_url":"https://api.github.com/repos/HubSpot/Blazar/contents/{+path}","compare_url":"https://api.github.com/repos/HubSpot/Blazar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HubSpot/Blazar/merges","archive_url":"https://api.github.com/repos/HubSpot/Blazar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HubSpot/Blazar/downloads","issues_url":"https://api.github.com/repos/HubSpot/Blazar/issues{/number}","pulls_url":"https://api.github.com/repos/HubSpot/Blazar/pulls{/number}","milestones_url":"https://api.github.com/repos/HubSpot/Blazar/milestones{/number}","notifications_url":"https://api.github.com/repos/HubSpot/Blazar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HubSpot/Blazar/labels{/name}","releases_url":"https://api.github.com/repos/HubSpot/Blazar/releases{/id}","deployments_url":"https://api.github.com/repos/HubSpot/Blazar/deployments","created_at":"2015-07-06T18:59:45Z","updated_at":"2016-02-19T14:47:12Z","pushed_at":"2016-03-03T19:05:57Z","git_url":"git://github.com/HubSpot/Blazar.git","ssh_url":"git@github.com:HubSpot/Blazar.git","clone_url":"https://github.com/HubSpot/Blazar.git","svn_url":"https://github.com/HubSpot/Blazar","homepage":null,"size":2507,"stargazers_count":27,"watchers_count":27,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HubSpot/Blazar/pulls/117"},"html":{"href":"https://github.com/HubSpot/Blazar/pull/117"},"issue":{"href":"https://api.github.com/repos/HubSpot/Blazar/issues/117"},"comments":{"href":"https://api.github.com/repos/HubSpot/Blazar/issues/117/comments"},"review_comments":{"href":"https://api.github.com/repos/HubSpot/Blazar/pulls/117/comments"},"review_comment":{"href":"https://api.github.com/repos/HubSpot/Blazar/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HubSpot/Blazar/pulls/117/commits"},"statuses":{"href":"https://api.github.com/repos/HubSpot/Blazar/statuses/097437e395c43186bf5f2c2213da8ee198bf7447"}}}}