{"action":"created","comment":{"url":"https://api.github.com/repos/bnjbvr/kresus/pulls/comments/44561315","id":44561315,"diff_hunk":"@@ -165,6 +165,142 @@ function ComputeAttachmentLink(op) {\n     return `operations/${op.id}/`+file;\n }\n \n+\n+\n+class LabelComponent extends React.Component {\n+    constructor(props) {\n+        super(props);\n+        this.state = {\n+            editMode: false            \n+        };\n+    }\n+\n+    dom() {\n+        return this.refs.customlabel.getDOMNode();\n+    }\n+\n+    switchToEditMode() {\n+        this.setState({ editMode: true }, function() {\n+            this.dom().focus();\n+            //We set the cursor at the end\n+            try {\n+                this.dom().selectionStart = this.props.defaultValue().length;\n+            }\n+            catch (err){\n+               this.dom().selectionStart = 0;\n+           }\n+        });\n+    }\n+    switchToStaticMode() {\n+        this.setState({ editMode: false });\n+    }\n+\n+    onBlur() {\n+        let customLabel = this.dom().value;\n+        Actions.SetCustomLabel(this.props.operation, customLabel);\n+        // Be optimistic\n+        this.props.operation.customLabel = customLabel;\n+        this.switchToStaticMode();\n+    }\n+    \n+    onKeyUp(e) {\n+        if (e.keyCode == 13) {\n+            this.onBlur();\n+        }        \n+    }\n+    \n+    render() {\n+        if (!this.state.editMode){\n+            return (\n+                <button\n+                    className=\"form-control text-left btn-transparent\"\n+                    id={this.props.operation.id}\n+                    onClick={this.switchToEditMode.bind(this)}>\n+                    {this.props.buttonLabel()}                    \n+                </button>\n+            );\n+        }\n+        return (\n+            <input className=\"form-control\"\n+                type=\"text\"\n+                ref='customlabel'\n+                id={this.props.operation.id}\n+                defaultValue={this.props.defaultValue()}\n+                onBlur={this.onBlur.bind(this)}\n+                onKeyUp={this.onKeyUp.bind(this)}\n+            />\n+            );","path":"client/components/OperationList.js","position":84,"original_position":84,"commit_id":"0a27bca70b7e72041aa7ae34fc662c84d62af85a","original_commit_id":"0a27bca70b7e72041aa7ae34fc662c84d62af85a","user":{"login":"bnjbvr","id":1180019,"avatar_url":"https://avatars.githubusercontent.com/u/1180019?v=3","gravatar_id":"","url":"https://api.github.com/users/bnjbvr","html_url":"https://github.com/bnjbvr","followers_url":"https://api.github.com/users/bnjbvr/followers","following_url":"https://api.github.com/users/bnjbvr/following{/other_user}","gists_url":"https://api.github.com/users/bnjbvr/gists{/gist_id}","starred_url":"https://api.github.com/users/bnjbvr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnjbvr/subscriptions","organizations_url":"https://api.github.com/users/bnjbvr/orgs","repos_url":"https://api.github.com/users/bnjbvr/repos","events_url":"https://api.github.com/users/bnjbvr/events{/privacy}","received_events_url":"https://api.github.com/users/bnjbvr/received_events","type":"User","site_admin":false},"body":"nit: the indent is wrong here (4 spaces less)","created_at":"2015-11-11T17:42:13Z","updated_at":"2015-11-11T17:42:13Z","html_url":"https://github.com/bnjbvr/kresus/pull/264#discussion_r44561315","pull_request_url":"https://api.github.com/repos/bnjbvr/kresus/pulls/264","_links":{"self":{"href":"https://api.github.com/repos/bnjbvr/kresus/pulls/comments/44561315"},"html":{"href":"https://github.com/bnjbvr/kresus/pull/264#discussion_r44561315"},"pull_request":{"href":"https://api.github.com/repos/bnjbvr/kresus/pulls/264"}}},"pull_request":{"url":"https://api.github.com/repos/bnjbvr/kresus/pulls/264","id":50182535,"html_url":"https://github.com/bnjbvr/kresus/pull/264","diff_url":"https://github.com/bnjbvr/kresus/pull/264.diff","patch_url":"https://github.com/bnjbvr/kresus/pull/264.patch","issue_url":"https://api.github.com/repos/bnjbvr/kresus/issues/264","number":264,"state":"open","locked":false,"title":"[Frontend] Add custom label. Fixes #217","user":{"login":"ZeHiro","id":7999082,"avatar_url":"https://avatars.githubusercontent.com/u/7999082?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeHiro","html_url":"https://github.com/ZeHiro","followers_url":"https://api.github.com/users/ZeHiro/followers","following_url":"https://api.github.com/users/ZeHiro/following{/other_user}","gists_url":"https://api.github.com/users/ZeHiro/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeHiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeHiro/subscriptions","organizations_url":"https://api.github.com/users/ZeHiro/orgs","repos_url":"https://api.github.com/users/ZeHiro/repos","events_url":"https://api.github.com/users/ZeHiro/events{/privacy}","received_events_url":"https://api.github.com/users/ZeHiro/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-09T21:48:00Z","updated_at":"2015-11-11T17:42:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a43dfc12ecb26c296250a2a8d995f895b4f440a5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bnjbvr/kresus/pulls/264/commits","review_comments_url":"https://api.github.com/repos/bnjbvr/kresus/pulls/264/comments","review_comment_url":"https://api.github.com/repos/bnjbvr/kresus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bnjbvr/kresus/issues/264/comments","statuses_url":"https://api.github.com/repos/bnjbvr/kresus/statuses/0a27bca70b7e72041aa7ae34fc662c84d62af85a","head":{"label":"ZeHiro:incoming-custom-label","ref":"incoming-custom-label","sha":"0a27bca70b7e72041aa7ae34fc662c84d62af85a","user":{"login":"ZeHiro","id":7999082,"avatar_url":"https://avatars.githubusercontent.com/u/7999082?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeHiro","html_url":"https://github.com/ZeHiro","followers_url":"https://api.github.com/users/ZeHiro/followers","following_url":"https://api.github.com/users/ZeHiro/following{/other_user}","gists_url":"https://api.github.com/users/ZeHiro/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeHiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeHiro/subscriptions","organizations_url":"https://api.github.com/users/ZeHiro/orgs","repos_url":"https://api.github.com/users/ZeHiro/repos","events_url":"https://api.github.com/users/ZeHiro/events{/privacy}","received_events_url":"https://api.github.com/users/ZeHiro/received_events","type":"User","site_admin":false},"repo":{"id":42952362,"name":"kresus","full_name":"ZeHiro/kresus","owner":{"login":"ZeHiro","id":7999082,"avatar_url":"https://avatars.githubusercontent.com/u/7999082?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeHiro","html_url":"https://github.com/ZeHiro","followers_url":"https://api.github.com/users/ZeHiro/followers","following_url":"https://api.github.com/users/ZeHiro/following{/other_user}","gists_url":"https://api.github.com/users/ZeHiro/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeHiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeHiro/subscriptions","organizations_url":"https://api.github.com/users/ZeHiro/orgs","repos_url":"https://api.github.com/users/ZeHiro/repos","events_url":"https://api.github.com/users/ZeHiro/events{/privacy}","received_events_url":"https://api.github.com/users/ZeHiro/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ZeHiro/kresus","description":"Get rich, or die codin'","fork":true,"url":"https://api.github.com/repos/ZeHiro/kresus","forks_url":"https://api.github.com/repos/ZeHiro/kresus/forks","keys_url":"https://api.github.com/repos/ZeHiro/kresus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ZeHiro/kresus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ZeHiro/kresus/teams","hooks_url":"https://api.github.com/repos/ZeHiro/kresus/hooks","issue_events_url":"https://api.github.com/repos/ZeHiro/kresus/issues/events{/number}","events_url":"https://api.github.com/repos/ZeHiro/kresus/events","assignees_url":"https://api.github.com/repos/ZeHiro/kresus/assignees{/user}","branches_url":"https://api.github.com/repos/ZeHiro/kresus/branches{/branch}","tags_url":"https://api.github.com/repos/ZeHiro/kresus/tags","blobs_url":"https://api.github.com/repos/ZeHiro/kresus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ZeHiro/kresus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ZeHiro/kresus/git/refs{/sha}","trees_url":"https://api.github.com/repos/ZeHiro/kresus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ZeHiro/kresus/statuses/{sha}","languages_url":"https://api.github.com/repos/ZeHiro/kresus/languages","stargazers_url":"https://api.github.com/repos/ZeHiro/kresus/stargazers","contributors_url":"https://api.github.com/repos/ZeHiro/kresus/contributors","subscribers_url":"https://api.github.com/repos/ZeHiro/kresus/subscribers","subscription_url":"https://api.github.com/repos/ZeHiro/kresus/subscription","commits_url":"https://api.github.com/repos/ZeHiro/kresus/commits{/sha}","git_commits_url":"https://api.github.com/repos/ZeHiro/kresus/git/commits{/sha}","comments_url":"https://api.github.com/repos/ZeHiro/kresus/comments{/number}","issue_comment_url":"https://api.github.com/repos/ZeHiro/kresus/issues/comments{/number}","contents_url":"https://api.github.com/repos/ZeHiro/kresus/contents/{+path}","compare_url":"https://api.github.com/repos/ZeHiro/kresus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ZeHiro/kresus/merges","archive_url":"https://api.github.com/repos/ZeHiro/kresus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ZeHiro/kresus/downloads","issues_url":"https://api.github.com/repos/ZeHiro/kresus/issues{/number}","pulls_url":"https://api.github.com/repos/ZeHiro/kresus/pulls{/number}","milestones_url":"https://api.github.com/repos/ZeHiro/kresus/milestones{/number}","notifications_url":"https://api.github.com/repos/ZeHiro/kresus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ZeHiro/kresus/labels{/name}","releases_url":"https://api.github.com/repos/ZeHiro/kresus/releases{/id}","created_at":"2015-09-22T18:19:53Z","updated_at":"2015-09-22T18:19:55Z","pushed_at":"2015-11-11T12:45:25Z","git_url":"git://github.com/ZeHiro/kresus.git","ssh_url":"git@github.com:ZeHiro/kresus.git","clone_url":"https://github.com/ZeHiro/kresus.git","svn_url":"https://github.com/ZeHiro/kresus","homepage":"","size":4686,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"bnjbvr:incoming","ref":"incoming","sha":"d2b28e9e1b174d44cb9f61dc872322c4b60618f3","user":{"login":"bnjbvr","id":1180019,"avatar_url":"https://avatars.githubusercontent.com/u/1180019?v=3","gravatar_id":"","url":"https://api.github.com/users/bnjbvr","html_url":"https://github.com/bnjbvr","followers_url":"https://api.github.com/users/bnjbvr/followers","following_url":"https://api.github.com/users/bnjbvr/following{/other_user}","gists_url":"https://api.github.com/users/bnjbvr/gists{/gist_id}","starred_url":"https://api.github.com/users/bnjbvr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnjbvr/subscriptions","organizations_url":"https://api.github.com/users/bnjbvr/orgs","repos_url":"https://api.github.com/users/bnjbvr/repos","events_url":"https://api.github.com/users/bnjbvr/events{/privacy}","received_events_url":"https://api.github.com/users/bnjbvr/received_events","type":"User","site_admin":false},"repo":{"id":22532326,"name":"kresus","full_name":"bnjbvr/kresus","owner":{"login":"bnjbvr","id":1180019,"avatar_url":"https://avatars.githubusercontent.com/u/1180019?v=3","gravatar_id":"","url":"https://api.github.com/users/bnjbvr","html_url":"https://github.com/bnjbvr","followers_url":"https://api.github.com/users/bnjbvr/followers","following_url":"https://api.github.com/users/bnjbvr/following{/other_user}","gists_url":"https://api.github.com/users/bnjbvr/gists{/gist_id}","starred_url":"https://api.github.com/users/bnjbvr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnjbvr/subscriptions","organizations_url":"https://api.github.com/users/bnjbvr/orgs","repos_url":"https://api.github.com/users/bnjbvr/repos","events_url":"https://api.github.com/users/bnjbvr/events{/privacy}","received_events_url":"https://api.github.com/users/bnjbvr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bnjbvr/kresus","description":"Get rich, or die codin'","fork":false,"url":"https://api.github.com/repos/bnjbvr/kresus","forks_url":"https://api.github.com/repos/bnjbvr/kresus/forks","keys_url":"https://api.github.com/repos/bnjbvr/kresus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bnjbvr/kresus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bnjbvr/kresus/teams","hooks_url":"https://api.github.com/repos/bnjbvr/kresus/hooks","issue_events_url":"https://api.github.com/repos/bnjbvr/kresus/issues/events{/number}","events_url":"https://api.github.com/repos/bnjbvr/kresus/events","assignees_url":"https://api.github.com/repos/bnjbvr/kresus/assignees{/user}","branches_url":"https://api.github.com/repos/bnjbvr/kresus/branches{/branch}","tags_url":"https://api.github.com/repos/bnjbvr/kresus/tags","blobs_url":"https://api.github.com/repos/bnjbvr/kresus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bnjbvr/kresus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bnjbvr/kresus/git/refs{/sha}","trees_url":"https://api.github.com/repos/bnjbvr/kresus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bnjbvr/kresus/statuses/{sha}","languages_url":"https://api.github.com/repos/bnjbvr/kresus/languages","stargazers_url":"https://api.github.com/repos/bnjbvr/kresus/stargazers","contributors_url":"https://api.github.com/repos/bnjbvr/kresus/contributors","subscribers_url":"https://api.github.com/repos/bnjbvr/kresus/subscribers","subscription_url":"https://api.github.com/repos/bnjbvr/kresus/subscription","commits_url":"https://api.github.com/repos/bnjbvr/kresus/commits{/sha}","git_commits_url":"https://api.github.com/repos/bnjbvr/kresus/git/commits{/sha}","comments_url":"https://api.github.com/repos/bnjbvr/kresus/comments{/number}","issue_comment_url":"https://api.github.com/repos/bnjbvr/kresus/issues/comments{/number}","contents_url":"https://api.github.com/repos/bnjbvr/kresus/contents/{+path}","compare_url":"https://api.github.com/repos/bnjbvr/kresus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bnjbvr/kresus/merges","archive_url":"https://api.github.com/repos/bnjbvr/kresus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bnjbvr/kresus/downloads","issues_url":"https://api.github.com/repos/bnjbvr/kresus/issues{/number}","pulls_url":"https://api.github.com/repos/bnjbvr/kresus/pulls{/number}","milestones_url":"https://api.github.com/repos/bnjbvr/kresus/milestones{/number}","notifications_url":"https://api.github.com/repos/bnjbvr/kresus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bnjbvr/kresus/labels{/name}","releases_url":"https://api.github.com/repos/bnjbvr/kresus/releases{/id}","created_at":"2014-08-01T22:54:37Z","updated_at":"2015-11-09T13:27:36Z","pushed_at":"2015-11-11T12:45:25Z","git_url":"git://github.com/bnjbvr/kresus.git","ssh_url":"git@github.com:bnjbvr/kresus.git","clone_url":"https://github.com/bnjbvr/kresus.git","svn_url":"https://github.com/bnjbvr/kresus","homepage":"","size":6188,"stargazers_count":40,"watchers_count":40,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":94,"forks":24,"open_issues":94,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bnjbvr/kresus/pulls/264"},"html":{"href":"https://github.com/bnjbvr/kresus/pull/264"},"issue":{"href":"https://api.github.com/repos/bnjbvr/kresus/issues/264"},"comments":{"href":"https://api.github.com/repos/bnjbvr/kresus/issues/264/comments"},"review_comments":{"href":"https://api.github.com/repos/bnjbvr/kresus/pulls/264/comments"},"review_comment":{"href":"https://api.github.com/repos/bnjbvr/kresus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bnjbvr/kresus/pulls/264/commits"},"statuses":{"href":"https://api.github.com/repos/bnjbvr/kresus/statuses/0a27bca70b7e72041aa7ae34fc662c84d62af85a"}}}}