GitHub PullRequestReviewCommentEvent at 2014-07-28 18:48:42
Repository: sport-ng
Actor: mikefrey
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/sportngin/sport-ng/pulls/comments/15481994","id":15481994,"diff_hunk":"@@ -0,0 +1,170 @@\n+/*\n+Timepicker directive\n+\n+Usage:\n+\n+  The timepicker directive should be used whereever a timepicker input\n+  be displayed:\n+\n+    <timepicker time=\"ctrl.eventTime\"></timepicker>\n+\n+time attribute:\n+  The time attribute is required and takes the place of ng-model\n+  must be a string in the 00:00 form.\n+\n+allowtbd attribute:\n+  The allowtbd attribute is not required and denotes whether a blank time will be converted to 'TBD' or rejected\n+  set to `false` by default\n+  must be a boolean\n+\n+hour12 attribute:\n+  The hour2 attribute is not required and denotes whether 12 or 24 hour format is used\n+  set to `true` by default\n+  must be a boolean\n+\n+displayformat attribute:\n+  The displayformat attribute is not required and is a function that converts a time string value to a date\n+  set to local function be default\n+  must be a function accepting the following parameters: time (string), hour12 (boolean), allowTBD (boolean)\n+\n+stringtotime attribute:\n+  This stringtotime attribute is not required and is a function that converts an entered string into a time string\n+  set to local function by default\n+  must be a function accepting the following parameters: val (string), allowTBD (boolean)\n+\n+*/\n+\n+;(function() {\n+'use strict'\n+\n+var displayFormat = function(time, hour12, allowTBD) {\n+  if (!time || !time.valueOf || !time.valueOf()){\n+    if (allowTBD) return 'TBD'\n+    return ''\n+  }\n+  if (hour12) return displayFormat12(time)\n+  return time\n+}\n+\n+function displayFormat12(time) {\n+  time = time.split(':')\n+  var hour = parseInt(time[0])\n+  var period = hour >= 12 ? 'pm' : 'am'\n+  hour = hour % 12\n+  if (hour == 0) hour = 12\n+  return hour + ':' + time[1] + ' ' + period\n+}\n+\n+var stringToTime = function(val, allowTBD) {\n+  var whitespaceOnly = !val.match(/\\S/) //still a usefull function?\n+  if (allowTBD && (whitespaceOnly || val.toUpperCase() == 'TBD')) {\n+    return ''\n+  } else if (whitespaceOnly) { //evaluate utility\n+    return null\n+  }\n+\n+  var pm = false\n+  if (val.match(/pm/i)) pm = true //should I use `pm` or just `p` ?\n+  var time = val.replace(/[^\\d]/g, '').split(':')\n+\n+  var hour\n+  var minute\n+  \n+  if (time.length !== 2) {\n+    var withoutColon = time[0]\n+    //the switch statement is from the original code. Should I rewrite it?\n+    switch (withoutColon.length) {\n+\n+      case 1:\n+      case 2:\n+        hour = parseInt(v)\n+        minute = 0\n+        break\n+\n+      case 3:\n+        hour = parseInt(withoutColon.substring(0,1))\n+        minute = parseInt(withoutColon.substring(1))\n+        break\n+\n+      default:\n+        hour = parseInt(withoutColon.substring(0,2)) || 0\n+        minute = parseInt(withoutColon.substring(2,4)) || 0\n+    }\n+  }\n+\n+  // otherwise, convert to numbers\n+  else {\n+    hour = parseInt(time[0])\n+    minute = parseInt(time[1])\n+    //should I add the line below back in? I think the other way would be best\n+    //if (val[1].length === 1) minute *= 10 // one digit minutes (12:3) >> (12:30)\n+  }\n+\n+  hour += Math.floor(minute / 60)\n+  minute %= 60\n+\n+  if (pm) hour += 12\n+  hour %= 24\n+  if (hour == 0 || hour == 12) hour += 12\n+  hour %= 24\n+\n+  return twoDigit(hour) + ':' + twoDigit(minute)\n+\n+}\n+\n+function twoDigit(x){\n+  x = x.toString()\n+  x = '00' + x\n+  return x.substring(x.length-2)\n+}\n+\n+var defaults = {\n+  allowtbd: false, //still useful function?\n+  hour12: true,\n+  displayFormat: displayFormat,\n+  stringToTime: stringToTime\n+}\n+\n+\n+angular.module('sport.ng')\n+  .directive('timepicker', function(_) {\n+    return {\n+      restrict: 'A',\n+      scope: { //should defaults be put here?\n+        time: '=',\n+        allowtbd: '=', //never used in either sport admin or venue admin. Shoud I keep it?\n+        hour12: '=',\n+        displayformat: '&',\n+        stringtotime: '&' //never used in sport admin or venue admin. Should I keep it?\n+      },\n+      templateUrl: '/bower_components/sport-ng/timepicker/timepicker.html',\n+      link: function(scope, element, attrs) {\n+        // transfer some of the attributes to the input, removing them from the timepicker element\n+        var attributes = _.pick(attrs, ['id', 'name', 'tabindex'])\n+        _.each(attributes, function(val, name) { element.removeAttr(name) })","path":"timepicker/timepickerDirective.js","position":144,"original_position":144,"commit_id":"8ba7dc81b50a5cd40fa1471987ba0b80a57ad8f2","original_commit_id":"43f66eb8a317c97e0b60744175666a41b0bf6ed0","user":{"login":"mikefrey","id":62940,"avatar_url":"https://avatars.githubusercontent.com/u/62940?","gravatar_id":"b5cd9155ff71d0971b0a8236d343615b","url":"https://api.github.com/users/mikefrey","html_url":"https://github.com/mikefrey","followers_url":"https://api.github.com/users/mikefrey/followers","following_url":"https://api.github.com/users/mikefrey/following{/other_user}","gists_url":"https://api.github.com/users/mikefrey/gists{/gist_id}","starred_url":"https://api.github.com/users/mikefrey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikefrey/subscriptions","organizations_url":"https://api.github.com/users/mikefrey/orgs","repos_url":"https://api.github.com/users/mikefrey/repos","events_url":"https://api.github.com/users/mikefrey/events{/privacy}","received_events_url":"https://api.github.com/users/mikefrey/received_events","type":"User","site_admin":false},"body":"I agree with removing the attrs after they've been copied.","created_at":"2014-07-28T18:48:42Z","updated_at":"2014-07-28T18:48:42Z","html_url":"https://github.com/sportngin/sport-ng/pull/27#discussion_r15481994","pull_request_url":"https://api.github.com/repos/sportngin/sport-ng/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/sportngin/sport-ng/pulls/comments/15481994"},"html":{"href":"https://github.com/sportngin/sport-ng/pull/27#discussion_r15481994"},"pull_request":{"href":"https://api.github.com/repos/sportngin/sport-ng/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/sportngin/sport-ng/pulls/27","id":18982120,"html_url":"https://github.com/sportngin/sport-ng/pull/27","diff_url":"https://github.com/sportngin/sport-ng/pull/27.diff","patch_url":"https://github.com/sportngin/sport-ng/pull/27.patch","issue_url":"https://api.github.com/repos/sportngin/sport-ng/issues/27","number":27,"state":"open","title":"Angular timepicker","user":{"login":"clado","id":2933589,"avatar_url":"https://avatars.githubusercontent.com/u/2933589?","gravatar_id":"3e3444b24d7d058a408a624f2d7e2c47","url":"https://api.github.com/users/clado","html_url":"https://github.com/clado","followers_url":"https://api.github.com/users/clado/followers","following_url":"https://api.github.com/users/clado/following{/other_user}","gists_url":"https://api.github.com/users/clado/gists{/gist_id}","starred_url":"https://api.github.com/users/clado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clado/subscriptions","organizations_url":"https://api.github.com/users/clado/orgs","repos_url":"https://api.github.com/users/clado/repos","events_url":"https://api.github.com/users/clado/events{/privacy}","received_events_url":"https://api.github.com/users/clado/received_events","type":"User","site_admin":false},"body":"A rewrite of `js/ui/timepicker`.\r\nCurrently has all the functions of old timepicker, but we may want to drop/revise some. Cannot currently replace old timepicker, due to the non-angular nature of many sport admin pages that utilize timepicker.\r\n\r\nQA on venue admin can be found [here](https://github.com/sportngin/venue_admin/pull/116)\r\n\r\n~~In order to simulate blur events for tests, I needed to add jquery. I don't think there's a better way to simulate blur events, but there may be a better way to import jquery. I could also bypass the blur events and just test the function itself, if necessary/recommended.~~\r\nInstead of simulating blur events, I just triggered them manually using the function called by ng-blur, because I didn't know if adding jquery was really a thing we wanted to do. Tell me and I can change it back.","created_at":"2014-07-28T17:48:40Z","updated_at":"2014-07-28T18:48:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83415262a2431a7ea5aaea855228339279499106","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sportngin/sport-ng/pulls/27/commits","review_comments_url":"https://api.github.com/repos/sportngin/sport-ng/pulls/27/comments","review_comment_url":"https://api.github.com/repos/sportngin/sport-ng/pulls/comments/{number}","comments_url":"https://api.github.com/repos/sportngin/sport-ng/issues/27/comments","statuses_url":"https://api.github.com/repos/sportngin/sport-ng/statuses/8ba7dc81b50a5cd40fa1471987ba0b80a57ad8f2","head":{"label":"sportngin:angular-timepicker","ref":"angular-timepicker","sha":"8ba7dc81b50a5cd40fa1471987ba0b80a57ad8f2","user":{"login":"sportngin","id":3728684,"avatar_url":"https://avatars.githubusercontent.com/u/3728684?","gravatar_id":"7ea1840324741122e771fe7e3f6fe9bd","url":"https://api.github.com/users/sportngin","html_url":"https://github.com/sportngin","followers_url":"https://api.github.com/users/sportngin/followers","following_url":"https://api.github.com/users/sportngin/following{/other_user}","gists_url":"https://api.github.com/users/sportngin/gists{/gist_id}","starred_url":"https://api.github.com/users/sportngin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sportngin/subscriptions","organizations_url":"https://api.github.com/users/sportngin/orgs","repos_url":"https://api.github.com/users/sportngin/repos","events_url":"https://api.github.com/users/sportngin/events{/privacy}","received_events_url":"https://api.github.com/users/sportngin/received_events","type":"Organization","site_admin":false},"repo":{"id":17226840,"name":"sport-ng","full_name":"sportngin/sport-ng","owner":{"login":"sportngin","id":3728684,"avatar_url":"https://avatars.githubusercontent.com/u/3728684?","gravatar_id":"7ea1840324741122e771fe7e3f6fe9bd","url":"https://api.github.com/users/sportngin","html_url":"https://github.com/sportngin","followers_url":"https://api.github.com/users/sportngin/followers","following_url":"https://api.github.com/users/sportngin/following{/other_user}","gists_url":"https://api.github.com/users/sportngin/gists{/gist_id}","starred_url":"https://api.github.com/users/sportngin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sportngin/subscriptions","organizations_url":"https://api.github.com/users/sportngin/orgs","repos_url":"https://api.github.com/users/sportngin/repos","events_url":"https://api.github.com/users/sportngin/events{/privacy}","received_events_url":"https://api.github.com/users/sportngin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sportngin/sport-ng","description":"","fork":false,"url":"https://api.github.com/repos/sportngin/sport-ng","forks_url":"https://api.github.com/repos/sportngin/sport-ng/forks","keys_url":"https://api.github.com/repos/sportngin/sport-ng/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sportngin/sport-ng/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sportngin/sport-ng/teams","hooks_url":"https://api.github.com/repos/sportngin/sport-ng/hooks","issue_events_url":"https://api.github.com/repos/sportngin/sport-ng/issues/events{/number}","events_url":"https://api.github.com/repos/sportngin/sport-ng/events","assignees_url":"https://api.github.com/repos/sportngin/sport-ng/assignees{/user}","branches_url":"https://api.github.com/repos/sportngin/sport-ng/branches{/branch}","tags_url":"https://api.github.com/repos/sportngin/sport-ng/tags","blobs_url":"https://api.github.com/repos/sportngin/sport-ng/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sportngin/sport-ng/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sportngin/sport-ng/git/refs{/sha}","trees_url":"https://api.github.com/repos/sportngin/sport-ng/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sportngin/sport-ng/statuses/{sha}","languages_url":"https://api.github.com/repos/sportngin/sport-ng/languages","stargazers_url":"https://api.github.com/repos/sportngin/sport-ng/stargazers","contributors_url":"https://api.github.com/repos/sportngin/sport-ng/contributors","subscribers_url":"https://api.github.com/repos/sportngin/sport-ng/subscribers","subscription_url":"https://api.github.com/repos/sportngin/sport-ng/subscription","commits_url":"https://api.github.com/repos/sportngin/sport-ng/commits{/sha}","git_commits_url":"https://api.github.com/repos/sportngin/sport-ng/git/commits{/sha}","comments_url":"https://api.github.com/repos/sportngin/sport-ng/comments{/number}","issue_comment_url":"https://api.github.com/repos/sportngin/sport-ng/issues/comments/{number}","contents_url":"https://api.github.com/repos/sportngin/sport-ng/contents/{+path}","compare_url":"https://api.github.com/repos/sportngin/sport-ng/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sportngin/sport-ng/merges","archive_url":"https://api.github.com/repos/sportngin/sport-ng/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sportngin/sport-ng/downloads","issues_url":"https://api.github.com/repos/sportngin/sport-ng/issues{/number}","pulls_url":"https://api.github.com/repos/sportngin/sport-ng/pulls{/number}","milestones_url":"https://api.github.com/repos/sportngin/sport-ng/milestones{/number}","notifications_url":"https://api.github.com/repos/sportngin/sport-ng/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sportngin/sport-ng/labels{/name}","releases_url":"https://api.github.com/repos/sportngin/sport-ng/releases{/id}","created_at":"2014-02-26T21:50:07Z","updated_at":"2014-07-21T18:47:34Z","pushed_at":"2014-07-28T18:29:07Z","git_url":"git://github.com/sportngin/sport-ng.git","ssh_url":"git@github.com:sportngin/sport-ng.git","clone_url":"https://github.com/sportngin/sport-ng.git","svn_url":"https://github.com/sportngin/sport-ng","homepage":null,"size":1366,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"base":{"label":"sportngin:master","ref":"master","sha":"8e76971b482c17b96cb18e974cf529aa49c45f01","user":{"login":"sportngin","id":3728684,"avatar_url":"https://avatars.githubusercontent.com/u/3728684?","gravatar_id":"7ea1840324741122e771fe7e3f6fe9bd","url":"https://api.github.com/users/sportngin","html_url":"https://github.com/sportngin","followers_url":"https://api.github.com/users/sportngin/followers","following_url":"https://api.github.com/users/sportngin/following{/other_user}","gists_url":"https://api.github.com/users/sportngin/gists{/gist_id}","starred_url":"https://api.github.com/users/sportngin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sportngin/subscriptions","organizations_url":"https://api.github.com/users/sportngin/orgs","repos_url":"https://api.github.com/users/sportngin/repos","events_url":"https://api.github.com/users/sportngin/events{/privacy}","received_events_url":"https://api.github.com/users/sportngin/received_events","type":"Organization","site_admin":false},"repo":{"id":17226840,"name":"sport-ng","full_name":"sportngin/sport-ng","owner":{"login":"sportngin","id":3728684,"avatar_url":"https://avatars.githubusercontent.com/u/3728684?","gravatar_id":"7ea1840324741122e771fe7e3f6fe9bd","url":"https://api.github.com/users/sportngin","html_url":"https://github.com/sportngin","followers_url":"https://api.github.com/users/sportngin/followers","following_url":"https://api.github.com/users/sportngin/following{/other_user}","gists_url":"https://api.github.com/users/sportngin/gists{/gist_id}","starred_url":"https://api.github.com/users/sportngin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sportngin/subscriptions","organizations_url":"https://api.github.com/users/sportngin/orgs","repos_url":"https://api.github.com/users/sportngin/repos","events_url":"https://api.github.com/users/sportngin/events{/privacy}","received_events_url":"https://api.github.com/users/sportngin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sportngin/sport-ng","description":"","fork":false,"url":"https://api.github.com/repos/sportngin/sport-ng","forks_url":"https://api.github.com/repos/sportngin/sport-ng/forks","keys_url":"https://api.github.com/repos/sportngin/sport-ng/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sportngin/sport-ng/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sportngin/sport-ng/teams","hooks_url":"https://api.github.com/repos/sportngin/sport-ng/hooks","issue_events_url":"https://api.github.com/repos/sportngin/sport-ng/issues/events{/number}","events_url":"https://api.github.com/repos/sportngin/sport-ng/events","assignees_url":"https://api.github.com/repos/sportngin/sport-ng/assignees{/user}","branches_url":"https://api.github.com/repos/sportngin/sport-ng/branches{/branch}","tags_url":"https://api.github.com/repos/sportngin/sport-ng/tags","blobs_url":"https://api.github.com/repos/sportngin/sport-ng/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sportngin/sport-ng/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sportngin/sport-ng/git/refs{/sha}","trees_url":"https://api.github.com/repos/sportngin/sport-ng/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sportngin/sport-ng/statuses/{sha}","languages_url":"https://api.github.com/repos/sportngin/sport-ng/languages","stargazers_url":"https://api.github.com/repos/sportngin/sport-ng/stargazers","contributors_url":"https://api.github.com/repos/sportngin/sport-ng/contributors","subscribers_url":"https://api.github.com/repos/sportngin/sport-ng/subscribers","subscription_url":"https://api.github.com/repos/sportngin/sport-ng/subscription","commits_url":"https://api.github.com/repos/sportngin/sport-ng/commits{/sha}","git_commits_url":"https://api.github.com/repos/sportngin/sport-ng/git/commits{/sha}","comments_url":"https://api.github.com/repos/sportngin/sport-ng/comments{/number}","issue_comment_url":"https://api.github.com/repos/sportngin/sport-ng/issues/comments/{number}","contents_url":"https://api.github.com/repos/sportngin/sport-ng/contents/{+path}","compare_url":"https://api.github.com/repos/sportngin/sport-ng/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sportngin/sport-ng/merges","archive_url":"https://api.github.com/repos/sportngin/sport-ng/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sportngin/sport-ng/downloads","issues_url":"https://api.github.com/repos/sportngin/sport-ng/issues{/number}","pulls_url":"https://api.github.com/repos/sportngin/sport-ng/pulls{/number}","milestones_url":"https://api.github.com/repos/sportngin/sport-ng/milestones{/number}","notifications_url":"https://api.github.com/repos/sportngin/sport-ng/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sportngin/sport-ng/labels{/name}","releases_url":"https://api.github.com/repos/sportngin/sport-ng/releases{/id}","created_at":"2014-02-26T21:50:07Z","updated_at":"2014-07-21T18:47:34Z","pushed_at":"2014-07-28T18:29:07Z","git_url":"git://github.com/sportngin/sport-ng.git","ssh_url":"git@github.com:sportngin/sport-ng.git","clone_url":"https://github.com/sportngin/sport-ng.git","svn_url":"https://github.com/sportngin/sport-ng","homepage":null,"size":1366,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sportngin/sport-ng/pulls/27"},"html":{"href":"https://github.com/sportngin/sport-ng/pull/27"},"issue":{"href":"https://api.github.com/repos/sportngin/sport-ng/issues/27"},"comments":{"href":"https://api.github.com/repos/sportngin/sport-ng/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/sportngin/sport-ng/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/sportngin/sport-ng/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/sportngin/sport-ng/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/sportngin/sport-ng/statuses/8ba7dc81b50a5cd40fa1471987ba0b80a57ad8f2"}}}}