{"action":"created","comment":{"url":"https://api.github.com/repos/activeadmin/activeadmin/pulls/comments/37830946","id":37830946,"diff_hunk":"@@ -42,5 +42,86 @@\n         end\n       end\n     end\n+\n+    context 'when creating an index column' do\n+      let(:base_collection) do\n+        posts = [\n+          Post.new(title: 'First Post', starred: true),\n+          Post.new(title: 'Second Post', starred: true),\n+          Post.new(title: 'Third Post', starred: true),\n+          Post.new(title: 'Fourth Post', starred: true)\n+        ]\n+        Kaminari.paginate_array(posts, limit: 2)\n+      end\n+      let(:collection) do\n+        base_collection.page(1)\n+      end\n+\n+      let(:table) do\n+        render_arbre_component assigns, helpers do\n+          insert_tag(ActiveAdmin::Views::IndexAsTable::IndexTableFor, collection, {sortable: true}) do\n+            index_column\n+          end\n+        end\n+      end\n+\n+      context 'creates a table header based on the index column' do\n+        let(:header) do\n+          table.find_by_tag('th').first\n+        end\n+\n+        it 'with index column class name' do\n+          expect(header.attributes[:class]).to include 'col-index'\n+        end\n+\n+        it 'not sortable' do\n+          expect(header.attributes[:class]).not_to include 'sortable'\n+        end\n+      end\n+\n+      context 'verifying the indices for the rows' do\n+        let(:index_values) do\n+          table.find_by_tag('tr').map do |row|\n+            next unless row.find_by_tag('td').first\n+            row.find_by_tag('td').first.content\n+          end.compact\n+        end\n+\n+        context 'viewing the first page' do\n+          it 'shows the correct indices' do\n+            expect(index_values).to eq(['1', '2'])\n+          end\n+        end\n+        context 'viewing the second page' do\n+          let(:collection) do\n+            base_collection.page(2)\n+          end\n+          it 'shows the correct indices' do\n+            expect(index_values).to eq(['3', '4'])\n+          end\n+        end\n+      end\n+\n+      context 'allows for zero-based indices' do\n+        let(:table) do\n+          render_arbre_component assigns, helpers do\n+            insert_tag(ActiveAdmin::Views::IndexAsTable::IndexTableFor, collection, {sortable: true}) do\n+              index_column(0)\n+            end\n+          end\n+        end\n+\n+        let(:index_values) do\n+          table.find_by_tag('tr').map do |row|\n+            next unless row.find_by_tag('td').first","path":"spec/unit/views/components/index_table_for_spec.rb","position":75,"original_position":75,"commit_id":"8a35d8e60500597cfc7167c6b60e1d489b28dd75","original_commit_id":"8a35d8e60500597cfc7167c6b60e1d489b28dd75","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.","created_at":"2015-08-25T04:04:30Z","updated_at":"2015-08-25T04:04:30Z","html_url":"https://github.com/activeadmin/activeadmin/pull/4093#discussion_r37830946","pull_request_url":"https://api.github.com/repos/activeadmin/activeadmin/pulls/4093","_links":{"self":{"href":"https://api.github.com/repos/activeadmin/activeadmin/pulls/comments/37830946"},"html":{"href":"https://github.com/activeadmin/activeadmin/pull/4093#discussion_r37830946"},"pull_request":{"href":"https://api.github.com/repos/activeadmin/activeadmin/pulls/4093"}}},"pull_request":{"url":"https://api.github.com/repos/activeadmin/activeadmin/pulls/4093","id":43130486,"html_url":"https://github.com/activeadmin/activeadmin/pull/4093","diff_url":"https://github.com/activeadmin/activeadmin/pull/4093.diff","patch_url":"https://github.com/activeadmin/activeadmin/pull/4093.patch","issue_url":"https://api.github.com/repos/activeadmin/activeadmin/issues/4093","number":4093,"state":"open","locked":false,"title":"Added index_column to display the position of the row in the total collection.","user":{"login":"cadetstar","id":247453,"avatar_url":"https://avatars.githubusercontent.com/u/247453?v=3","gravatar_id":"","url":"https://api.github.com/users/cadetstar","html_url":"https://github.com/cadetstar","followers_url":"https://api.github.com/users/cadetstar/followers","following_url":"https://api.github.com/users/cadetstar/following{/other_user}","gists_url":"https://api.github.com/users/cadetstar/gists{/gist_id}","starred_url":"https://api.github.com/users/cadetstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cadetstar/subscriptions","organizations_url":"https://api.github.com/users/cadetstar/orgs","repos_url":"https://api.github.com/users/cadetstar/repos","events_url":"https://api.github.com/users/cadetstar/events{/privacy}","received_events_url":"https://api.github.com/users/cadetstar/received_events","type":"User","site_admin":false},"body":"This is a proposed solution to fulfill the Feature Request activeadmin/activeadmin#3693\r\n\r\nIt only extends IndexAsTable for now, but could be built upon to do the same in other index styles.","created_at":"2015-08-23T22:57:30Z","updated_at":"2015-08-25T04:04:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"98e8b50d1337bc5ac038c5210a08ee73b1238031","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/activeadmin/activeadmin/pulls/4093/commits","review_comments_url":"https://api.github.com/repos/activeadmin/activeadmin/pulls/4093/comments","review_comment_url":"https://api.github.com/repos/activeadmin/activeadmin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/activeadmin/activeadmin/issues/4093/comments","statuses_url":"https://api.github.com/repos/activeadmin/activeadmin/statuses/8a35d8e60500597cfc7167c6b60e1d489b28dd75","head":{"label":"cadetstar:3693-add-item-numbering-to-tables","ref":"3693-add-item-numbering-to-tables","sha":"8a35d8e60500597cfc7167c6b60e1d489b28dd75","user":{"login":"cadetstar","id":247453,"avatar_url":"https://avatars.githubusercontent.com/u/247453?v=3","gravatar_id":"","url":"https://api.github.com/users/cadetstar","html_url":"https://github.com/cadetstar","followers_url":"https://api.github.com/users/cadetstar/followers","following_url":"https://api.github.com/users/cadetstar/following{/other_user}","gists_url":"https://api.github.com/users/cadetstar/gists{/gist_id}","starred_url":"https://api.github.com/users/cadetstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cadetstar/subscriptions","organizations_url":"https://api.github.com/users/cadetstar/orgs","repos_url":"https://api.github.com/users/cadetstar/repos","events_url":"https://api.github.com/users/cadetstar/events{/privacy}","received_events_url":"https://api.github.com/users/cadetstar/received_events","type":"User","site_admin":false},"repo":{"id":40948114,"name":"activeadmin","full_name":"cadetstar/activeadmin","owner":{"login":"cadetstar","id":247453,"avatar_url":"https://avatars.githubusercontent.com/u/247453?v=3","gravatar_id":"","url":"https://api.github.com/users/cadetstar","html_url":"https://github.com/cadetstar","followers_url":"https://api.github.com/users/cadetstar/followers","following_url":"https://api.github.com/users/cadetstar/following{/other_user}","gists_url":"https://api.github.com/users/cadetstar/gists{/gist_id}","starred_url":"https://api.github.com/users/cadetstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cadetstar/subscriptions","organizations_url":"https://api.github.com/users/cadetstar/orgs","repos_url":"https://api.github.com/users/cadetstar/repos","events_url":"https://api.github.com/users/cadetstar/events{/privacy}","received_events_url":"https://api.github.com/users/cadetstar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cadetstar/activeadmin","description":"The administration framework for Ruby on Rails applications.","fork":true,"url":"https://api.github.com/repos/cadetstar/activeadmin","forks_url":"https://api.github.com/repos/cadetstar/activeadmin/forks","keys_url":"https://api.github.com/repos/cadetstar/activeadmin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cadetstar/activeadmin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cadetstar/activeadmin/teams","hooks_url":"https://api.github.com/repos/cadetstar/activeadmin/hooks","issue_events_url":"https://api.github.com/repos/cadetstar/activeadmin/issues/events{/number}","events_url":"https://api.github.com/repos/cadetstar/activeadmin/events","assignees_url":"https://api.github.com/repos/cadetstar/activeadmin/assignees{/user}","branches_url":"https://api.github.com/repos/cadetstar/activeadmin/branches{/branch}","tags_url":"https://api.github.com/repos/cadetstar/activeadmin/tags","blobs_url":"https://api.github.com/repos/cadetstar/activeadmin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cadetstar/activeadmin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cadetstar/activeadmin/git/refs{/sha}","trees_url":"https://api.github.com/repos/cadetstar/activeadmin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cadetstar/activeadmin/statuses/{sha}","languages_url":"https://api.github.com/repos/cadetstar/activeadmin/languages","stargazers_url":"https://api.github.com/repos/cadetstar/activeadmin/stargazers","contributors_url":"https://api.github.com/repos/cadetstar/activeadmin/contributors","subscribers_url":"https://api.github.com/repos/cadetstar/activeadmin/subscribers","subscription_url":"https://api.github.com/repos/cadetstar/activeadmin/subscription","commits_url":"https://api.github.com/repos/cadetstar/activeadmin/commits{/sha}","git_commits_url":"https://api.github.com/repos/cadetstar/activeadmin/git/commits{/sha}","comments_url":"https://api.github.com/repos/cadetstar/activeadmin/comments{/number}","issue_comment_url":"https://api.github.com/repos/cadetstar/activeadmin/issues/comments{/number}","contents_url":"https://api.github.com/repos/cadetstar/activeadmin/contents/{+path}","compare_url":"https://api.github.com/repos/cadetstar/activeadmin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cadetstar/activeadmin/merges","archive_url":"https://api.github.com/repos/cadetstar/activeadmin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cadetstar/activeadmin/downloads","issues_url":"https://api.github.com/repos/cadetstar/activeadmin/issues{/number}","pulls_url":"https://api.github.com/repos/cadetstar/activeadmin/pulls{/number}","milestones_url":"https://api.github.com/repos/cadetstar/activeadmin/milestones{/number}","notifications_url":"https://api.github.com/repos/cadetstar/activeadmin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cadetstar/activeadmin/labels{/name}","releases_url":"https://api.github.com/repos/cadetstar/activeadmin/releases{/id}","created_at":"2015-08-18T03:14:35Z","updated_at":"2015-08-18T03:14:37Z","pushed_at":"2015-08-25T04:04:20Z","git_url":"git://github.com/cadetstar/activeadmin.git","ssh_url":"git@github.com:cadetstar/activeadmin.git","clone_url":"https://github.com/cadetstar/activeadmin.git","svn_url":"https://github.com/cadetstar/activeadmin","homepage":"activeadmin.info","size":7333,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":false,"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":"master"}},"base":{"label":"activeadmin:master","ref":"master","sha":"d44c1b8a57cc893f0b3dae6a7e6cb5c9bc09be29","user":{"login":"activeadmin","id":814570,"avatar_url":"https://avatars.githubusercontent.com/u/814570?v=3","gravatar_id":"","url":"https://api.github.com/users/activeadmin","html_url":"https://github.com/activeadmin","followers_url":"https://api.github.com/users/activeadmin/followers","following_url":"https://api.github.com/users/activeadmin/following{/other_user}","gists_url":"https://api.github.com/users/activeadmin/gists{/gist_id}","starred_url":"https://api.github.com/users/activeadmin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/activeadmin/subscriptions","organizations_url":"https://api.github.com/users/activeadmin/orgs","repos_url":"https://api.github.com/users/activeadmin/repos","events_url":"https://api.github.com/users/activeadmin/events{/privacy}","received_events_url":"https://api.github.com/users/activeadmin/received_events","type":"Organization","site_admin":false},"repo":{"id":611921,"name":"activeadmin","full_name":"activeadmin/activeadmin","owner":{"login":"activeadmin","id":814570,"avatar_url":"https://avatars.githubusercontent.com/u/814570?v=3","gravatar_id":"","url":"https://api.github.com/users/activeadmin","html_url":"https://github.com/activeadmin","followers_url":"https://api.github.com/users/activeadmin/followers","following_url":"https://api.github.com/users/activeadmin/following{/other_user}","gists_url":"https://api.github.com/users/activeadmin/gists{/gist_id}","starred_url":"https://api.github.com/users/activeadmin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/activeadmin/subscriptions","organizations_url":"https://api.github.com/users/activeadmin/orgs","repos_url":"https://api.github.com/users/activeadmin/repos","events_url":"https://api.github.com/users/activeadmin/events{/privacy}","received_events_url":"https://api.github.com/users/activeadmin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/activeadmin/activeadmin","description":"The administration framework for Ruby on Rails applications.","fork":false,"url":"https://api.github.com/repos/activeadmin/activeadmin","forks_url":"https://api.github.com/repos/activeadmin/activeadmin/forks","keys_url":"https://api.github.com/repos/activeadmin/activeadmin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/activeadmin/activeadmin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/activeadmin/activeadmin/teams","hooks_url":"https://api.github.com/repos/activeadmin/activeadmin/hooks","issue_events_url":"https://api.github.com/repos/activeadmin/activeadmin/issues/events{/number}","events_url":"https://api.github.com/repos/activeadmin/activeadmin/events","assignees_url":"https://api.github.com/repos/activeadmin/activeadmin/assignees{/user}","branches_url":"https://api.github.com/repos/activeadmin/activeadmin/branches{/branch}","tags_url":"https://api.github.com/repos/activeadmin/activeadmin/tags","blobs_url":"https://api.github.com/repos/activeadmin/activeadmin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/activeadmin/activeadmin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/activeadmin/activeadmin/git/refs{/sha}","trees_url":"https://api.github.com/repos/activeadmin/activeadmin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/activeadmin/activeadmin/statuses/{sha}","languages_url":"https://api.github.com/repos/activeadmin/activeadmin/languages","stargazers_url":"https://api.github.com/repos/activeadmin/activeadmin/stargazers","contributors_url":"https://api.github.com/repos/activeadmin/activeadmin/contributors","subscribers_url":"https://api.github.com/repos/activeadmin/activeadmin/subscribers","subscription_url":"https://api.github.com/repos/activeadmin/activeadmin/subscription","commits_url":"https://api.github.com/repos/activeadmin/activeadmin/commits{/sha}","git_commits_url":"https://api.github.com/repos/activeadmin/activeadmin/git/commits{/sha}","comments_url":"https://api.github.com/repos/activeadmin/activeadmin/comments{/number}","issue_comment_url":"https://api.github.com/repos/activeadmin/activeadmin/issues/comments{/number}","contents_url":"https://api.github.com/repos/activeadmin/activeadmin/contents/{+path}","compare_url":"https://api.github.com/repos/activeadmin/activeadmin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/activeadmin/activeadmin/merges","archive_url":"https://api.github.com/repos/activeadmin/activeadmin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/activeadmin/activeadmin/downloads","issues_url":"https://api.github.com/repos/activeadmin/activeadmin/issues{/number}","pulls_url":"https://api.github.com/repos/activeadmin/activeadmin/pulls{/number}","milestones_url":"https://api.github.com/repos/activeadmin/activeadmin/milestones{/number}","notifications_url":"https://api.github.com/repos/activeadmin/activeadmin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/activeadmin/activeadmin/labels{/name}","releases_url":"https://api.github.com/repos/activeadmin/activeadmin/releases{/id}","created_at":"2010-04-15T14:26:03Z","updated_at":"2015-08-24T23:28:49Z","pushed_at":"2015-08-25T04:04:24Z","git_url":"git://github.com/activeadmin/activeadmin.git","ssh_url":"git@github.com:activeadmin/activeadmin.git","clone_url":"https://github.com/activeadmin/activeadmin.git","svn_url":"https://github.com/activeadmin/activeadmin","homepage":"activeadmin.info","size":19295,"stargazers_count":6144,"watchers_count":6144,"language":"Ruby","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":2185,"mirror_url":null,"open_issues_count":212,"forks":2185,"open_issues":212,"watchers":6144,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/activeadmin/activeadmin/pulls/4093"},"html":{"href":"https://github.com/activeadmin/activeadmin/pull/4093"},"issue":{"href":"https://api.github.com/repos/activeadmin/activeadmin/issues/4093"},"comments":{"href":"https://api.github.com/repos/activeadmin/activeadmin/issues/4093/comments"},"review_comments":{"href":"https://api.github.com/repos/activeadmin/activeadmin/pulls/4093/comments"},"review_comment":{"href":"https://api.github.com/repos/activeadmin/activeadmin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/activeadmin/activeadmin/pulls/4093/commits"},"statuses":{"href":"https://api.github.com/repos/activeadmin/activeadmin/statuses/8a35d8e60500597cfc7167c6b60e1d489b28dd75"}}}}