{"action":"created","comment":{"url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/pulls/comments/24241256","id":24241256,"diff_hunk":"@@ -0,0 +1,140 @@\n+;(function() {\n+  var d3 = require('d3');\n+  var _ = require('lodash');\n+\n+  var AmpersandState = require('ampersand-state');\n+  var AmpersandView = require('ampersand-view');\n+\n+  var FilterTrackerState = AmpersandState.extend({\n+    props: {\n+      filter: 'function'\n+    },\n+    session: {\n+      handles: 'array'\n+    },\n+    initialize: function() {\n+      _.each(this.handles, function(handle) {\n+        console.log(handle.model);\n+        handle.active = false;\n+        _.each(handle.props, function(prop) {\n+          handle.model.on('change:' + prop, function(model, prop) {\n+            handle.active = false;\n+            _.each(handle.props, function(prop, index) {\n+              if ((typeof handle.clearValues[index] !== 'function' && model[prop] !== handle.clearValues[index]) || (typeof handle.clearValues[index] === 'function' && handle.clearValues[index].call(handle.model))) {","path":"ampersand-filter-tracker.js","position":23,"original_position":23,"commit_id":"e14489562486c4f0fecb01ec935421a30264d4d4","original_commit_id":"e14489562486c4f0fecb01ec935421a30264d4d4","user":{"login":"nubs","id":57673,"avatar_url":"https://avatars.githubusercontent.com/u/57673?v=3","gravatar_id":"","url":"https://api.github.com/users/nubs","html_url":"https://github.com/nubs","followers_url":"https://api.github.com/users/nubs/followers","following_url":"https://api.github.com/users/nubs/following{/other_user}","gists_url":"https://api.github.com/users/nubs/gists{/gist_id}","starred_url":"https://api.github.com/users/nubs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nubs/subscriptions","organizations_url":"https://api.github.com/users/nubs/orgs","repos_url":"https://api.github.com/users/nubs/repos","events_url":"https://api.github.com/users/nubs/events{/privacy}","received_events_url":"https://api.github.com/users/nubs/received_events","type":"User","site_admin":false},"body":"actually, I kinda like this to replace the whole each here:\r\n```javascript\r\nhandle.active = _.any(handle.props, function(prop, index) {\r\n  var clearValue = handle.clearValues[index];\r\n  return _.isFunction(clearValue) ? clearValue.call(handle.model) : model[prop] !== clearValue;\r\n});\r\n```","created_at":"2015-02-06T13:56:59Z","updated_at":"2015-02-06T13:56:59Z","html_url":"https://github.com/helpdotcom/ampersand-filter-tracker/pull/1#discussion_r24241256","pull_request_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/pulls/comments/24241256"},"html":{"href":"https://github.com/helpdotcom/ampersand-filter-tracker/pull/1#discussion_r24241256"},"pull_request":{"href":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/pulls/1","id":28785058,"html_url":"https://github.com/helpdotcom/ampersand-filter-tracker/pull/1","diff_url":"https://github.com/helpdotcom/ampersand-filter-tracker/pull/1.diff","patch_url":"https://github.com/helpdotcom/ampersand-filter-tracker/pull/1.patch","issue_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/issues/1","number":1,"state":"open","locked":false,"title":"First draft of ampersand-filter-tracker.","user":{"login":"suitupalex","id":5080493,"avatar_url":"https://avatars.githubusercontent.com/u/5080493?v=3","gravatar_id":"","url":"https://api.github.com/users/suitupalex","html_url":"https://github.com/suitupalex","followers_url":"https://api.github.com/users/suitupalex/followers","following_url":"https://api.github.com/users/suitupalex/following{/other_user}","gists_url":"https://api.github.com/users/suitupalex/gists{/gist_id}","starred_url":"https://api.github.com/users/suitupalex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suitupalex/subscriptions","organizations_url":"https://api.github.com/users/suitupalex/orgs","repos_url":"https://api.github.com/users/suitupalex/repos","events_url":"https://api.github.com/users/suitupalex/events{/privacy}","received_events_url":"https://api.github.com/users/suitupalex/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-06T04:48:11Z","updated_at":"2015-02-06T13:56:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c3af3ac43d4b553184212456184d91245784409a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/pulls/1/commits","review_comments_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/pulls/1/comments","review_comment_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/pulls/comments/{number}","comments_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/issues/1/comments","statuses_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/statuses/e14489562486c4f0fecb01ec935421a30264d4d4","head":{"label":"suitupalex:master","ref":"master","sha":"e14489562486c4f0fecb01ec935421a30264d4d4","user":{"login":"suitupalex","id":5080493,"avatar_url":"https://avatars.githubusercontent.com/u/5080493?v=3","gravatar_id":"","url":"https://api.github.com/users/suitupalex","html_url":"https://github.com/suitupalex","followers_url":"https://api.github.com/users/suitupalex/followers","following_url":"https://api.github.com/users/suitupalex/following{/other_user}","gists_url":"https://api.github.com/users/suitupalex/gists{/gist_id}","starred_url":"https://api.github.com/users/suitupalex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suitupalex/subscriptions","organizations_url":"https://api.github.com/users/suitupalex/orgs","repos_url":"https://api.github.com/users/suitupalex/repos","events_url":"https://api.github.com/users/suitupalex/events{/privacy}","received_events_url":"https://api.github.com/users/suitupalex/received_events","type":"User","site_admin":false},"repo":{"id":30386152,"name":"ampersand-filter-tracker","full_name":"suitupalex/ampersand-filter-tracker","owner":{"login":"suitupalex","id":5080493,"avatar_url":"https://avatars.githubusercontent.com/u/5080493?v=3","gravatar_id":"","url":"https://api.github.com/users/suitupalex","html_url":"https://github.com/suitupalex","followers_url":"https://api.github.com/users/suitupalex/followers","following_url":"https://api.github.com/users/suitupalex/following{/other_user}","gists_url":"https://api.github.com/users/suitupalex/gists{/gist_id}","starred_url":"https://api.github.com/users/suitupalex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suitupalex/subscriptions","organizations_url":"https://api.github.com/users/suitupalex/orgs","repos_url":"https://api.github.com/users/suitupalex/repos","events_url":"https://api.github.com/users/suitupalex/events{/privacy}","received_events_url":"https://api.github.com/users/suitupalex/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/suitupalex/ampersand-filter-tracker","description":"Creates both a GUI and a filter from multiple models.","fork":true,"url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker","forks_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/forks","keys_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/teams","hooks_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/hooks","issue_events_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/issues/events{/number}","events_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/events","assignees_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/assignees{/user}","branches_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/branches{/branch}","tags_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/tags","blobs_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/git/refs{/sha}","trees_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/statuses/{sha}","languages_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/languages","stargazers_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/stargazers","contributors_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/contributors","subscribers_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/subscribers","subscription_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/subscription","commits_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/commits{/sha}","git_commits_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/git/commits{/sha}","comments_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/comments{/number}","issue_comment_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/issues/comments/{number}","contents_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/contents/{+path}","compare_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/merges","archive_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/downloads","issues_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/issues{/number}","pulls_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/pulls{/number}","milestones_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/milestones{/number}","notifications_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/labels{/name}","releases_url":"https://api.github.com/repos/suitupalex/ampersand-filter-tracker/releases{/id}","created_at":"2015-02-06T00:23:08Z","updated_at":"2015-02-06T04:48:59Z","pushed_at":"2015-02-06T04:48:59Z","git_url":"git://github.com/suitupalex/ampersand-filter-tracker.git","ssh_url":"git@github.com:suitupalex/ampersand-filter-tracker.git","clone_url":"https://github.com/suitupalex/ampersand-filter-tracker.git","svn_url":"https://github.com/suitupalex/ampersand-filter-tracker","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"master"}},"base":{"label":"helpdotcom:master","ref":"master","sha":"1cc6f7b6027d7cdf10fea1769bdd091de98fe777","user":{"login":"helpdotcom","id":7951584,"avatar_url":"https://avatars.githubusercontent.com/u/7951584?v=3","gravatar_id":"","url":"https://api.github.com/users/helpdotcom","html_url":"https://github.com/helpdotcom","followers_url":"https://api.github.com/users/helpdotcom/followers","following_url":"https://api.github.com/users/helpdotcom/following{/other_user}","gists_url":"https://api.github.com/users/helpdotcom/gists{/gist_id}","starred_url":"https://api.github.com/users/helpdotcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helpdotcom/subscriptions","organizations_url":"https://api.github.com/users/helpdotcom/orgs","repos_url":"https://api.github.com/users/helpdotcom/repos","events_url":"https://api.github.com/users/helpdotcom/events{/privacy}","received_events_url":"https://api.github.com/users/helpdotcom/received_events","type":"Organization","site_admin":false},"repo":{"id":30386068,"name":"ampersand-filter-tracker","full_name":"helpdotcom/ampersand-filter-tracker","owner":{"login":"helpdotcom","id":7951584,"avatar_url":"https://avatars.githubusercontent.com/u/7951584?v=3","gravatar_id":"","url":"https://api.github.com/users/helpdotcom","html_url":"https://github.com/helpdotcom","followers_url":"https://api.github.com/users/helpdotcom/followers","following_url":"https://api.github.com/users/helpdotcom/following{/other_user}","gists_url":"https://api.github.com/users/helpdotcom/gists{/gist_id}","starred_url":"https://api.github.com/users/helpdotcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helpdotcom/subscriptions","organizations_url":"https://api.github.com/users/helpdotcom/orgs","repos_url":"https://api.github.com/users/helpdotcom/repos","events_url":"https://api.github.com/users/helpdotcom/events{/privacy}","received_events_url":"https://api.github.com/users/helpdotcom/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/helpdotcom/ampersand-filter-tracker","description":"Creates both a GUI and a filter from multiple models.","fork":false,"url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker","forks_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/forks","keys_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/teams","hooks_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/hooks","issue_events_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/issues/events{/number}","events_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/events","assignees_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/assignees{/user}","branches_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/branches{/branch}","tags_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/tags","blobs_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/git/refs{/sha}","trees_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/statuses/{sha}","languages_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/languages","stargazers_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/stargazers","contributors_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/contributors","subscribers_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/subscribers","subscription_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/subscription","commits_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/commits{/sha}","git_commits_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/git/commits{/sha}","comments_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/comments{/number}","issue_comment_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/issues/comments/{number}","contents_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/contents/{+path}","compare_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/merges","archive_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/downloads","issues_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/issues{/number}","pulls_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/pulls{/number}","milestones_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/milestones{/number}","notifications_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/labels{/name}","releases_url":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/releases{/id}","created_at":"2015-02-06T00:20:56Z","updated_at":"2015-02-06T00:20:56Z","pushed_at":"2015-02-06T00:21:33Z","git_url":"git://github.com/helpdotcom/ampersand-filter-tracker.git","ssh_url":"git@github.com:helpdotcom/ampersand-filter-tracker.git","clone_url":"https://github.com/helpdotcom/ampersand-filter-tracker.git","svn_url":"https://github.com/helpdotcom/ampersand-filter-tracker","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/pulls/1"},"html":{"href":"https://github.com/helpdotcom/ampersand-filter-tracker/pull/1"},"issue":{"href":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/issues/1"},"comments":{"href":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/helpdotcom/ampersand-filter-tracker/statuses/e14489562486c4f0fecb01ec935421a30264d4d4"}}}}