{"action":"created","comment":{"url":"https://api.github.com/repos/google/ggrc-core/pulls/comments/72422447","id":72422447,"diff_hunk":"@@ -0,0 +1,85 @@\n+/*!\n+ Copyright (C) 2016 Google Inc.\n+ Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n+ */\n+\n+/**\n+ * A component that renders a pagination widget\n+ */\n+(function (GGRC, can) {\n+  GGRC.Components('pagination', {\n+    tag: 'pagination',\n+    template: can.view(\n+      GGRC.mustache_path +\n+      '/components/pagination/pagination.mustache'\n+    ),\n+    scope: {\n+      setCurrentPage: function (obj, input) {\n+        var value = parseInt(input.val(), 10);\n+        if (value >= 1 && value <= this.paging.count) {\n+          this.paging.attr('current', value);\n+        } else if (value < 1) {\n+          this.paging.attr('current', 1);\n+        } else {\n+          this.paging.attr('current', this.paging.count);\n+        }\n+\n+        input.val('');\n+        input.blur();\n+      },\n+      changePageSize: function (size) {\n+        this.paging.attr('page_size', size);\n+        this.paging.attr('current', 1);\n+      },\n+      lastPage: function () {\n+        if (this.paging.current < this.paging.count) {\n+          this.paging.attr('current', this.paging.count);\n+        }\n+      },\n+      firstPage: function () {\n+        if (this.paging.current > 1) {\n+          this.paging.attr('current', 1);\n+        }\n+      },\n+      prevPage: function () {\n+        if (this.paging.current > 1) {\n+          this.paging.attr('current', this.paging.current - 1);\n+        }\n+      },\n+      nextPage: function () {\n+        if (this.paging.current < this.paging.count) {\n+          this.paging.attr('current', this.paging.current + 1);\n+        }\n+      }","path":"src/ggrc/assets/javascripts/components/pagination/pagination.js","position":53,"original_position":53,"commit_id":"60058abff02f8695ca16f5e1ae1c9acf941f98ff","original_commit_id":"60058abff02f8695ca16f5e1ae1c9acf941f98ff","user":{"login":"plamut","id":1235663,"avatar_url":"https://avatars.githubusercontent.com/u/1235663?v=3","gravatar_id":"","url":"https://api.github.com/users/plamut","html_url":"https://github.com/plamut","followers_url":"https://api.github.com/users/plamut/followers","following_url":"https://api.github.com/users/plamut/following{/other_user}","gists_url":"https://api.github.com/users/plamut/gists{/gist_id}","starred_url":"https://api.github.com/users/plamut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plamut/subscriptions","organizations_url":"https://api.github.com/users/plamut/orgs","repos_url":"https://api.github.com/users/plamut/repos","events_url":"https://api.github.com/users/plamut/events{/privacy}","received_events_url":"https://api.github.com/users/plamut/received_events","type":"User","site_admin":false},"body":"By the way, where does the `paging` object come from, it still doesn't seem to be passed to the component explicitly? That makes the component more tightly coupled with its context, and may even result in bugs if e.g. somebody renames the `paging` object somehwere up the scope hierarchy.\r\n\r\nOn the other hand, if the `paging` observable is passed in explicitly via an attribute in the DOM, the component could easily check that on init, to make sure the observable indeed exists.","created_at":"2016-07-27T11:23:29Z","updated_at":"2016-07-27T11:23:29Z","html_url":"https://github.com/google/ggrc-core/pull/4197#discussion_r72422447","pull_request_url":"https://api.github.com/repos/google/ggrc-core/pulls/4197","_links":{"self":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/comments/72422447"},"html":{"href":"https://github.com/google/ggrc-core/pull/4197#discussion_r72422447"},"pull_request":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/4197"}}},"pull_request":{"url":"https://api.github.com/repos/google/ggrc-core/pulls/4197","id":78452571,"html_url":"https://github.com/google/ggrc-core/pull/4197","diff_url":"https://github.com/google/ggrc-core/pull/4197.diff","patch_url":"https://github.com/google/ggrc-core/pull/4197.patch","issue_url":"https://api.github.com/repos/google/ggrc-core/issues/4197","number":4197,"state":"open","locked":false,"title":"FEATURE Pagination widget","user":{"login":"j0gurt","id":1145017,"avatar_url":"https://avatars.githubusercontent.com/u/1145017?v=3","gravatar_id":"","url":"https://api.github.com/users/j0gurt","html_url":"https://github.com/j0gurt","followers_url":"https://api.github.com/users/j0gurt/followers","following_url":"https://api.github.com/users/j0gurt/following{/other_user}","gists_url":"https://api.github.com/users/j0gurt/gists{/gist_id}","starred_url":"https://api.github.com/users/j0gurt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j0gurt/subscriptions","organizations_url":"https://api.github.com/users/j0gurt/orgs","repos_url":"https://api.github.com/users/j0gurt/repos","events_url":"https://api.github.com/users/j0gurt/events{/privacy}","received_events_url":"https://api.github.com/users/j0gurt/received_events","type":"User","site_admin":false},"body":"Add pagination widget for future pagination functionality","created_at":"2016-07-22T09:57:04Z","updated_at":"2016-07-27T11:23:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2d3d6c856f1be6cc08afdcac26890d3344c7d3f5","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/google/ggrc-core/milestones/21","html_url":"https://github.com/google/ggrc-core/milestones/0.9.7-Quince","labels_url":"https://api.github.com/repos/google/ggrc-core/milestones/21/labels","id":1845906,"number":21,"title":"0.9.7-Quince","description":"","creator":{"login":"Smotko","id":513444,"avatar_url":"https://avatars.githubusercontent.com/u/513444?v=3","gravatar_id":"","url":"https://api.github.com/users/Smotko","html_url":"https://github.com/Smotko","followers_url":"https://api.github.com/users/Smotko/followers","following_url":"https://api.github.com/users/Smotko/following{/other_user}","gists_url":"https://api.github.com/users/Smotko/gists{/gist_id}","starred_url":"https://api.github.com/users/Smotko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Smotko/subscriptions","organizations_url":"https://api.github.com/users/Smotko/orgs","repos_url":"https://api.github.com/users/Smotko/repos","events_url":"https://api.github.com/users/Smotko/events{/privacy}","received_events_url":"https://api.github.com/users/Smotko/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":144,"state":"open","created_at":"2016-06-23T17:56:25Z","updated_at":"2016-07-27T06:35:01Z","due_on":"2016-08-14T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/google/ggrc-core/pulls/4197/commits","review_comments_url":"https://api.github.com/repos/google/ggrc-core/pulls/4197/comments","review_comment_url":"https://api.github.com/repos/google/ggrc-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/ggrc-core/issues/4197/comments","statuses_url":"https://api.github.com/repos/google/ggrc-core/statuses/60058abff02f8695ca16f5e1ae1c9acf941f98ff","head":{"label":"j0gurt:feature-pagination-component","ref":"feature-pagination-component","sha":"60058abff02f8695ca16f5e1ae1c9acf941f98ff","user":{"login":"j0gurt","id":1145017,"avatar_url":"https://avatars.githubusercontent.com/u/1145017?v=3","gravatar_id":"","url":"https://api.github.com/users/j0gurt","html_url":"https://github.com/j0gurt","followers_url":"https://api.github.com/users/j0gurt/followers","following_url":"https://api.github.com/users/j0gurt/following{/other_user}","gists_url":"https://api.github.com/users/j0gurt/gists{/gist_id}","starred_url":"https://api.github.com/users/j0gurt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j0gurt/subscriptions","organizations_url":"https://api.github.com/users/j0gurt/orgs","repos_url":"https://api.github.com/users/j0gurt/repos","events_url":"https://api.github.com/users/j0gurt/events{/privacy}","received_events_url":"https://api.github.com/users/j0gurt/received_events","type":"User","site_admin":false},"repo":{"id":59093541,"name":"ggrc-core","full_name":"j0gurt/ggrc-core","owner":{"login":"j0gurt","id":1145017,"avatar_url":"https://avatars.githubusercontent.com/u/1145017?v=3","gravatar_id":"","url":"https://api.github.com/users/j0gurt","html_url":"https://github.com/j0gurt","followers_url":"https://api.github.com/users/j0gurt/followers","following_url":"https://api.github.com/users/j0gurt/following{/other_user}","gists_url":"https://api.github.com/users/j0gurt/gists{/gist_id}","starred_url":"https://api.github.com/users/j0gurt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j0gurt/subscriptions","organizations_url":"https://api.github.com/users/j0gurt/orgs","repos_url":"https://api.github.com/users/j0gurt/repos","events_url":"https://api.github.com/users/j0gurt/events{/privacy}","received_events_url":"https://api.github.com/users/j0gurt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/j0gurt/ggrc-core","description":"GGRC Core","fork":true,"url":"https://api.github.com/repos/j0gurt/ggrc-core","forks_url":"https://api.github.com/repos/j0gurt/ggrc-core/forks","keys_url":"https://api.github.com/repos/j0gurt/ggrc-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/j0gurt/ggrc-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/j0gurt/ggrc-core/teams","hooks_url":"https://api.github.com/repos/j0gurt/ggrc-core/hooks","issue_events_url":"https://api.github.com/repos/j0gurt/ggrc-core/issues/events{/number}","events_url":"https://api.github.com/repos/j0gurt/ggrc-core/events","assignees_url":"https://api.github.com/repos/j0gurt/ggrc-core/assignees{/user}","branches_url":"https://api.github.com/repos/j0gurt/ggrc-core/branches{/branch}","tags_url":"https://api.github.com/repos/j0gurt/ggrc-core/tags","blobs_url":"https://api.github.com/repos/j0gurt/ggrc-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/j0gurt/ggrc-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/j0gurt/ggrc-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/j0gurt/ggrc-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/j0gurt/ggrc-core/statuses/{sha}","languages_url":"https://api.github.com/repos/j0gurt/ggrc-core/languages","stargazers_url":"https://api.github.com/repos/j0gurt/ggrc-core/stargazers","contributors_url":"https://api.github.com/repos/j0gurt/ggrc-core/contributors","subscribers_url":"https://api.github.com/repos/j0gurt/ggrc-core/subscribers","subscription_url":"https://api.github.com/repos/j0gurt/ggrc-core/subscription","commits_url":"https://api.github.com/repos/j0gurt/ggrc-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/j0gurt/ggrc-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/j0gurt/ggrc-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/j0gurt/ggrc-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/j0gurt/ggrc-core/contents/{+path}","compare_url":"https://api.github.com/repos/j0gurt/ggrc-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/j0gurt/ggrc-core/merges","archive_url":"https://api.github.com/repos/j0gurt/ggrc-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/j0gurt/ggrc-core/downloads","issues_url":"https://api.github.com/repos/j0gurt/ggrc-core/issues{/number}","pulls_url":"https://api.github.com/repos/j0gurt/ggrc-core/pulls{/number}","milestones_url":"https://api.github.com/repos/j0gurt/ggrc-core/milestones{/number}","notifications_url":"https://api.github.com/repos/j0gurt/ggrc-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/j0gurt/ggrc-core/labels{/name}","releases_url":"https://api.github.com/repos/j0gurt/ggrc-core/releases{/id}","deployments_url":"https://api.github.com/repos/j0gurt/ggrc-core/deployments","created_at":"2016-05-18T07:46:20Z","updated_at":"2016-05-23T08:41:47Z","pushed_at":"2016-07-27T08:58:59Z","git_url":"git://github.com/j0gurt/ggrc-core.git","ssh_url":"git@github.com:j0gurt/ggrc-core.git","clone_url":"https://github.com/j0gurt/ggrc-core.git","svn_url":"https://github.com/j0gurt/ggrc-core","homepage":null,"size":53401,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"develop"}},"base":{"label":"google:develop","ref":"develop","sha":"7818703c6ba3379402ebd54f17b2551527607a24","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":9304637,"name":"ggrc-core","full_name":"google/ggrc-core","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/ggrc-core","description":"GGRC Core","fork":false,"url":"https://api.github.com/repos/google/ggrc-core","forks_url":"https://api.github.com/repos/google/ggrc-core/forks","keys_url":"https://api.github.com/repos/google/ggrc-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/ggrc-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/ggrc-core/teams","hooks_url":"https://api.github.com/repos/google/ggrc-core/hooks","issue_events_url":"https://api.github.com/repos/google/ggrc-core/issues/events{/number}","events_url":"https://api.github.com/repos/google/ggrc-core/events","assignees_url":"https://api.github.com/repos/google/ggrc-core/assignees{/user}","branches_url":"https://api.github.com/repos/google/ggrc-core/branches{/branch}","tags_url":"https://api.github.com/repos/google/ggrc-core/tags","blobs_url":"https://api.github.com/repos/google/ggrc-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/ggrc-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/ggrc-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/ggrc-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/ggrc-core/statuses/{sha}","languages_url":"https://api.github.com/repos/google/ggrc-core/languages","stargazers_url":"https://api.github.com/repos/google/ggrc-core/stargazers","contributors_url":"https://api.github.com/repos/google/ggrc-core/contributors","subscribers_url":"https://api.github.com/repos/google/ggrc-core/subscribers","subscription_url":"https://api.github.com/repos/google/ggrc-core/subscription","commits_url":"https://api.github.com/repos/google/ggrc-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/ggrc-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/ggrc-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/ggrc-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/ggrc-core/contents/{+path}","compare_url":"https://api.github.com/repos/google/ggrc-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/ggrc-core/merges","archive_url":"https://api.github.com/repos/google/ggrc-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/ggrc-core/downloads","issues_url":"https://api.github.com/repos/google/ggrc-core/issues{/number}","pulls_url":"https://api.github.com/repos/google/ggrc-core/pulls{/number}","milestones_url":"https://api.github.com/repos/google/ggrc-core/milestones{/number}","notifications_url":"https://api.github.com/repos/google/ggrc-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/ggrc-core/labels{/name}","releases_url":"https://api.github.com/repos/google/ggrc-core/releases{/id}","deployments_url":"https://api.github.com/repos/google/ggrc-core/deployments","created_at":"2013-04-08T19:16:28Z","updated_at":"2016-07-16T18:01:38Z","pushed_at":"2016-07-27T11:23:09Z","git_url":"git://github.com/google/ggrc-core.git","ssh_url":"git@github.com:google/ggrc-core.git","clone_url":"https://github.com/google/ggrc-core.git","svn_url":"https://github.com/google/ggrc-core","homepage":null,"size":64117,"stargazers_count":113,"watchers_count":113,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":86,"mirror_url":null,"open_issues_count":12,"forks":86,"open_issues":12,"watchers":113,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/4197"},"html":{"href":"https://github.com/google/ggrc-core/pull/4197"},"issue":{"href":"https://api.github.com/repos/google/ggrc-core/issues/4197"},"comments":{"href":"https://api.github.com/repos/google/ggrc-core/issues/4197/comments"},"review_comments":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/4197/comments"},"review_comment":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/4197/commits"},"statuses":{"href":"https://api.github.com/repos/google/ggrc-core/statuses/60058abff02f8695ca16f5e1ae1c9acf941f98ff"}}}}
{"actor":{"display_login":"plamut"}}