{"action":"created","comment":{"url":"https://api.github.com/repos/biosistemika/scinote-web/pulls/comments/89777333","pull_request_review_id":10311611,"id":89777333,"diff_hunk":"@@ -763,4 +754,87 @@ function changeToEditMode() {\n \n     // Table specific stuff\n     table.button(0).enable(false);\n-}\n\\ No newline at end of file\n+}\n+\n+(function(table) {\n+  'use strict';\n+\n+  var dropdownBtn = $('#samples-columns-dropdown');\n+  var dropdownList = $('#samples-columns-list');\n+\n+  // removes button created by dataTables\n+  function removeDefaultButton() {\n+    $('#datatables-buttons')\n+      .find('.dt-buttons')\n+      .remove();\n+  }\n+  // loads the columns names in the dropdown list\n+  function loadColumnsNames() {\n+    _.each(table.columns().header() , function(el, index) {\n+      if( index > 1 ) {\n+        var colIndex = $(el).attr('data-column-index');\n+        var visible = table.column(colIndex).visible();\n+        var visClass= (visible) ? 'glyphicon-eye-open' : 'glyphicon-eye-close';\n+        var visLi = (visible) ? '' : 'col-invisible';\n+        var html = '<li data-position=\"' + colIndex + '\" class=\"' + visLi +\n+                   '\"><i class=\"grippy\"></i> <span class=\"text\">' +\n+                   el.innerText + '</span> <span class=\"pull-right controls\">' +\n+                   '<span class=\"vis glyphicon ' + visClass + '\"></span> '+\n+                   '<span class=\"edit glyphicon glyphicon-pencil\"></span> ' +\n+                   '<span class=\"del glyphicon glyphicon-trash\"></span>' +\n+                   '</span></li>';\n+        dropdownList.append(html)\n+      }\n+    });\n+\n+    // toggles grip img\n+    customLiHoverEffect();\n+  }\n+\n+  function customLiHoverEffect() {\n+    var liEl = dropdownList.find('li');\n+    liEl.mouseover(function() {\n+      $(this)\n+        .find('.grippy')\n+        .addClass('grippy-img');\n+    }).mouseout(function() {\n+      $(this)\n+        .find('.grippy')\n+        .removeClass('grippy-img');\n+    });\n+  }\n+\n+  function toggleColumnVisibility() {\n+    var lis = dropdownList.find('.vis');\n+    lis.on('click', function(event) {\n+      event.stopPropagation();\n+      var self = $(this);\n+      var li = self.closest('li');\n+      var column = table.column(li.attr('data-position'));\n+\n+      if ( column.visible() ) {\n+        self.addClass('glyphicon-eye-close');\n+        self.removeClass('glyphicon-eye-open');\n+        li.addClass('col-invisible');\n+        column.visible(false);\n+      } else {\n+        self.addClass('glyphicon-eye-open');\n+        self.removeClass('glyphicon-eye-close');\n+        li.removeClass('col-invisible');\n+        column.visible(true);\n+      }\n+    });\n+  }\n+\n+  // initialze dropdown after the table is loaded\n+  function initDropdown() {\n+    table.on('draw.dt', function() {\n+      removeDefaultButton();","path":"app/assets/javascripts/samples/sample_datatable.js","position":99,"original_position":99,"commit_id":"9d91d2ce2805f1e7d42f2cf3c032dbe499e5928b","original_commit_id":"9d91d2ce2805f1e7d42f2cf3c032dbe499e5928b","user":{"login":"okriuchykhin","id":22216856,"avatar_url":"https://avatars.githubusercontent.com/u/22216856?v=3","gravatar_id":"","url":"https://api.github.com/users/okriuchykhin","html_url":"https://github.com/okriuchykhin","followers_url":"https://api.github.com/users/okriuchykhin/followers","following_url":"https://api.github.com/users/okriuchykhin/following{/other_user}","gists_url":"https://api.github.com/users/okriuchykhin/gists{/gist_id}","starred_url":"https://api.github.com/users/okriuchykhin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okriuchykhin/subscriptions","organizations_url":"https://api.github.com/users/okriuchykhin/orgs","repos_url":"https://api.github.com/users/okriuchykhin/repos","events_url":"https://api.github.com/users/okriuchykhin/events{/privacy}","received_events_url":"https://api.github.com/users/okriuchykhin/received_events","type":"User","site_admin":false},"body":"We can just remove default buttons from table definition, so we don't need to remove them lately","created_at":"2016-11-28T13:09:51Z","updated_at":"2016-11-28T13:09:51Z","html_url":"https://github.com/biosistemika/scinote-web/pull/320#discussion_r89777333","pull_request_url":"https://api.github.com/repos/biosistemika/scinote-web/pulls/320","_links":{"self":{"href":"https://api.github.com/repos/biosistemika/scinote-web/pulls/comments/89777333"},"html":{"href":"https://github.com/biosistemika/scinote-web/pull/320#discussion_r89777333"},"pull_request":{"href":"https://api.github.com/repos/biosistemika/scinote-web/pulls/320"}}},"pull_request":{"url":"https://api.github.com/repos/biosistemika/scinote-web/pulls/320","id":95328557,"html_url":"https://github.com/biosistemika/scinote-web/pull/320","diff_url":"https://github.com/biosistemika/scinote-web/pull/320.diff","patch_url":"https://github.com/biosistemika/scinote-web/pull/320.patch","issue_url":"https://api.github.com/repos/biosistemika/scinote-web/issues/320","number":320,"state":"open","locked":false,"title":"adds new samples columns dropdown [fixes SCI-698]","user":{"login":"ZmagoD","id":7046787,"avatar_url":"https://avatars.githubusercontent.com/u/7046787?v=3","gravatar_id":"","url":"https://api.github.com/users/ZmagoD","html_url":"https://github.com/ZmagoD","followers_url":"https://api.github.com/users/ZmagoD/followers","following_url":"https://api.github.com/users/ZmagoD/following{/other_user}","gists_url":"https://api.github.com/users/ZmagoD/gists{/gist_id}","starred_url":"https://api.github.com/users/ZmagoD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZmagoD/subscriptions","organizations_url":"https://api.github.com/users/ZmagoD/orgs","repos_url":"https://api.github.com/users/ZmagoD/repos","events_url":"https://api.github.com/users/ZmagoD/events{/privacy}","received_events_url":"https://api.github.com/users/ZmagoD/received_events","type":"User","site_admin":false},"body":"https://biosistemika.atlassian.net/browse/SCI-698","created_at":"2016-11-25T16:34:37Z","updated_at":"2016-11-28T13:09:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3fec2ce8a6fe310689c67130a04b3e2517ffdd5c","assignee":{"login":"okriuchykhin","id":22216856,"avatar_url":"https://avatars.githubusercontent.com/u/22216856?v=3","gravatar_id":"","url":"https://api.github.com/users/okriuchykhin","html_url":"https://github.com/okriuchykhin","followers_url":"https://api.github.com/users/okriuchykhin/followers","following_url":"https://api.github.com/users/okriuchykhin/following{/other_user}","gists_url":"https://api.github.com/users/okriuchykhin/gists{/gist_id}","starred_url":"https://api.github.com/users/okriuchykhin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okriuchykhin/subscriptions","organizations_url":"https://api.github.com/users/okriuchykhin/orgs","repos_url":"https://api.github.com/users/okriuchykhin/repos","events_url":"https://api.github.com/users/okriuchykhin/events{/privacy}","received_events_url":"https://api.github.com/users/okriuchykhin/received_events","type":"User","site_admin":false},"assignees":[{"login":"okriuchykhin","id":22216856,"avatar_url":"https://avatars.githubusercontent.com/u/22216856?v=3","gravatar_id":"","url":"https://api.github.com/users/okriuchykhin","html_url":"https://github.com/okriuchykhin","followers_url":"https://api.github.com/users/okriuchykhin/followers","following_url":"https://api.github.com/users/okriuchykhin/following{/other_user}","gists_url":"https://api.github.com/users/okriuchykhin/gists{/gist_id}","starred_url":"https://api.github.com/users/okriuchykhin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okriuchykhin/subscriptions","organizations_url":"https://api.github.com/users/okriuchykhin/orgs","repos_url":"https://api.github.com/users/okriuchykhin/repos","events_url":"https://api.github.com/users/okriuchykhin/events{/privacy}","received_events_url":"https://api.github.com/users/okriuchykhin/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/biosistemika/scinote-web/pulls/320/commits","review_comments_url":"https://api.github.com/repos/biosistemika/scinote-web/pulls/320/comments","review_comment_url":"https://api.github.com/repos/biosistemika/scinote-web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/biosistemika/scinote-web/issues/320/comments","statuses_url":"https://api.github.com/repos/biosistemika/scinote-web/statuses/9d91d2ce2805f1e7d42f2cf3c032dbe499e5928b","head":{"label":"ZmagoD:zd_SCI_698","ref":"zd_SCI_698","sha":"9d91d2ce2805f1e7d42f2cf3c032dbe499e5928b","user":{"login":"ZmagoD","id":7046787,"avatar_url":"https://avatars.githubusercontent.com/u/7046787?v=3","gravatar_id":"","url":"https://api.github.com/users/ZmagoD","html_url":"https://github.com/ZmagoD","followers_url":"https://api.github.com/users/ZmagoD/followers","following_url":"https://api.github.com/users/ZmagoD/following{/other_user}","gists_url":"https://api.github.com/users/ZmagoD/gists{/gist_id}","starred_url":"https://api.github.com/users/ZmagoD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZmagoD/subscriptions","organizations_url":"https://api.github.com/users/ZmagoD/orgs","repos_url":"https://api.github.com/users/ZmagoD/repos","events_url":"https://api.github.com/users/ZmagoD/events{/privacy}","received_events_url":"https://api.github.com/users/ZmagoD/received_events","type":"User","site_admin":false},"repo":{"id":55899998,"name":"scinote-web","full_name":"ZmagoD/scinote-web","owner":{"login":"ZmagoD","id":7046787,"avatar_url":"https://avatars.githubusercontent.com/u/7046787?v=3","gravatar_id":"","url":"https://api.github.com/users/ZmagoD","html_url":"https://github.com/ZmagoD","followers_url":"https://api.github.com/users/ZmagoD/followers","following_url":"https://api.github.com/users/ZmagoD/following{/other_user}","gists_url":"https://api.github.com/users/ZmagoD/gists{/gist_id}","starred_url":"https://api.github.com/users/ZmagoD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZmagoD/subscriptions","organizations_url":"https://api.github.com/users/ZmagoD/orgs","repos_url":"https://api.github.com/users/ZmagoD/repos","events_url":"https://api.github.com/users/ZmagoD/events{/privacy}","received_events_url":"https://api.github.com/users/ZmagoD/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ZmagoD/scinote-web","description":"Open source electronic scientific notebook (ELN) that helps you manage your laboratory work and stores all your experimental data in one place.","fork":true,"url":"https://api.github.com/repos/ZmagoD/scinote-web","forks_url":"https://api.github.com/repos/ZmagoD/scinote-web/forks","keys_url":"https://api.github.com/repos/ZmagoD/scinote-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ZmagoD/scinote-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ZmagoD/scinote-web/teams","hooks_url":"https://api.github.com/repos/ZmagoD/scinote-web/hooks","issue_events_url":"https://api.github.com/repos/ZmagoD/scinote-web/issues/events{/number}","events_url":"https://api.github.com/repos/ZmagoD/scinote-web/events","assignees_url":"https://api.github.com/repos/ZmagoD/scinote-web/assignees{/user}","branches_url":"https://api.github.com/repos/ZmagoD/scinote-web/branches{/branch}","tags_url":"https://api.github.com/repos/ZmagoD/scinote-web/tags","blobs_url":"https://api.github.com/repos/ZmagoD/scinote-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ZmagoD/scinote-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ZmagoD/scinote-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/ZmagoD/scinote-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ZmagoD/scinote-web/statuses/{sha}","languages_url":"https://api.github.com/repos/ZmagoD/scinote-web/languages","stargazers_url":"https://api.github.com/repos/ZmagoD/scinote-web/stargazers","contributors_url":"https://api.github.com/repos/ZmagoD/scinote-web/contributors","subscribers_url":"https://api.github.com/repos/ZmagoD/scinote-web/subscribers","subscription_url":"https://api.github.com/repos/ZmagoD/scinote-web/subscription","commits_url":"https://api.github.com/repos/ZmagoD/scinote-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/ZmagoD/scinote-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/ZmagoD/scinote-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/ZmagoD/scinote-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/ZmagoD/scinote-web/contents/{+path}","compare_url":"https://api.github.com/repos/ZmagoD/scinote-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ZmagoD/scinote-web/merges","archive_url":"https://api.github.com/repos/ZmagoD/scinote-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ZmagoD/scinote-web/downloads","issues_url":"https://api.github.com/repos/ZmagoD/scinote-web/issues{/number}","pulls_url":"https://api.github.com/repos/ZmagoD/scinote-web/pulls{/number}","milestones_url":"https://api.github.com/repos/ZmagoD/scinote-web/milestones{/number}","notifications_url":"https://api.github.com/repos/ZmagoD/scinote-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ZmagoD/scinote-web/labels{/name}","releases_url":"https://api.github.com/repos/ZmagoD/scinote-web/releases{/id}","deployments_url":"https://api.github.com/repos/ZmagoD/scinote-web/deployments","created_at":"2016-04-10T13:19:11Z","updated_at":"2016-04-10T13:19:12Z","pushed_at":"2016-11-25T16:30:00Z","git_url":"git://github.com/ZmagoD/scinote-web.git","ssh_url":"git@github.com:ZmagoD/scinote-web.git","clone_url":"https://github.com/ZmagoD/scinote-web.git","svn_url":"https://github.com/ZmagoD/scinote-web","homepage":"http://www.scinote.net","size":7182,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"biosistemika:improved-sample-table","ref":"improved-sample-table","sha":"5b917768a767bcf92eb96bf3e8529becce898244","user":{"login":"biosistemika","id":15630206,"avatar_url":"https://avatars.githubusercontent.com/u/15630206?v=3","gravatar_id":"","url":"https://api.github.com/users/biosistemika","html_url":"https://github.com/biosistemika","followers_url":"https://api.github.com/users/biosistemika/followers","following_url":"https://api.github.com/users/biosistemika/following{/other_user}","gists_url":"https://api.github.com/users/biosistemika/gists{/gist_id}","starred_url":"https://api.github.com/users/biosistemika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biosistemika/subscriptions","organizations_url":"https://api.github.com/users/biosistemika/orgs","repos_url":"https://api.github.com/users/biosistemika/repos","events_url":"https://api.github.com/users/biosistemika/events{/privacy}","received_events_url":"https://api.github.com/users/biosistemika/received_events","type":"Organization","site_admin":false},"repo":{"id":51598133,"name":"scinote-web","full_name":"biosistemika/scinote-web","owner":{"login":"biosistemika","id":15630206,"avatar_url":"https://avatars.githubusercontent.com/u/15630206?v=3","gravatar_id":"","url":"https://api.github.com/users/biosistemika","html_url":"https://github.com/biosistemika","followers_url":"https://api.github.com/users/biosistemika/followers","following_url":"https://api.github.com/users/biosistemika/following{/other_user}","gists_url":"https://api.github.com/users/biosistemika/gists{/gist_id}","starred_url":"https://api.github.com/users/biosistemika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biosistemika/subscriptions","organizations_url":"https://api.github.com/users/biosistemika/orgs","repos_url":"https://api.github.com/users/biosistemika/repos","events_url":"https://api.github.com/users/biosistemika/events{/privacy}","received_events_url":"https://api.github.com/users/biosistemika/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/biosistemika/scinote-web","description":"Open source electronic scientific notebook (ELN) that helps you manage your laboratory work and stores all your experimental data in one place.","fork":false,"url":"https://api.github.com/repos/biosistemika/scinote-web","forks_url":"https://api.github.com/repos/biosistemika/scinote-web/forks","keys_url":"https://api.github.com/repos/biosistemika/scinote-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/biosistemika/scinote-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/biosistemika/scinote-web/teams","hooks_url":"https://api.github.com/repos/biosistemika/scinote-web/hooks","issue_events_url":"https://api.github.com/repos/biosistemika/scinote-web/issues/events{/number}","events_url":"https://api.github.com/repos/biosistemika/scinote-web/events","assignees_url":"https://api.github.com/repos/biosistemika/scinote-web/assignees{/user}","branches_url":"https://api.github.com/repos/biosistemika/scinote-web/branches{/branch}","tags_url":"https://api.github.com/repos/biosistemika/scinote-web/tags","blobs_url":"https://api.github.com/repos/biosistemika/scinote-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/biosistemika/scinote-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/biosistemika/scinote-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/biosistemika/scinote-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/biosistemika/scinote-web/statuses/{sha}","languages_url":"https://api.github.com/repos/biosistemika/scinote-web/languages","stargazers_url":"https://api.github.com/repos/biosistemika/scinote-web/stargazers","contributors_url":"https://api.github.com/repos/biosistemika/scinote-web/contributors","subscribers_url":"https://api.github.com/repos/biosistemika/scinote-web/subscribers","subscription_url":"https://api.github.com/repos/biosistemika/scinote-web/subscription","commits_url":"https://api.github.com/repos/biosistemika/scinote-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/biosistemika/scinote-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/biosistemika/scinote-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/biosistemika/scinote-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/biosistemika/scinote-web/contents/{+path}","compare_url":"https://api.github.com/repos/biosistemika/scinote-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/biosistemika/scinote-web/merges","archive_url":"https://api.github.com/repos/biosistemika/scinote-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/biosistemika/scinote-web/downloads","issues_url":"https://api.github.com/repos/biosistemika/scinote-web/issues{/number}","pulls_url":"https://api.github.com/repos/biosistemika/scinote-web/pulls{/number}","milestones_url":"https://api.github.com/repos/biosistemika/scinote-web/milestones{/number}","notifications_url":"https://api.github.com/repos/biosistemika/scinote-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/biosistemika/scinote-web/labels{/name}","releases_url":"https://api.github.com/repos/biosistemika/scinote-web/releases{/id}","deployments_url":"https://api.github.com/repos/biosistemika/scinote-web/deployments","created_at":"2016-02-12T15:47:19Z","updated_at":"2016-11-25T16:43:23Z","pushed_at":"2016-11-28T12:53:02Z","git_url":"git://github.com/biosistemika/scinote-web.git","ssh_url":"git@github.com:biosistemika/scinote-web.git","clone_url":"https://github.com/biosistemika/scinote-web.git","svn_url":"https://github.com/biosistemika/scinote-web","homepage":"http://www.scinote.net","size":7429,"stargazers_count":33,"watchers_count":33,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":10,"forks":15,"open_issues":10,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/biosistemika/scinote-web/pulls/320"},"html":{"href":"https://github.com/biosistemika/scinote-web/pull/320"},"issue":{"href":"https://api.github.com/repos/biosistemika/scinote-web/issues/320"},"comments":{"href":"https://api.github.com/repos/biosistemika/scinote-web/issues/320/comments"},"review_comments":{"href":"https://api.github.com/repos/biosistemika/scinote-web/pulls/320/comments"},"review_comment":{"href":"https://api.github.com/repos/biosistemika/scinote-web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/biosistemika/scinote-web/pulls/320/commits"},"statuses":{"href":"https://api.github.com/repos/biosistemika/scinote-web/statuses/9d91d2ce2805f1e7d42f2cf3c032dbe499e5928b"}}}}
{"actor":{"display_login":"okriuchykhin"}}