{"action":"created","comment":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/pulls/comments/28355171","id":28355171,"diff_hunk":"@@ -6,7 +6,45 @@ Template.quickForm.helpers({\n   },\n   innerContext: function quickFormContext() {\n     var atts = this;\n-    \n+\n+    // get schema\n+    var schema = eval(this.collection).simpleSchema()._schema;\n+\n+    // if atts.fields exists, restrict the schema to specified fields\n+    if (atts.fields) {\n+      // note: haven't found a clean way to do this all in one go yet, so doing it later. \n+    }\n+\n+    // get list of unique field groups with any falsy values removed\n+    // note: if atts.fields is specified, only consider fields contained in it\n+    var fieldGroups = _.compact(_.unique(_.map(schema, function (property, key) {\n+      return (!atts.fields || _.contains(atts.fields, key)) && property.autoform && property.autoform.group ;\n+    }))).sort();\n+\n+    // build fieldGroups array\n+    var fieldGroups = _.map(fieldGroups, function (property, key) {\n+\n+      var fieldGroupName = property;\n+\n+      // for each fieldset, get list of field names\n+      var fieldsForGroup = _.compact(_.map(schema, function (property, key) {\n+        return property.autoform && property.autoform.group && property.autoform.group === fieldGroupName && key;\n+      }));\n+\n+      return {\n+        name: fieldGroupName,\n+        fields: fieldsForGroup\n+      };\n+    });\n+\n+    // get all fields with no field group specified\n+    // note: if atts.fields is specified, only consider fields contained in it\n+    // always omit fields with \"$\" in their name\n+    var fieldWithNoGroups = _.compact(_.map(schema, function (property, key) {\n+      return key.indexOf(\"$\") == \"-1\" && (!atts.fields || _.contains(atts.fields, key)) && (!property.autoform || !property.autoform.group) && key;\n+    }));\n+    var fieldWithNoGroups = {fields: fieldWithNoGroups};","path":"components/quickForm/quickForm.js","position":42,"original_position":42,"commit_id":"d80f886ecae578dfdc0bf2eb430e9d9d3566c00f","original_commit_id":"d80f886ecae578dfdc0bf2eb430e9d9d3566c00f","user":{"login":"aldeed","id":3012067,"avatar_url":"https://avatars.githubusercontent.com/u/3012067?v=3","gravatar_id":"","url":"https://api.github.com/users/aldeed","html_url":"https://github.com/aldeed","followers_url":"https://api.github.com/users/aldeed/followers","following_url":"https://api.github.com/users/aldeed/following{/other_user}","gists_url":"https://api.github.com/users/aldeed/gists{/gist_id}","starred_url":"https://api.github.com/users/aldeed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aldeed/subscriptions","organizations_url":"https://api.github.com/users/aldeed/orgs","repos_url":"https://api.github.com/users/aldeed/repos","events_url":"https://api.github.com/users/aldeed/events{/privacy}","received_events_url":"https://api.github.com/users/aldeed/received_events","type":"User","site_admin":false},"body":"Should be no `var` before `fieldWithNoGroups` here since it's already defined.","created_at":"2015-04-14T18:25:34Z","updated_at":"2015-04-14T18:25:34Z","html_url":"https://github.com/aldeed/meteor-autoform/pull/865#discussion_r28355171","pull_request_url":"https://api.github.com/repos/aldeed/meteor-autoform/pulls/865","_links":{"self":{"href":"https://api.github.com/repos/aldeed/meteor-autoform/pulls/comments/28355171"},"html":{"href":"https://github.com/aldeed/meteor-autoform/pull/865#discussion_r28355171"},"pull_request":{"href":"https://api.github.com/repos/aldeed/meteor-autoform/pulls/865"}}},"pull_request":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/pulls/865","id":32725923,"html_url":"https://github.com/aldeed/meteor-autoform/pull/865","diff_url":"https://github.com/aldeed/meteor-autoform/pull/865.diff","patch_url":"https://github.com/aldeed/meteor-autoform/pull/865.patch","issue_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/865","number":865,"state":"open","locked":false,"title":"Split form in fieldsets according to autoform.group option","user":{"login":"SachaG","id":358832,"avatar_url":"https://avatars.githubusercontent.com/u/358832?v=3","gravatar_id":"","url":"https://api.github.com/users/SachaG","html_url":"https://github.com/SachaG","followers_url":"https://api.github.com/users/SachaG/followers","following_url":"https://api.github.com/users/SachaG/following{/other_user}","gists_url":"https://api.github.com/users/SachaG/gists{/gist_id}","starred_url":"https://api.github.com/users/SachaG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SachaG/subscriptions","organizations_url":"https://api.github.com/users/SachaG/orgs","repos_url":"https://api.github.com/users/SachaG/repos","events_url":"https://api.github.com/users/SachaG/events{/privacy}","received_events_url":"https://api.github.com/users/SachaG/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-07T01:12:52Z","updated_at":"2015-04-14T18:25:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"46ce413bf86f432c82d4811a3197ac77741b5baf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aldeed/meteor-autoform/pulls/865/commits","review_comments_url":"https://api.github.com/repos/aldeed/meteor-autoform/pulls/865/comments","review_comment_url":"https://api.github.com/repos/aldeed/meteor-autoform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/865/comments","statuses_url":"https://api.github.com/repos/aldeed/meteor-autoform/statuses/d80f886ecae578dfdc0bf2eb430e9d9d3566c00f","head":{"label":"SachaG:fieldsets","ref":"fieldsets","sha":"d80f886ecae578dfdc0bf2eb430e9d9d3566c00f","user":{"login":"SachaG","id":358832,"avatar_url":"https://avatars.githubusercontent.com/u/358832?v=3","gravatar_id":"","url":"https://api.github.com/users/SachaG","html_url":"https://github.com/SachaG","followers_url":"https://api.github.com/users/SachaG/followers","following_url":"https://api.github.com/users/SachaG/following{/other_user}","gists_url":"https://api.github.com/users/SachaG/gists{/gist_id}","starred_url":"https://api.github.com/users/SachaG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SachaG/subscriptions","organizations_url":"https://api.github.com/users/SachaG/orgs","repos_url":"https://api.github.com/users/SachaG/repos","events_url":"https://api.github.com/users/SachaG/events{/privacy}","received_events_url":"https://api.github.com/users/SachaG/received_events","type":"User","site_admin":false},"repo":{"id":24805194,"name":"meteor-autoform","full_name":"SachaG/meteor-autoform","owner":{"login":"SachaG","id":358832,"avatar_url":"https://avatars.githubusercontent.com/u/358832?v=3","gravatar_id":"","url":"https://api.github.com/users/SachaG","html_url":"https://github.com/SachaG","followers_url":"https://api.github.com/users/SachaG/followers","following_url":"https://api.github.com/users/SachaG/following{/other_user}","gists_url":"https://api.github.com/users/SachaG/gists{/gist_id}","starred_url":"https://api.github.com/users/SachaG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SachaG/subscriptions","organizations_url":"https://api.github.com/users/SachaG/orgs","repos_url":"https://api.github.com/users/SachaG/repos","events_url":"https://api.github.com/users/SachaG/events{/privacy}","received_events_url":"https://api.github.com/users/SachaG/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SachaG/meteor-autoform","description":"A smart package for Meteor that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive validation.","fork":true,"url":"https://api.github.com/repos/SachaG/meteor-autoform","forks_url":"https://api.github.com/repos/SachaG/meteor-autoform/forks","keys_url":"https://api.github.com/repos/SachaG/meteor-autoform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SachaG/meteor-autoform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SachaG/meteor-autoform/teams","hooks_url":"https://api.github.com/repos/SachaG/meteor-autoform/hooks","issue_events_url":"https://api.github.com/repos/SachaG/meteor-autoform/issues/events{/number}","events_url":"https://api.github.com/repos/SachaG/meteor-autoform/events","assignees_url":"https://api.github.com/repos/SachaG/meteor-autoform/assignees{/user}","branches_url":"https://api.github.com/repos/SachaG/meteor-autoform/branches{/branch}","tags_url":"https://api.github.com/repos/SachaG/meteor-autoform/tags","blobs_url":"https://api.github.com/repos/SachaG/meteor-autoform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SachaG/meteor-autoform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SachaG/meteor-autoform/git/refs{/sha}","trees_url":"https://api.github.com/repos/SachaG/meteor-autoform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SachaG/meteor-autoform/statuses/{sha}","languages_url":"https://api.github.com/repos/SachaG/meteor-autoform/languages","stargazers_url":"https://api.github.com/repos/SachaG/meteor-autoform/stargazers","contributors_url":"https://api.github.com/repos/SachaG/meteor-autoform/contributors","subscribers_url":"https://api.github.com/repos/SachaG/meteor-autoform/subscribers","subscription_url":"https://api.github.com/repos/SachaG/meteor-autoform/subscription","commits_url":"https://api.github.com/repos/SachaG/meteor-autoform/commits{/sha}","git_commits_url":"https://api.github.com/repos/SachaG/meteor-autoform/git/commits{/sha}","comments_url":"https://api.github.com/repos/SachaG/meteor-autoform/comments{/number}","issue_comment_url":"https://api.github.com/repos/SachaG/meteor-autoform/issues/comments{/number}","contents_url":"https://api.github.com/repos/SachaG/meteor-autoform/contents/{+path}","compare_url":"https://api.github.com/repos/SachaG/meteor-autoform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SachaG/meteor-autoform/merges","archive_url":"https://api.github.com/repos/SachaG/meteor-autoform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SachaG/meteor-autoform/downloads","issues_url":"https://api.github.com/repos/SachaG/meteor-autoform/issues{/number}","pulls_url":"https://api.github.com/repos/SachaG/meteor-autoform/pulls{/number}","milestones_url":"https://api.github.com/repos/SachaG/meteor-autoform/milestones{/number}","notifications_url":"https://api.github.com/repos/SachaG/meteor-autoform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SachaG/meteor-autoform/labels{/name}","releases_url":"https://api.github.com/repos/SachaG/meteor-autoform/releases{/id}","created_at":"2014-10-05T00:34:04Z","updated_at":"2015-04-06T09:25:10Z","pushed_at":"2015-04-08T02:26:08Z","git_url":"git://github.com/SachaG/meteor-autoform.git","ssh_url":"git@github.com:SachaG/meteor-autoform.git","clone_url":"https://github.com/SachaG/meteor-autoform.git","svn_url":"https://github.com/SachaG/meteor-autoform","homepage":"","size":1756,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"aldeed:devel","ref":"devel","sha":"e8d161b90d426f4d4fd5980deef770c01d6f69bb","user":{"login":"aldeed","id":3012067,"avatar_url":"https://avatars.githubusercontent.com/u/3012067?v=3","gravatar_id":"","url":"https://api.github.com/users/aldeed","html_url":"https://github.com/aldeed","followers_url":"https://api.github.com/users/aldeed/followers","following_url":"https://api.github.com/users/aldeed/following{/other_user}","gists_url":"https://api.github.com/users/aldeed/gists{/gist_id}","starred_url":"https://api.github.com/users/aldeed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aldeed/subscriptions","organizations_url":"https://api.github.com/users/aldeed/orgs","repos_url":"https://api.github.com/users/aldeed/repos","events_url":"https://api.github.com/users/aldeed/events{/privacy}","received_events_url":"https://api.github.com/users/aldeed/received_events","type":"User","site_admin":false},"repo":{"id":11591855,"name":"meteor-autoform","full_name":"aldeed/meteor-autoform","owner":{"login":"aldeed","id":3012067,"avatar_url":"https://avatars.githubusercontent.com/u/3012067?v=3","gravatar_id":"","url":"https://api.github.com/users/aldeed","html_url":"https://github.com/aldeed","followers_url":"https://api.github.com/users/aldeed/followers","following_url":"https://api.github.com/users/aldeed/following{/other_user}","gists_url":"https://api.github.com/users/aldeed/gists{/gist_id}","starred_url":"https://api.github.com/users/aldeed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aldeed/subscriptions","organizations_url":"https://api.github.com/users/aldeed/orgs","repos_url":"https://api.github.com/users/aldeed/repos","events_url":"https://api.github.com/users/aldeed/events{/privacy}","received_events_url":"https://api.github.com/users/aldeed/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aldeed/meteor-autoform","description":"AutoForm is a Meteor package that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive validation.","fork":false,"url":"https://api.github.com/repos/aldeed/meteor-autoform","forks_url":"https://api.github.com/repos/aldeed/meteor-autoform/forks","keys_url":"https://api.github.com/repos/aldeed/meteor-autoform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aldeed/meteor-autoform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aldeed/meteor-autoform/teams","hooks_url":"https://api.github.com/repos/aldeed/meteor-autoform/hooks","issue_events_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/events{/number}","events_url":"https://api.github.com/repos/aldeed/meteor-autoform/events","assignees_url":"https://api.github.com/repos/aldeed/meteor-autoform/assignees{/user}","branches_url":"https://api.github.com/repos/aldeed/meteor-autoform/branches{/branch}","tags_url":"https://api.github.com/repos/aldeed/meteor-autoform/tags","blobs_url":"https://api.github.com/repos/aldeed/meteor-autoform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aldeed/meteor-autoform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aldeed/meteor-autoform/git/refs{/sha}","trees_url":"https://api.github.com/repos/aldeed/meteor-autoform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aldeed/meteor-autoform/statuses/{sha}","languages_url":"https://api.github.com/repos/aldeed/meteor-autoform/languages","stargazers_url":"https://api.github.com/repos/aldeed/meteor-autoform/stargazers","contributors_url":"https://api.github.com/repos/aldeed/meteor-autoform/contributors","subscribers_url":"https://api.github.com/repos/aldeed/meteor-autoform/subscribers","subscription_url":"https://api.github.com/repos/aldeed/meteor-autoform/subscription","commits_url":"https://api.github.com/repos/aldeed/meteor-autoform/commits{/sha}","git_commits_url":"https://api.github.com/repos/aldeed/meteor-autoform/git/commits{/sha}","comments_url":"https://api.github.com/repos/aldeed/meteor-autoform/comments{/number}","issue_comment_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/comments{/number}","contents_url":"https://api.github.com/repos/aldeed/meteor-autoform/contents/{+path}","compare_url":"https://api.github.com/repos/aldeed/meteor-autoform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aldeed/meteor-autoform/merges","archive_url":"https://api.github.com/repos/aldeed/meteor-autoform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aldeed/meteor-autoform/downloads","issues_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues{/number}","pulls_url":"https://api.github.com/repos/aldeed/meteor-autoform/pulls{/number}","milestones_url":"https://api.github.com/repos/aldeed/meteor-autoform/milestones{/number}","notifications_url":"https://api.github.com/repos/aldeed/meteor-autoform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aldeed/meteor-autoform/labels{/name}","releases_url":"https://api.github.com/repos/aldeed/meteor-autoform/releases{/id}","created_at":"2013-07-22T20:36:29Z","updated_at":"2015-04-14T17:39:19Z","pushed_at":"2015-04-10T16:14:34Z","git_url":"git://github.com/aldeed/meteor-autoform.git","ssh_url":"git@github.com:aldeed/meteor-autoform.git","clone_url":"https://github.com/aldeed/meteor-autoform.git","svn_url":"https://github.com/aldeed/meteor-autoform","homepage":"http://autoform.meteor.com","size":4464,"stargazers_count":667,"watchers_count":667,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":133,"mirror_url":null,"open_issues_count":88,"forks":133,"open_issues":88,"watchers":667,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aldeed/meteor-autoform/pulls/865"},"html":{"href":"https://github.com/aldeed/meteor-autoform/pull/865"},"issue":{"href":"https://api.github.com/repos/aldeed/meteor-autoform/issues/865"},"comments":{"href":"https://api.github.com/repos/aldeed/meteor-autoform/issues/865/comments"},"review_comments":{"href":"https://api.github.com/repos/aldeed/meteor-autoform/pulls/865/comments"},"review_comment":{"href":"https://api.github.com/repos/aldeed/meteor-autoform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aldeed/meteor-autoform/pulls/865/commits"},"statuses":{"href":"https://api.github.com/repos/aldeed/meteor-autoform/statuses/d80f886ecae578dfdc0bf2eb430e9d9d3566c00f"}}}}