{"action":"created","comment":{"url":"https://api.github.com/repos/martensonbj/ideabox/pulls/comments/59241580","id":59241580,"diff_hunk":"@@ -3,9 +3,13 @@ $(document).ready(function() {\n });\n \n var bodyText = function getIdeaBody(){\n-  var input = $(\"#idea-body\").val()\n+  var input = $(\"#idea-body\").val();\n   var maxLength = 100;\n   var words = input.split(' ');\n+  truncateWords(words, maxLength);","path":"app/assets/javascripts/create_idea.js","position":8,"original_position":8,"commit_id":"4762f3874f7d68c099020bbec1e18ee84380bcd1","original_commit_id":"4762f3874f7d68c099020bbec1e18ee84380bcd1","user":{"login":"rrgayhart","id":3967825,"avatar_url":"https://avatars.githubusercontent.com/u/3967825?v=3","gravatar_id":"","url":"https://api.github.com/users/rrgayhart","html_url":"https://github.com/rrgayhart","followers_url":"https://api.github.com/users/rrgayhart/followers","following_url":"https://api.github.com/users/rrgayhart/following{/other_user}","gists_url":"https://api.github.com/users/rrgayhart/gists{/gist_id}","starred_url":"https://api.github.com/users/rrgayhart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrgayhart/subscriptions","organizations_url":"https://api.github.com/users/rrgayhart/orgs","repos_url":"https://api.github.com/users/rrgayhart/repos","events_url":"https://api.github.com/users/rrgayhart/events{/privacy}","received_events_url":"https://api.github.com/users/rrgayhart/received_events","type":"User","site_admin":false},"body":"Nice!","created_at":"2016-04-11T17:06:08Z","updated_at":"2016-04-11T17:06:08Z","html_url":"https://github.com/martensonbj/ideabox/pull/1#discussion_r59241580","pull_request_url":"https://api.github.com/repos/martensonbj/ideabox/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/martensonbj/ideabox/pulls/comments/59241580"},"html":{"href":"https://github.com/martensonbj/ideabox/pull/1#discussion_r59241580"},"pull_request":{"href":"https://api.github.com/repos/martensonbj/ideabox/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/martensonbj/ideabox/pulls/1","id":65921660,"html_url":"https://github.com/martensonbj/ideabox/pull/1","diff_url":"https://github.com/martensonbj/ideabox/pull/1.diff","patch_url":"https://github.com/martensonbj/ideabox/pull/1.patch","issue_url":"https://api.github.com/repos/martensonbj/ideabox/issues/1","number":1,"state":"open","locked":false,"title":"Refactor methods to create an idea","user":{"login":"martensonbj","id":13123158,"avatar_url":"https://avatars.githubusercontent.com/u/13123158?v=3","gravatar_id":"","url":"https://api.github.com/users/martensonbj","html_url":"https://github.com/martensonbj","followers_url":"https://api.github.com/users/martensonbj/followers","following_url":"https://api.github.com/users/martensonbj/following{/other_user}","gists_url":"https://api.github.com/users/martensonbj/gists{/gist_id}","starred_url":"https://api.github.com/users/martensonbj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martensonbj/subscriptions","organizations_url":"https://api.github.com/users/martensonbj/orgs","repos_url":"https://api.github.com/users/martensonbj/repos","events_url":"https://api.github.com/users/martensonbj/events{/privacy}","received_events_url":"https://api.github.com/users/martensonbj/received_events","type":"User","site_admin":false},"body":"#### What is this PR about?\r\nThis PR pulls out a couple methods from within `create_idea.js`. There is a lot going on in each of these methods that needed to handled independently.\r\n@SteveOscar - can I get your eyes on this? \r\n\r\nIn create_idea.js lines 51-53 reset the input fields for creating a new idea back to empty strings - these lines were extracted from the ajax call method into an independent function which is called to fire after the ajax call is sent out.\r\n\r\nLines 13-17 were pulled out of the method `getIdeaBody` into their own method. These lines check to see if the incoming body text should be truncated or not, which seems like something that should be handled outside of the function that sets what the body text ultimately gets sent to the view as.\r\n\r\n#### Any background context you want to provide?\r\n\r\nThese small refactors are part of a targeted effort to improve on reducing the responsibilty of the functions I am writing. Based on best practices, functions should really have only one job or responsiblity and throughout this project there are lots of places where functions do a lot of different things, which makes testing harder than necessary. \r\n\r\n#### What gif best describes this PR or how it makes you feel?\r\n@rrgayhart Check it out! \r\n![gif](http://i.giphy.com/OHZ1gSUThmEso.gif)","created_at":"2016-04-10T20:23:05Z","updated_at":"2016-04-11T17:06:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"25caae7aba5f43096cb059ceac79e896ce6e6143","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/martensonbj/ideabox/pulls/1/commits","review_comments_url":"https://api.github.com/repos/martensonbj/ideabox/pulls/1/comments","review_comment_url":"https://api.github.com/repos/martensonbj/ideabox/pulls/comments{/number}","comments_url":"https://api.github.com/repos/martensonbj/ideabox/issues/1/comments","statuses_url":"https://api.github.com/repos/martensonbj/ideabox/statuses/4762f3874f7d68c099020bbec1e18ee84380bcd1","head":{"label":"martensonbj:refactor_tractor","ref":"refactor_tractor","sha":"4762f3874f7d68c099020bbec1e18ee84380bcd1","user":{"login":"martensonbj","id":13123158,"avatar_url":"https://avatars.githubusercontent.com/u/13123158?v=3","gravatar_id":"","url":"https://api.github.com/users/martensonbj","html_url":"https://github.com/martensonbj","followers_url":"https://api.github.com/users/martensonbj/followers","following_url":"https://api.github.com/users/martensonbj/following{/other_user}","gists_url":"https://api.github.com/users/martensonbj/gists{/gist_id}","starred_url":"https://api.github.com/users/martensonbj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martensonbj/subscriptions","organizations_url":"https://api.github.com/users/martensonbj/orgs","repos_url":"https://api.github.com/users/martensonbj/repos","events_url":"https://api.github.com/users/martensonbj/events{/privacy}","received_events_url":"https://api.github.com/users/martensonbj/received_events","type":"User","site_admin":false},"repo":{"id":54419992,"name":"ideabox","full_name":"martensonbj/ideabox","owner":{"login":"martensonbj","id":13123158,"avatar_url":"https://avatars.githubusercontent.com/u/13123158?v=3","gravatar_id":"","url":"https://api.github.com/users/martensonbj","html_url":"https://github.com/martensonbj","followers_url":"https://api.github.com/users/martensonbj/followers","following_url":"https://api.github.com/users/martensonbj/following{/other_user}","gists_url":"https://api.github.com/users/martensonbj/gists{/gist_id}","starred_url":"https://api.github.com/users/martensonbj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martensonbj/subscriptions","organizations_url":"https://api.github.com/users/martensonbj/orgs","repos_url":"https://api.github.com/users/martensonbj/repos","events_url":"https://api.github.com/users/martensonbj/events{/privacy}","received_events_url":"https://api.github.com/users/martensonbj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/martensonbj/ideabox","description":null,"fork":false,"url":"https://api.github.com/repos/martensonbj/ideabox","forks_url":"https://api.github.com/repos/martensonbj/ideabox/forks","keys_url":"https://api.github.com/repos/martensonbj/ideabox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/martensonbj/ideabox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/martensonbj/ideabox/teams","hooks_url":"https://api.github.com/repos/martensonbj/ideabox/hooks","issue_events_url":"https://api.github.com/repos/martensonbj/ideabox/issues/events{/number}","events_url":"https://api.github.com/repos/martensonbj/ideabox/events","assignees_url":"https://api.github.com/repos/martensonbj/ideabox/assignees{/user}","branches_url":"https://api.github.com/repos/martensonbj/ideabox/branches{/branch}","tags_url":"https://api.github.com/repos/martensonbj/ideabox/tags","blobs_url":"https://api.github.com/repos/martensonbj/ideabox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/martensonbj/ideabox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/martensonbj/ideabox/git/refs{/sha}","trees_url":"https://api.github.com/repos/martensonbj/ideabox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/martensonbj/ideabox/statuses/{sha}","languages_url":"https://api.github.com/repos/martensonbj/ideabox/languages","stargazers_url":"https://api.github.com/repos/martensonbj/ideabox/stargazers","contributors_url":"https://api.github.com/repos/martensonbj/ideabox/contributors","subscribers_url":"https://api.github.com/repos/martensonbj/ideabox/subscribers","subscription_url":"https://api.github.com/repos/martensonbj/ideabox/subscription","commits_url":"https://api.github.com/repos/martensonbj/ideabox/commits{/sha}","git_commits_url":"https://api.github.com/repos/martensonbj/ideabox/git/commits{/sha}","comments_url":"https://api.github.com/repos/martensonbj/ideabox/comments{/number}","issue_comment_url":"https://api.github.com/repos/martensonbj/ideabox/issues/comments{/number}","contents_url":"https://api.github.com/repos/martensonbj/ideabox/contents/{+path}","compare_url":"https://api.github.com/repos/martensonbj/ideabox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/martensonbj/ideabox/merges","archive_url":"https://api.github.com/repos/martensonbj/ideabox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/martensonbj/ideabox/downloads","issues_url":"https://api.github.com/repos/martensonbj/ideabox/issues{/number}","pulls_url":"https://api.github.com/repos/martensonbj/ideabox/pulls{/number}","milestones_url":"https://api.github.com/repos/martensonbj/ideabox/milestones{/number}","notifications_url":"https://api.github.com/repos/martensonbj/ideabox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/martensonbj/ideabox/labels{/name}","releases_url":"https://api.github.com/repos/martensonbj/ideabox/releases{/id}","deployments_url":"https://api.github.com/repos/martensonbj/ideabox/deployments","created_at":"2016-03-21T20:22:30Z","updated_at":"2016-03-21T20:22:49Z","pushed_at":"2016-04-10T20:23:05Z","git_url":"git://github.com/martensonbj/ideabox.git","ssh_url":"git@github.com:martensonbj/ideabox.git","clone_url":"https://github.com/martensonbj/ideabox.git","svn_url":"https://github.com/martensonbj/ideabox","homepage":null,"size":90,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"martensonbj:master","ref":"master","sha":"8f281ec09ebc4809a03726505078dc33aaf7cc2c","user":{"login":"martensonbj","id":13123158,"avatar_url":"https://avatars.githubusercontent.com/u/13123158?v=3","gravatar_id":"","url":"https://api.github.com/users/martensonbj","html_url":"https://github.com/martensonbj","followers_url":"https://api.github.com/users/martensonbj/followers","following_url":"https://api.github.com/users/martensonbj/following{/other_user}","gists_url":"https://api.github.com/users/martensonbj/gists{/gist_id}","starred_url":"https://api.github.com/users/martensonbj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martensonbj/subscriptions","organizations_url":"https://api.github.com/users/martensonbj/orgs","repos_url":"https://api.github.com/users/martensonbj/repos","events_url":"https://api.github.com/users/martensonbj/events{/privacy}","received_events_url":"https://api.github.com/users/martensonbj/received_events","type":"User","site_admin":false},"repo":{"id":54419992,"name":"ideabox","full_name":"martensonbj/ideabox","owner":{"login":"martensonbj","id":13123158,"avatar_url":"https://avatars.githubusercontent.com/u/13123158?v=3","gravatar_id":"","url":"https://api.github.com/users/martensonbj","html_url":"https://github.com/martensonbj","followers_url":"https://api.github.com/users/martensonbj/followers","following_url":"https://api.github.com/users/martensonbj/following{/other_user}","gists_url":"https://api.github.com/users/martensonbj/gists{/gist_id}","starred_url":"https://api.github.com/users/martensonbj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martensonbj/subscriptions","organizations_url":"https://api.github.com/users/martensonbj/orgs","repos_url":"https://api.github.com/users/martensonbj/repos","events_url":"https://api.github.com/users/martensonbj/events{/privacy}","received_events_url":"https://api.github.com/users/martensonbj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/martensonbj/ideabox","description":null,"fork":false,"url":"https://api.github.com/repos/martensonbj/ideabox","forks_url":"https://api.github.com/repos/martensonbj/ideabox/forks","keys_url":"https://api.github.com/repos/martensonbj/ideabox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/martensonbj/ideabox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/martensonbj/ideabox/teams","hooks_url":"https://api.github.com/repos/martensonbj/ideabox/hooks","issue_events_url":"https://api.github.com/repos/martensonbj/ideabox/issues/events{/number}","events_url":"https://api.github.com/repos/martensonbj/ideabox/events","assignees_url":"https://api.github.com/repos/martensonbj/ideabox/assignees{/user}","branches_url":"https://api.github.com/repos/martensonbj/ideabox/branches{/branch}","tags_url":"https://api.github.com/repos/martensonbj/ideabox/tags","blobs_url":"https://api.github.com/repos/martensonbj/ideabox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/martensonbj/ideabox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/martensonbj/ideabox/git/refs{/sha}","trees_url":"https://api.github.com/repos/martensonbj/ideabox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/martensonbj/ideabox/statuses/{sha}","languages_url":"https://api.github.com/repos/martensonbj/ideabox/languages","stargazers_url":"https://api.github.com/repos/martensonbj/ideabox/stargazers","contributors_url":"https://api.github.com/repos/martensonbj/ideabox/contributors","subscribers_url":"https://api.github.com/repos/martensonbj/ideabox/subscribers","subscription_url":"https://api.github.com/repos/martensonbj/ideabox/subscription","commits_url":"https://api.github.com/repos/martensonbj/ideabox/commits{/sha}","git_commits_url":"https://api.github.com/repos/martensonbj/ideabox/git/commits{/sha}","comments_url":"https://api.github.com/repos/martensonbj/ideabox/comments{/number}","issue_comment_url":"https://api.github.com/repos/martensonbj/ideabox/issues/comments{/number}","contents_url":"https://api.github.com/repos/martensonbj/ideabox/contents/{+path}","compare_url":"https://api.github.com/repos/martensonbj/ideabox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/martensonbj/ideabox/merges","archive_url":"https://api.github.com/repos/martensonbj/ideabox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/martensonbj/ideabox/downloads","issues_url":"https://api.github.com/repos/martensonbj/ideabox/issues{/number}","pulls_url":"https://api.github.com/repos/martensonbj/ideabox/pulls{/number}","milestones_url":"https://api.github.com/repos/martensonbj/ideabox/milestones{/number}","notifications_url":"https://api.github.com/repos/martensonbj/ideabox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/martensonbj/ideabox/labels{/name}","releases_url":"https://api.github.com/repos/martensonbj/ideabox/releases{/id}","deployments_url":"https://api.github.com/repos/martensonbj/ideabox/deployments","created_at":"2016-03-21T20:22:30Z","updated_at":"2016-03-21T20:22:49Z","pushed_at":"2016-04-10T20:23:05Z","git_url":"git://github.com/martensonbj/ideabox.git","ssh_url":"git@github.com:martensonbj/ideabox.git","clone_url":"https://github.com/martensonbj/ideabox.git","svn_url":"https://github.com/martensonbj/ideabox","homepage":null,"size":90,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/martensonbj/ideabox/pulls/1"},"html":{"href":"https://github.com/martensonbj/ideabox/pull/1"},"issue":{"href":"https://api.github.com/repos/martensonbj/ideabox/issues/1"},"comments":{"href":"https://api.github.com/repos/martensonbj/ideabox/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/martensonbj/ideabox/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/martensonbj/ideabox/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/martensonbj/ideabox/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/martensonbj/ideabox/statuses/4762f3874f7d68c099020bbec1e18ee84380bcd1"}}}}