{"action":"created","comment":{"url":"https://api.github.com/repos/crdschurch/crds-angular/pulls/comments/64569749","id":64569749,"diff_hunk":"@@ -0,0 +1,184 @@\n+(function() {\n+  'use strict';\n+\n+  module.exports = FormBuilderCtrl;\n+\n+  FormBuilderCtrl.$inject = ['$rootScope', 'Group', 'Session', 'ContentPageService', 'FormBuilderFieldsService'];\n+\n+  function FormBuilderCtrl($rootScope, Group, Session, ContentPageService, FormBuilderFieldsService) {\n+    var vm = this;\n+    var constants = require('crds-constants');\n+    var attributeTypeIds = require('crds-constants').ATTRIBUTE_TYPE_IDS;\n+    var fieldsService = FormBuilderFieldsService;\n+\n+    //TODO Decide if you member or leader - now always leader\n+    var participant = {\n+      capacity: 1,\n+      contactId: parseInt(Session.exists('userId')),\n+      groupRoleId: constants.GROUP.ROLES.MEMBER,\n+      childCareNeeded: false,\n+      sendConfirmationEmail: false,\n+      singleAttributes: {},\n+      attributeTypes: {}\n+    };\n+\n+    vm.data = {};\n+    vm.saving = false;\n+    vm.save = save;\n+\n+    // TODO: Consider setting vm.data = resolvedData, may have to add convenience methods like ethnicities\n+\n+    vm.group = {};\n+    vm.group.groupId = null;\n+    \n+    vm.data.profileData = {person: ContentPageService.resolvedData.profile};\n+    vm.data.genders = ContentPageService.resolvedData.genders;\n+    vm.data.ethnicities = ContentPageService.resolvedData.profile.attributeTypes[attributeTypeIds.ETHNICITY].attributes;\n+\n+    vm.data.availableGroups = ContentPageService.resolvedData.availableGroups;\n+    \n+    vm.data.attributeTypes = convertAttributeTypes(ContentPageService.resolvedData.attributeTypes);\n+    participant.attributeTypes = getMultiSelectAttributeTypes(ContentPageService.resolvedData.attributeTypes);\n+    participant.singleAttributes = getSingleSelectAttributeTypes(ContentPageService.resolvedData.attributeTypes);\n+\n+    vm.data.groupParticipant = participant;\n+\n+    function convertAttributeTypes(list) {\n+      var results = {}\n+      _.each(list, function(item) {\n+        results[item.attributeTypeId] = item;\n+      });\n+      return results;\n+    }\n+\n+    function getMultiSelectAttributeTypes(attributeTypes) {\n+      var multiAttributeTypes = _.filter(attributeTypes, function(attributeType) {\n+        return attributeType.allowMultipleSelections;\n+      });\n+\n+      var results = {};\n+      _.each(multiAttributeTypes, function(attributeType) {\n+        var attributes = getMultiAttributes(attributeType);\n+\n+        results[attributeType.attributeTypeId] = {\n+          attributeTypeId: attributeType.attributeTypeId,\n+          name: attributeType.name,\n+          attributes: attributes,\n+        };\n+      });","path":"crossroads.net/app/formBuilder/formBuilder.controller.js","position":68,"original_position":68,"commit_id":"cdbb153445a0ada1a4420d4a7e46510e9bac1998","original_commit_id":"cdbb153445a0ada1a4420d4a7e46510e9bac1998","user":{"login":"silbermm","id":42816,"avatar_url":"https://avatars.githubusercontent.com/u/42816?v=3","gravatar_id":"","url":"https://api.github.com/users/silbermm","html_url":"https://github.com/silbermm","followers_url":"https://api.github.com/users/silbermm/followers","following_url":"https://api.github.com/users/silbermm/following{/other_user}","gists_url":"https://api.github.com/users/silbermm/gists{/gist_id}","starred_url":"https://api.github.com/users/silbermm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silbermm/subscriptions","organizations_url":"https://api.github.com/users/silbermm/orgs","repos_url":"https://api.github.com/users/silbermm/repos","events_url":"https://api.github.com/users/silbermm/events{/privacy}","received_events_url":"https://api.github.com/users/silbermm/received_events","type":"User","site_admin":false},"body":"this may be a little cleaner with a `_.map()._keyBy()` this way your not mutating the `results` variable. \r\n\r\n`return _.chain(multiAttributeTypes).map(function(attributeType) {\r\n  var attributes = getMultiAttributes(attributeType);\r\n  return { \r\n    attributeTypeId: attributeType.attributeTypeId,\r\n    name: attributeType.name,\r\n    attributes: attributes\r\n  }\r\n}).keyBy('attributeTypeId').value();`\r\n`\r\nyou could even chain the filter call...\r\n\r\nOf course this is just a matter of style and only a suggestion","created_at":"2016-05-25T13:16:30Z","updated_at":"2016-05-25T13:16:30Z","html_url":"https://github.com/crdschurch/crds-angular/pull/2168#discussion_r64569749","pull_request_url":"https://api.github.com/repos/crdschurch/crds-angular/pulls/2168","_links":{"self":{"href":"https://api.github.com/repos/crdschurch/crds-angular/pulls/comments/64569749"},"html":{"href":"https://github.com/crdschurch/crds-angular/pull/2168#discussion_r64569749"},"pull_request":{"href":"https://api.github.com/repos/crdschurch/crds-angular/pulls/2168"}}},"pull_request":{"url":"https://api.github.com/repos/crdschurch/crds-angular/pulls/2168","id":71290639,"html_url":"https://github.com/crdschurch/crds-angular/pull/2168","diff_url":"https://github.com/crdschurch/crds-angular/pull/2168.diff","patch_url":"https://github.com/crdschurch/crds-angular/pull/2168.patch","issue_url":"https://api.github.com/repos/crdschurch/crds-angular/issues/2168","number":2168,"state":"open","locked":false,"title":"Feature/us4001 refactor undivided","user":{"login":"charlie-retzler","id":3252288,"avatar_url":"https://avatars.githubusercontent.com/u/3252288?v=3","gravatar_id":"","url":"https://api.github.com/users/charlie-retzler","html_url":"https://github.com/charlie-retzler","followers_url":"https://api.github.com/users/charlie-retzler/followers","following_url":"https://api.github.com/users/charlie-retzler/following{/other_user}","gists_url":"https://api.github.com/users/charlie-retzler/gists{/gist_id}","starred_url":"https://api.github.com/users/charlie-retzler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charlie-retzler/subscriptions","organizations_url":"https://api.github.com/users/charlie-retzler/orgs","repos_url":"https://api.github.com/users/charlie-retzler/repos","events_url":"https://api.github.com/users/charlie-retzler/events{/privacy}","received_events_url":"https://api.github.com/users/charlie-retzler/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-24T20:52:51Z","updated_at":"2016-05-25T13:16:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5977047e0f539b965e5071d367ca954f202b9bcb","assignee":{"login":"silbermm","id":42816,"avatar_url":"https://avatars.githubusercontent.com/u/42816?v=3","gravatar_id":"","url":"https://api.github.com/users/silbermm","html_url":"https://github.com/silbermm","followers_url":"https://api.github.com/users/silbermm/followers","following_url":"https://api.github.com/users/silbermm/following{/other_user}","gists_url":"https://api.github.com/users/silbermm/gists{/gist_id}","starred_url":"https://api.github.com/users/silbermm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silbermm/subscriptions","organizations_url":"https://api.github.com/users/silbermm/orgs","repos_url":"https://api.github.com/users/silbermm/repos","events_url":"https://api.github.com/users/silbermm/events{/privacy}","received_events_url":"https://api.github.com/users/silbermm/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/crdschurch/crds-angular/pulls/2168/commits","review_comments_url":"https://api.github.com/repos/crdschurch/crds-angular/pulls/2168/comments","review_comment_url":"https://api.github.com/repos/crdschurch/crds-angular/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crdschurch/crds-angular/issues/2168/comments","statuses_url":"https://api.github.com/repos/crdschurch/crds-angular/statuses/cdbb153445a0ada1a4420d4a7e46510e9bac1998","head":{"label":"crdschurch:feature/US4001-refactor-undivided","ref":"feature/US4001-refactor-undivided","sha":"cdbb153445a0ada1a4420d4a7e46510e9bac1998","user":{"login":"crdschurch","id":1843144,"avatar_url":"https://avatars.githubusercontent.com/u/1843144?v=3","gravatar_id":"","url":"https://api.github.com/users/crdschurch","html_url":"https://github.com/crdschurch","followers_url":"https://api.github.com/users/crdschurch/followers","following_url":"https://api.github.com/users/crdschurch/following{/other_user}","gists_url":"https://api.github.com/users/crdschurch/gists{/gist_id}","starred_url":"https://api.github.com/users/crdschurch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crdschurch/subscriptions","organizations_url":"https://api.github.com/users/crdschurch/orgs","repos_url":"https://api.github.com/users/crdschurch/repos","events_url":"https://api.github.com/users/crdschurch/events{/privacy}","received_events_url":"https://api.github.com/users/crdschurch/received_events","type":"Organization","site_admin":false},"repo":{"id":26870034,"name":"crds-angular","full_name":"crdschurch/crds-angular","owner":{"login":"crdschurch","id":1843144,"avatar_url":"https://avatars.githubusercontent.com/u/1843144?v=3","gravatar_id":"","url":"https://api.github.com/users/crdschurch","html_url":"https://github.com/crdschurch","followers_url":"https://api.github.com/users/crdschurch/followers","following_url":"https://api.github.com/users/crdschurch/following{/other_user}","gists_url":"https://api.github.com/users/crdschurch/gists{/gist_id}","starred_url":"https://api.github.com/users/crdschurch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crdschurch/subscriptions","organizations_url":"https://api.github.com/users/crdschurch/orgs","repos_url":"https://api.github.com/users/crdschurch/repos","events_url":"https://api.github.com/users/crdschurch/events{/privacy}","received_events_url":"https://api.github.com/users/crdschurch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crdschurch/crds-angular","description":"Starting point for angular development at crossroads","fork":false,"url":"https://api.github.com/repos/crdschurch/crds-angular","forks_url":"https://api.github.com/repos/crdschurch/crds-angular/forks","keys_url":"https://api.github.com/repos/crdschurch/crds-angular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crdschurch/crds-angular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crdschurch/crds-angular/teams","hooks_url":"https://api.github.com/repos/crdschurch/crds-angular/hooks","issue_events_url":"https://api.github.com/repos/crdschurch/crds-angular/issues/events{/number}","events_url":"https://api.github.com/repos/crdschurch/crds-angular/events","assignees_url":"https://api.github.com/repos/crdschurch/crds-angular/assignees{/user}","branches_url":"https://api.github.com/repos/crdschurch/crds-angular/branches{/branch}","tags_url":"https://api.github.com/repos/crdschurch/crds-angular/tags","blobs_url":"https://api.github.com/repos/crdschurch/crds-angular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crdschurch/crds-angular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crdschurch/crds-angular/git/refs{/sha}","trees_url":"https://api.github.com/repos/crdschurch/crds-angular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crdschurch/crds-angular/statuses/{sha}","languages_url":"https://api.github.com/repos/crdschurch/crds-angular/languages","stargazers_url":"https://api.github.com/repos/crdschurch/crds-angular/stargazers","contributors_url":"https://api.github.com/repos/crdschurch/crds-angular/contributors","subscribers_url":"https://api.github.com/repos/crdschurch/crds-angular/subscribers","subscription_url":"https://api.github.com/repos/crdschurch/crds-angular/subscription","commits_url":"https://api.github.com/repos/crdschurch/crds-angular/commits{/sha}","git_commits_url":"https://api.github.com/repos/crdschurch/crds-angular/git/commits{/sha}","comments_url":"https://api.github.com/repos/crdschurch/crds-angular/comments{/number}","issue_comment_url":"https://api.github.com/repos/crdschurch/crds-angular/issues/comments{/number}","contents_url":"https://api.github.com/repos/crdschurch/crds-angular/contents/{+path}","compare_url":"https://api.github.com/repos/crdschurch/crds-angular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crdschurch/crds-angular/merges","archive_url":"https://api.github.com/repos/crdschurch/crds-angular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crdschurch/crds-angular/downloads","issues_url":"https://api.github.com/repos/crdschurch/crds-angular/issues{/number}","pulls_url":"https://api.github.com/repos/crdschurch/crds-angular/pulls{/number}","milestones_url":"https://api.github.com/repos/crdschurch/crds-angular/milestones{/number}","notifications_url":"https://api.github.com/repos/crdschurch/crds-angular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crdschurch/crds-angular/labels{/name}","releases_url":"https://api.github.com/repos/crdschurch/crds-angular/releases{/id}","deployments_url":"https://api.github.com/repos/crdschurch/crds-angular/deployments","created_at":"2014-11-19T16:21:09Z","updated_at":"2016-05-02T19:17:30Z","pushed_at":"2016-05-25T13:00:16Z","git_url":"git://github.com/crdschurch/crds-angular.git","ssh_url":"git@github.com:crdschurch/crds-angular.git","clone_url":"https://github.com/crdschurch/crds-angular.git","svn_url":"https://github.com/crdschurch/crds-angular","homepage":null,"size":41319,"stargazers_count":1,"watchers_count":1,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":1,"default_branch":"development"}},"base":{"label":"crdschurch:development","ref":"development","sha":"a6703efccbefa02078693bbe297bbf483062423a","user":{"login":"crdschurch","id":1843144,"avatar_url":"https://avatars.githubusercontent.com/u/1843144?v=3","gravatar_id":"","url":"https://api.github.com/users/crdschurch","html_url":"https://github.com/crdschurch","followers_url":"https://api.github.com/users/crdschurch/followers","following_url":"https://api.github.com/users/crdschurch/following{/other_user}","gists_url":"https://api.github.com/users/crdschurch/gists{/gist_id}","starred_url":"https://api.github.com/users/crdschurch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crdschurch/subscriptions","organizations_url":"https://api.github.com/users/crdschurch/orgs","repos_url":"https://api.github.com/users/crdschurch/repos","events_url":"https://api.github.com/users/crdschurch/events{/privacy}","received_events_url":"https://api.github.com/users/crdschurch/received_events","type":"Organization","site_admin":false},"repo":{"id":26870034,"name":"crds-angular","full_name":"crdschurch/crds-angular","owner":{"login":"crdschurch","id":1843144,"avatar_url":"https://avatars.githubusercontent.com/u/1843144?v=3","gravatar_id":"","url":"https://api.github.com/users/crdschurch","html_url":"https://github.com/crdschurch","followers_url":"https://api.github.com/users/crdschurch/followers","following_url":"https://api.github.com/users/crdschurch/following{/other_user}","gists_url":"https://api.github.com/users/crdschurch/gists{/gist_id}","starred_url":"https://api.github.com/users/crdschurch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crdschurch/subscriptions","organizations_url":"https://api.github.com/users/crdschurch/orgs","repos_url":"https://api.github.com/users/crdschurch/repos","events_url":"https://api.github.com/users/crdschurch/events{/privacy}","received_events_url":"https://api.github.com/users/crdschurch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crdschurch/crds-angular","description":"Starting point for angular development at crossroads","fork":false,"url":"https://api.github.com/repos/crdschurch/crds-angular","forks_url":"https://api.github.com/repos/crdschurch/crds-angular/forks","keys_url":"https://api.github.com/repos/crdschurch/crds-angular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crdschurch/crds-angular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crdschurch/crds-angular/teams","hooks_url":"https://api.github.com/repos/crdschurch/crds-angular/hooks","issue_events_url":"https://api.github.com/repos/crdschurch/crds-angular/issues/events{/number}","events_url":"https://api.github.com/repos/crdschurch/crds-angular/events","assignees_url":"https://api.github.com/repos/crdschurch/crds-angular/assignees{/user}","branches_url":"https://api.github.com/repos/crdschurch/crds-angular/branches{/branch}","tags_url":"https://api.github.com/repos/crdschurch/crds-angular/tags","blobs_url":"https://api.github.com/repos/crdschurch/crds-angular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crdschurch/crds-angular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crdschurch/crds-angular/git/refs{/sha}","trees_url":"https://api.github.com/repos/crdschurch/crds-angular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crdschurch/crds-angular/statuses/{sha}","languages_url":"https://api.github.com/repos/crdschurch/crds-angular/languages","stargazers_url":"https://api.github.com/repos/crdschurch/crds-angular/stargazers","contributors_url":"https://api.github.com/repos/crdschurch/crds-angular/contributors","subscribers_url":"https://api.github.com/repos/crdschurch/crds-angular/subscribers","subscription_url":"https://api.github.com/repos/crdschurch/crds-angular/subscription","commits_url":"https://api.github.com/repos/crdschurch/crds-angular/commits{/sha}","git_commits_url":"https://api.github.com/repos/crdschurch/crds-angular/git/commits{/sha}","comments_url":"https://api.github.com/repos/crdschurch/crds-angular/comments{/number}","issue_comment_url":"https://api.github.com/repos/crdschurch/crds-angular/issues/comments{/number}","contents_url":"https://api.github.com/repos/crdschurch/crds-angular/contents/{+path}","compare_url":"https://api.github.com/repos/crdschurch/crds-angular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crdschurch/crds-angular/merges","archive_url":"https://api.github.com/repos/crdschurch/crds-angular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crdschurch/crds-angular/downloads","issues_url":"https://api.github.com/repos/crdschurch/crds-angular/issues{/number}","pulls_url":"https://api.github.com/repos/crdschurch/crds-angular/pulls{/number}","milestones_url":"https://api.github.com/repos/crdschurch/crds-angular/milestones{/number}","notifications_url":"https://api.github.com/repos/crdschurch/crds-angular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crdschurch/crds-angular/labels{/name}","releases_url":"https://api.github.com/repos/crdschurch/crds-angular/releases{/id}","deployments_url":"https://api.github.com/repos/crdschurch/crds-angular/deployments","created_at":"2014-11-19T16:21:09Z","updated_at":"2016-05-02T19:17:30Z","pushed_at":"2016-05-25T13:00:16Z","git_url":"git://github.com/crdschurch/crds-angular.git","ssh_url":"git@github.com:crdschurch/crds-angular.git","clone_url":"https://github.com/crdschurch/crds-angular.git","svn_url":"https://github.com/crdschurch/crds-angular","homepage":null,"size":41319,"stargazers_count":1,"watchers_count":1,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":1,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/crdschurch/crds-angular/pulls/2168"},"html":{"href":"https://github.com/crdschurch/crds-angular/pull/2168"},"issue":{"href":"https://api.github.com/repos/crdschurch/crds-angular/issues/2168"},"comments":{"href":"https://api.github.com/repos/crdschurch/crds-angular/issues/2168/comments"},"review_comments":{"href":"https://api.github.com/repos/crdschurch/crds-angular/pulls/2168/comments"},"review_comment":{"href":"https://api.github.com/repos/crdschurch/crds-angular/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crdschurch/crds-angular/pulls/2168/commits"},"statuses":{"href":"https://api.github.com/repos/crdschurch/crds-angular/statuses/cdbb153445a0ada1a4420d4a7e46510e9bac1998"}}}}
{"actor":{"display_login":"silbermm"}}