{"action":"created","comment":{"url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls/comments/60566535","id":60566535,"diff_hunk":"@@ -0,0 +1,84 @@\n+import { createSelector } from 'reselect';\n+\n+const ADDRESS_TYPES = ['work', 'home', 'other'];\n+\n+const addressFormSelector = createSelector(\n+  state => state.contactReducer.contactDetailFormsById,\n+  state => state.router.currentParams.contactId,\n+  (contactDetailState, contactId) => {\n+    if (!!contactDetailState[contactId] && contactDetailState[contactId].addressForm) {\n+      return contactDetailState[contactId].addressForm;\n+    }\n+\n+    return {};\n+  }\n+);\n+\n+export class AddContactDetailFormController {\n+  constructor($scope, $ngRedux, ContactsActions) {\n+    'ngInject';\n+    this.$ngRedux = $ngRedux;\n+    this.ContactsActions = ContactsActions;\n+\n+    $scope.$on('$destroy', $ngRedux.connect(addressFormSelector)(this));\n+\n+    this.contactDetailTypes = ADDRESS_TYPES;\n+    this.loading = false;\n+    this.errors = [];\n+    this.contactDetail = { };\n+  }\n+\n+  addContactDetail() {\n+    this.$ngRedux.dispatch(\n+      this.ContactsActions.addContactDetail(this.contact.contact_id, 'address', this.contactDetail)\n+    );\n+  }\n+}\n+\n+export const AddAddressFormComponent = {\n+  bindings: {\n+    contact: '<',\n+  },\n+  controller: AddContactDetailFormController,\n+  /* eslint-disable max-len */\n+  template: `\n+    <form ng-submit=\"$ctrl.addContactDetail()\"\n+      class=\"form-inline\" name=\"address_form\">\n+      <span class=\"co-text-list__item__icon fa fa-map-marker\"></span>\n+      <div class=\"form-group\">\n+        <label for=\"address_form_street\" class=\"_sr-only\">{{ 'contact.address_form.street.label'|translate }}</label>\n+        <input ng-model=\"$ctrl.contactDetail.street\" type=\"text\" class=\"co-text-field\" id=\"address_form_street\" />\n+      </div>\n+      <div class=\"form-group\">\n+        <label for=\"address_form_postal_code\" class=\"_sr-only\">{{ 'contact.address_form.postal_code.label'|translate }}</label>\n+        <input ng-model=\"$ctrl.contactDetail.postal_code\" type=\"text\" class=\"co-text-field\" id=\"address_form_postal_code\" />\n+      </div>\n+      <div class=\"form-group\">\n+        <label for=\"address_form_city\" class=\"_sr-only\">{{ 'contact.address_form.city.label'|translate }}</label>\n+        <input ng-model=\"$ctrl.contactDetail.city\" type=\"text\" class=\"co-text-field\" id=\"address_form_city\" />\n+      </div>\n+      <div class=\"form-group\">\n+        <label for=\"address_form_country\" class=\"_sr-only\">{{ 'contact.address_form.country.label'|translate }}</label>\n+        <input ng-model=\"$ctrl.contactDetail.country\" type=\"text\" class=\"co-text-field\" id=\"address_form_country\" />\n+      </div>\n+      <div class=\"form-group\">\n+        <label for=\"address_form_region\" class=\"_sr-only\">{{ 'contact.address_form.region.label'|translate }}</label>\n+        <input ng-model=\"$ctrl.contactDetail.region\" type=\"text\" class=\"co-text-field\" id=\"address_form_region\" />\n+      </div>\n+      <div class=\"form-group\">\n+        <label for=\"address_form_type\" class=\"_sr-only\">{{ 'contact.address_form.type.label'|translate }}</label>\n+        <select ng-model=\"$ctrl.contactDetail.type\"\n+          ng-options=\"('contact.address_type.' + contactDetailType)|translate for contactDetailType in $ctrl.contactDetailTypes\"\n+          required=\"required\"\n+          class=\"co-text-field\" id=\"address_form_type\">\n+        </select>\n+      </div>\n+      <div class=\"form-group\">\n+        <button type=\"submit\" class=\"btn btn-primary\">{{ 'contact.action.add_contact_detail'|translate}}</button>\n+      </div>\n+    </form>\n+    <div ng-if=\"$ctrl.errors.length > 0\" class=\"alert alert-danger\">\n+      <p ng-repeat=\"error in $ctrl.errors\">{{ error.description }}</p>\n+    </div>\n+  `,","path":"src/js/directive/contact/add-address-form.js","position":83,"original_position":83,"commit_id":"a6eb4733151345215b3d1747cec723c4e7cbf4d6","original_commit_id":"a6eb4733151345215b3d1747cec723c4e7cbf4d6","user":{"login":"iamdey","id":65737,"avatar_url":"https://avatars.githubusercontent.com/u/65737?v=3","gravatar_id":"","url":"https://api.github.com/users/iamdey","html_url":"https://github.com/iamdey","followers_url":"https://api.github.com/users/iamdey/followers","following_url":"https://api.github.com/users/iamdey/following{/other_user}","gists_url":"https://api.github.com/users/iamdey/gists{/gist_id}","starred_url":"https://api.github.com/users/iamdey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamdey/subscriptions","organizations_url":"https://api.github.com/users/iamdey/orgs","repos_url":"https://api.github.com/users/iamdey/repos","events_url":"https://api.github.com/users/iamdey/events{/privacy}","received_events_url":"https://api.github.com/users/iamdey/received_events","type":"User","site_admin":false},"body":"you right. \r\nmay be it can be omitted since the eslint annotations  are scoped by file (I have to check) and template should be the last property declared.","created_at":"2016-04-21T11:44:58Z","updated_at":"2016-04-21T11:44:58Z","html_url":"https://github.com/CaliOpen/caliopen.web-client-ng/pull/67#discussion_r60566535","pull_request_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls/comments/60566535"},"html":{"href":"https://github.com/CaliOpen/caliopen.web-client-ng/pull/67#discussion_r60566535"},"pull_request":{"href":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls/67","id":66496992,"html_url":"https://github.com/CaliOpen/caliopen.web-client-ng/pull/67","diff_url":"https://github.com/CaliOpen/caliopen.web-client-ng/pull/67.diff","patch_url":"https://github.com/CaliOpen/caliopen.web-client-ng/pull/67.patch","issue_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/issues/67","number":67,"state":"open","locked":false,"title":"feat(contact): add and remove contact details","user":{"login":"iamdey","id":65737,"avatar_url":"https://avatars.githubusercontent.com/u/65737?v=3","gravatar_id":"","url":"https://api.github.com/users/iamdey","html_url":"https://github.com/iamdey","followers_url":"https://api.github.com/users/iamdey/followers","following_url":"https://api.github.com/users/iamdey/following{/other_user}","gists_url":"https://api.github.com/users/iamdey/gists{/gist_id}","starred_url":"https://api.github.com/users/iamdey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamdey/subscriptions","organizations_url":"https://api.github.com/users/iamdey/orgs","repos_url":"https://api.github.com/users/iamdey/repos","events_url":"https://api.github.com/users/iamdey/events{/privacy}","received_events_url":"https://api.github.com/users/iamdey/received_events","type":"User","site_admin":false},"body":"## TODO:\r\n\r\n* [x] add email\r\n* [x] add postal address\r\n* [x] add ims\r\n* [ ] ~~add phone~~ (no api available)\r\n* [x] remove contact detail\r\n* [x] unit tests/functional\r\n* [x] not so much ugly UI\r\n\r\n![capture du 2016-04-15 16 38 15](https://cloud.githubusercontent.com/assets/65737/14564815/83a0a8fc-0328-11e6-8ebc-0e524916190f.png)\r\n\r\n## Pending:\r\n\r\n* [ ] unable to remove contact detail CaliOpen/Caliopen#18\r\n* [ ] unable to see postal address added CaliOpen/Caliopen#19","created_at":"2016-04-14T14:47:11Z","updated_at":"2016-04-21T11:44:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f1df71ab8e34bf65403e4eda4d9e824e7af789f5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls/67/commits","review_comments_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls/67/comments","review_comment_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/issues/67/comments","statuses_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/statuses/a6eb4733151345215b3d1747cec723c4e7cbf4d6","head":{"label":"CaliOpen:feat/edit_contact_details","ref":"feat/edit_contact_details","sha":"a6eb4733151345215b3d1747cec723c4e7cbf4d6","user":{"login":"CaliOpen","id":6907275,"avatar_url":"https://avatars.githubusercontent.com/u/6907275?v=3","gravatar_id":"","url":"https://api.github.com/users/CaliOpen","html_url":"https://github.com/CaliOpen","followers_url":"https://api.github.com/users/CaliOpen/followers","following_url":"https://api.github.com/users/CaliOpen/following{/other_user}","gists_url":"https://api.github.com/users/CaliOpen/gists{/gist_id}","starred_url":"https://api.github.com/users/CaliOpen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CaliOpen/subscriptions","organizations_url":"https://api.github.com/users/CaliOpen/orgs","repos_url":"https://api.github.com/users/CaliOpen/repos","events_url":"https://api.github.com/users/CaliOpen/events{/privacy}","received_events_url":"https://api.github.com/users/CaliOpen/received_events","type":"Organization","site_admin":false},"repo":{"id":47052900,"name":"caliopen.web-client-ng","full_name":"CaliOpen/caliopen.web-client-ng","owner":{"login":"CaliOpen","id":6907275,"avatar_url":"https://avatars.githubusercontent.com/u/6907275?v=3","gravatar_id":"","url":"https://api.github.com/users/CaliOpen","html_url":"https://github.com/CaliOpen","followers_url":"https://api.github.com/users/CaliOpen/followers","following_url":"https://api.github.com/users/CaliOpen/following{/other_user}","gists_url":"https://api.github.com/users/CaliOpen/gists{/gist_id}","starred_url":"https://api.github.com/users/CaliOpen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CaliOpen/subscriptions","organizations_url":"https://api.github.com/users/CaliOpen/orgs","repos_url":"https://api.github.com/users/CaliOpen/repos","events_url":"https://api.github.com/users/CaliOpen/events{/privacy}","received_events_url":"https://api.github.com/users/CaliOpen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CaliOpen/caliopen.web-client-ng","description":"Caliopen angular web client","fork":false,"url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng","forks_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/forks","keys_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/teams","hooks_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/hooks","issue_events_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/issues/events{/number}","events_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/events","assignees_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/assignees{/user}","branches_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/branches{/branch}","tags_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/tags","blobs_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/git/refs{/sha}","trees_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/statuses/{sha}","languages_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/languages","stargazers_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/stargazers","contributors_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/contributors","subscribers_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/subscribers","subscription_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/subscription","commits_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/commits{/sha}","git_commits_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/git/commits{/sha}","comments_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/comments{/number}","issue_comment_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/issues/comments{/number}","contents_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/contents/{+path}","compare_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/merges","archive_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/downloads","issues_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/issues{/number}","pulls_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls{/number}","milestones_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/milestones{/number}","notifications_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/labels{/name}","releases_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/releases{/id}","deployments_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/deployments","created_at":"2015-11-29T06:34:35Z","updated_at":"2016-03-24T11:32:46Z","pushed_at":"2016-04-21T09:07:00Z","git_url":"git://github.com/CaliOpen/caliopen.web-client-ng.git","ssh_url":"git@github.com:CaliOpen/caliopen.web-client-ng.git","clone_url":"https://github.com/CaliOpen/caliopen.web-client-ng.git","svn_url":"https://github.com/CaliOpen/caliopen.web-client-ng","homepage":null,"size":342,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":4,"default_branch":"master"}},"base":{"label":"CaliOpen:master","ref":"master","sha":"8bdf9e3947d44717bd258c9c6e25d16096761d2c","user":{"login":"CaliOpen","id":6907275,"avatar_url":"https://avatars.githubusercontent.com/u/6907275?v=3","gravatar_id":"","url":"https://api.github.com/users/CaliOpen","html_url":"https://github.com/CaliOpen","followers_url":"https://api.github.com/users/CaliOpen/followers","following_url":"https://api.github.com/users/CaliOpen/following{/other_user}","gists_url":"https://api.github.com/users/CaliOpen/gists{/gist_id}","starred_url":"https://api.github.com/users/CaliOpen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CaliOpen/subscriptions","organizations_url":"https://api.github.com/users/CaliOpen/orgs","repos_url":"https://api.github.com/users/CaliOpen/repos","events_url":"https://api.github.com/users/CaliOpen/events{/privacy}","received_events_url":"https://api.github.com/users/CaliOpen/received_events","type":"Organization","site_admin":false},"repo":{"id":47052900,"name":"caliopen.web-client-ng","full_name":"CaliOpen/caliopen.web-client-ng","owner":{"login":"CaliOpen","id":6907275,"avatar_url":"https://avatars.githubusercontent.com/u/6907275?v=3","gravatar_id":"","url":"https://api.github.com/users/CaliOpen","html_url":"https://github.com/CaliOpen","followers_url":"https://api.github.com/users/CaliOpen/followers","following_url":"https://api.github.com/users/CaliOpen/following{/other_user}","gists_url":"https://api.github.com/users/CaliOpen/gists{/gist_id}","starred_url":"https://api.github.com/users/CaliOpen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CaliOpen/subscriptions","organizations_url":"https://api.github.com/users/CaliOpen/orgs","repos_url":"https://api.github.com/users/CaliOpen/repos","events_url":"https://api.github.com/users/CaliOpen/events{/privacy}","received_events_url":"https://api.github.com/users/CaliOpen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CaliOpen/caliopen.web-client-ng","description":"Caliopen angular web client","fork":false,"url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng","forks_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/forks","keys_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/teams","hooks_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/hooks","issue_events_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/issues/events{/number}","events_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/events","assignees_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/assignees{/user}","branches_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/branches{/branch}","tags_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/tags","blobs_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/git/refs{/sha}","trees_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/statuses/{sha}","languages_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/languages","stargazers_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/stargazers","contributors_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/contributors","subscribers_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/subscribers","subscription_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/subscription","commits_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/commits{/sha}","git_commits_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/git/commits{/sha}","comments_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/comments{/number}","issue_comment_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/issues/comments{/number}","contents_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/contents/{+path}","compare_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/merges","archive_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/downloads","issues_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/issues{/number}","pulls_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls{/number}","milestones_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/milestones{/number}","notifications_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/labels{/name}","releases_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/releases{/id}","deployments_url":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/deployments","created_at":"2015-11-29T06:34:35Z","updated_at":"2016-03-24T11:32:46Z","pushed_at":"2016-04-21T09:07:00Z","git_url":"git://github.com/CaliOpen/caliopen.web-client-ng.git","ssh_url":"git@github.com:CaliOpen/caliopen.web-client-ng.git","clone_url":"https://github.com/CaliOpen/caliopen.web-client-ng.git","svn_url":"https://github.com/CaliOpen/caliopen.web-client-ng","homepage":null,"size":342,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls/67"},"html":{"href":"https://github.com/CaliOpen/caliopen.web-client-ng/pull/67"},"issue":{"href":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/issues/67"},"comments":{"href":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/CaliOpen/caliopen.web-client-ng/statuses/a6eb4733151345215b3d1747cec723c4e7cbf4d6"}}}}