{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls/comments/43907260","id":43907260,"diff_hunk":"@@ -0,0 +1,258 @@\n+/**\n+ * A generic paging collection for use with a ListView and PagingFooter.\n+ *\n+ * By default this collection is designed to work with Django Rest Framework APIs, but can be configured to work with\n+ * others. There is support for ascending or descending sort on a particular field, as well as filtering on a field.\n+ * While the backend API may use either zero or one indexed page numbers, this collection uniformly exposes a one\n+ * indexed interface to make consumption easier for views.\n+ *\n+ * Subclasses may want to override the following properties:\n+ *      - url (string): The base url for the API endpoint.\n+ *      - isZeroIndexed (boolean): If true, API calls will use page numbers starting at zero. Defaults to false.\n+ *      - perPage (number): Count of elements to fetch for each page.\n+ *      - queryParams (object): Query parameters for the API call. Subclasses may add entries as necessary. By default,\n+ *          a 'sort_order' field is included to specify the field to sort on. This field may be removed for subclasses\n+ *          that do not support sort ordering, or support it in a non-standard way. By default filterField and\n+ *          sortDirection do not affect the API calls. It is up to subclasses to add this information to the appropriate\n+ *          query string parameters in server_api.\n+ */\n+;(function (define) {\n+    'use strict';\n+    define(['backbone.paginator'], function (PageableCollection) {\n+        var PagingCollection = PageableCollection.extend({\n+            initialize: function () {\n+                // These must be initialized in the constructor because otherwise all PagingCollections would point\n+                // to the same object references for sortableFields and filterableFields.\n+                this.sortableFields = {};\n+                this.filterableFields = {};\n+            },\n+\n+            isZeroIndexed: false,\n+            perPage: 10,\n+            mode: 'server',\n+\n+            isStale: false,\n+\n+            sortField: '',\n+            sortDirection: 'descending',\n+            sortableFields: {},\n+\n+            filterField: '',\n+            filterableFields: {},\n+\n+            searchString: null,\n+\n+            state: {\n+                firstPage: function () { return this.isZeroIndexed ? 0 : 1; },\n+                // Specifies the initial page during collection initialization\n+                currentPage: function () { return this.isZeroIndexed ? 0 : 1; },\n+                perPage: function () { return this.perPage; }\n+            },\n+\n+            queryParams: {\n+                page: function () { return this.currentPage; },","path":"components/pagination/collections/paging_collection.js","position":null,"original_position":53,"commit_id":"af48d85e74b0a0475e30e11536b3bacfc1dbd238","original_commit_id":"a95b4b81c90ea9596b5c2fc94cc9b022f3f1378c","user":{"login":"dan-f","id":2146312,"avatar_url":"https://avatars.githubusercontent.com/u/2146312?v=3","gravatar_id":"","url":"https://api.github.com/users/dan-f","html_url":"https://github.com/dan-f","followers_url":"https://api.github.com/users/dan-f/followers","following_url":"https://api.github.com/users/dan-f/following{/other_user}","gists_url":"https://api.github.com/users/dan-f/gists{/gist_id}","starred_url":"https://api.github.com/users/dan-f/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dan-f/subscriptions","organizations_url":"https://api.github.com/users/dan-f/orgs","repos_url":"https://api.github.com/users/dan-f/repos","events_url":"https://api.github.com/users/dan-f/events{/privacy}","received_events_url":"https://api.github.com/users/dan-f/received_events","type":"User","site_admin":false},"body":"ugh\r\n\r\n![facepalm](https://media.giphy.com/media/oV4DOTSXRhRMA/giphy.gif)","created_at":"2015-11-04T17:00:00Z","updated_at":"2015-11-04T17:00:00Z","html_url":"https://github.com/edx/edx-ui-toolkit/pull/2#discussion_r43907260","pull_request_url":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls/comments/43907260"},"html":{"href":"https://github.com/edx/edx-ui-toolkit/pull/2#discussion_r43907260"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls/2","id":45344750,"html_url":"https://github.com/edx/edx-ui-toolkit/pull/2","diff_url":"https://github.com/edx/edx-ui-toolkit/pull/2.diff","patch_url":"https://github.com/edx/edx-ui-toolkit/pull/2.patch","issue_url":"https://api.github.com/repos/edx/edx-ui-toolkit/issues/2","number":2,"state":"open","locked":false,"title":"[WIP] Introduce pagination components","user":{"login":"andy-armstrong","id":5985072,"avatar_url":"https://avatars.githubusercontent.com/u/5985072?v=3","gravatar_id":"","url":"https://api.github.com/users/andy-armstrong","html_url":"https://github.com/andy-armstrong","followers_url":"https://api.github.com/users/andy-armstrong/followers","following_url":"https://api.github.com/users/andy-armstrong/following{/other_user}","gists_url":"https://api.github.com/users/andy-armstrong/gists{/gist_id}","starred_url":"https://api.github.com/users/andy-armstrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy-armstrong/subscriptions","organizations_url":"https://api.github.com/users/andy-armstrong/orgs","repos_url":"https://api.github.com/users/andy-armstrong/repos","events_url":"https://api.github.com/users/andy-armstrong/events{/privacy}","received_events_url":"https://api.github.com/users/andy-armstrong/received_events","type":"User","site_admin":false},"body":"https://openedx.atlassian.net/projects/UITK/issues/UITK-1\r\n\r\nThis is my first attempt at bringing the edx-platform's pagination components into the UI Toolkit.\r\n\r\nFYI @dsjen @AlasdairSwan @talbs","created_at":"2015-09-17T21:33:12Z","updated_at":"2015-11-04T17:00:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e92d33a781333b112fd832f3d649e2e8a1972e4e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls/2/commits","review_comments_url":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls/2/comments","review_comment_url":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-ui-toolkit/issues/2/comments","statuses_url":"https://api.github.com/repos/edx/edx-ui-toolkit/statuses/af48d85e74b0a0475e30e11536b3bacfc1dbd238","head":{"label":"edx:andya/add-pagination-components","ref":"andya/add-pagination-components","sha":"af48d85e74b0a0475e30e11536b3bacfc1dbd238","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":40644985,"name":"edx-ui-toolkit","full_name":"edx/edx-ui-toolkit","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-ui-toolkit","description":"","fork":false,"url":"https://api.github.com/repos/edx/edx-ui-toolkit","forks_url":"https://api.github.com/repos/edx/edx-ui-toolkit/forks","keys_url":"https://api.github.com/repos/edx/edx-ui-toolkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-ui-toolkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-ui-toolkit/teams","hooks_url":"https://api.github.com/repos/edx/edx-ui-toolkit/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-ui-toolkit/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-ui-toolkit/events","assignees_url":"https://api.github.com/repos/edx/edx-ui-toolkit/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-ui-toolkit/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-ui-toolkit/tags","blobs_url":"https://api.github.com/repos/edx/edx-ui-toolkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-ui-toolkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-ui-toolkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-ui-toolkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-ui-toolkit/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-ui-toolkit/languages","stargazers_url":"https://api.github.com/repos/edx/edx-ui-toolkit/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-ui-toolkit/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-ui-toolkit/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-ui-toolkit/subscription","commits_url":"https://api.github.com/repos/edx/edx-ui-toolkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-ui-toolkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-ui-toolkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-ui-toolkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-ui-toolkit/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-ui-toolkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-ui-toolkit/merges","archive_url":"https://api.github.com/repos/edx/edx-ui-toolkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-ui-toolkit/downloads","issues_url":"https://api.github.com/repos/edx/edx-ui-toolkit/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-ui-toolkit/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-ui-toolkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-ui-toolkit/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-ui-toolkit/releases{/id}","created_at":"2015-08-13T07:28:13Z","updated_at":"2015-09-17T18:38:49Z","pushed_at":"2015-11-03T19:50:35Z","git_url":"git://github.com/edx/edx-ui-toolkit.git","ssh_url":"git@github.com:edx/edx-ui-toolkit.git","clone_url":"https://github.com/edx/edx-ui-toolkit.git","svn_url":"https://github.com/edx/edx-ui-toolkit","homepage":null,"size":492,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":4,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"f3e10411b6a55abb5c142b1fe84f8a295ab2e71f","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":40644985,"name":"edx-ui-toolkit","full_name":"edx/edx-ui-toolkit","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-ui-toolkit","description":"","fork":false,"url":"https://api.github.com/repos/edx/edx-ui-toolkit","forks_url":"https://api.github.com/repos/edx/edx-ui-toolkit/forks","keys_url":"https://api.github.com/repos/edx/edx-ui-toolkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-ui-toolkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-ui-toolkit/teams","hooks_url":"https://api.github.com/repos/edx/edx-ui-toolkit/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-ui-toolkit/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-ui-toolkit/events","assignees_url":"https://api.github.com/repos/edx/edx-ui-toolkit/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-ui-toolkit/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-ui-toolkit/tags","blobs_url":"https://api.github.com/repos/edx/edx-ui-toolkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-ui-toolkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-ui-toolkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-ui-toolkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-ui-toolkit/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-ui-toolkit/languages","stargazers_url":"https://api.github.com/repos/edx/edx-ui-toolkit/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-ui-toolkit/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-ui-toolkit/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-ui-toolkit/subscription","commits_url":"https://api.github.com/repos/edx/edx-ui-toolkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-ui-toolkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-ui-toolkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-ui-toolkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-ui-toolkit/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-ui-toolkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-ui-toolkit/merges","archive_url":"https://api.github.com/repos/edx/edx-ui-toolkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-ui-toolkit/downloads","issues_url":"https://api.github.com/repos/edx/edx-ui-toolkit/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-ui-toolkit/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-ui-toolkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-ui-toolkit/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-ui-toolkit/releases{/id}","created_at":"2015-08-13T07:28:13Z","updated_at":"2015-09-17T18:38:49Z","pushed_at":"2015-11-03T19:50:35Z","git_url":"git://github.com/edx/edx-ui-toolkit.git","ssh_url":"git@github.com:edx/edx-ui-toolkit.git","clone_url":"https://github.com/edx/edx-ui-toolkit.git","svn_url":"https://github.com/edx/edx-ui-toolkit","homepage":null,"size":492,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls/2"},"html":{"href":"https://github.com/edx/edx-ui-toolkit/pull/2"},"issue":{"href":"https://api.github.com/repos/edx/edx-ui-toolkit/issues/2"},"comments":{"href":"https://api.github.com/repos/edx/edx-ui-toolkit/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-ui-toolkit/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-ui-toolkit/statuses/af48d85e74b0a0475e30e11536b3bacfc1dbd238"}}}}