{"action":"created","comment":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/comments/140757602","pull_request_review_id":64874604,"id":140757602,"diff_hunk":"@@ -1,35 +1,88 @@\n-define([], function () {\n+/* eslint-env amd */\n+\n+define([\n+  'common/moment'\n+], function (moment) {\n   'use strict';\n \n   /**\n    * Decorates the uib-datepicker-popup directive, making its sibling '.input-group-addon'\n    * trigger the datepicker\n    */\n-  return ['$delegate', function ($delegate) {\n+  return ['$delegate', '$compile', function ($delegate, $compile) {\n     var directive = $delegate[0];\n+    var isMobile = document.getElementsByTagName('body')[0].classList.contains('mobile');\n     var origCompile = directive.compile;\n+    var calendarIcon = '<span ' +\n+      'class=\"input-group-addon pointer\">' +\n+      '<i class=\"fa fa-calendar\"></i>' +\n+      '</span>';\n \n-    directive.compile = function compile() {\n-      var link = origCompile.apply(this, arguments);\n+    if (isMobile) {\n+      directive.require = 'ngModel';\n+      directive.compile = function compile () {\n+        return function (scope, element, attrs, ngModel) {\n+          element.parent('.input-group').css('display', 'block');\n+          element.prop('type', 'date');\n+          attrs.ngReadonly = false;\n \n-      return function (scope, element) {\n-        link.apply(this, arguments);\n+          handleCalendarIconandEvent(scope, element, attrs);\n \n-        function onClick() {\n-          element.trigger('click');\n-        }\n+          ngModel.$formatters.push(function (viewValue) {\n+            return convertToHTML5DatepickerFormat(viewValue);\n+          });\n+\n+          scope.$watch('datepickerOptions.minDate', function (value) {\n+            attrs.$set('min', convertToHTML5DatepickerFormat(value));\n+          });\n+          scope.$watch('datepickerOptions.maxDate', function (value) {\n+            attrs.$set('max', convertToHTML5DatepickerFormat(value));\n+          });\n+        };\n+      };\n+    } else {\n+      directive.compile = function compile () {\n+        var link = origCompile.apply(this, arguments);\n+\n+        return function (scope, element, attrs) {\n+          handleCalendarIconandEvent(scope, element, attrs);\n+\n+          link.apply(this, arguments);\n+        };\n+      };\n+    }\n+\n+    function convertToHTML5DatepickerFormat (date) {\n+      return date ? moment(date).format('Y-MM-DD') : '';\n+    }\n+\n+    function handleCalendarIconandEvent (scope, element, attrs) {","path":"org.civicrm.reqangular/src/common/decorators/angular-date/datepicker-addon.js","position":68,"original_position":68,"commit_id":"afa4d71a4cbe59b5dbd3e48d0250402a0672f498","original_commit_id":"afa4d71a4cbe59b5dbd3e48d0250402a0672f498","user":{"login":"deb1990","id":5058867,"avatar_url":"https://avatars1.githubusercontent.com/u/5058867?v=4","gravatar_id":"","url":"https://api.github.com/users/deb1990","html_url":"https://github.com/deb1990","followers_url":"https://api.github.com/users/deb1990/followers","following_url":"https://api.github.com/users/deb1990/following{/other_user}","gists_url":"https://api.github.com/users/deb1990/gists{/gist_id}","starred_url":"https://api.github.com/users/deb1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deb1990/subscriptions","organizations_url":"https://api.github.com/users/deb1990/orgs","repos_url":"https://api.github.com/users/deb1990/repos","events_url":"https://api.github.com/users/deb1990/events{/privacy}","received_events_url":"https://api.github.com/users/deb1990/received_events","type":"User","site_admin":false},"body":"After re organizing the code, it does not exist anymore.","created_at":"2017-09-25T12:09:10Z","updated_at":"2017-09-25T12:09:10Z","html_url":"https://github.com/civicrm/civihr/pull/2154#discussion_r140757602","pull_request_url":"https://api.github.com/repos/civicrm/civihr/pulls/2154","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments/140757602"},"html":{"href":"https://github.com/civicrm/civihr/pull/2154#discussion_r140757602"},"pull_request":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/2154"}},"in_reply_to_id":140729056},"pull_request":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/2154","id":142053565,"html_url":"https://github.com/civicrm/civihr/pull/2154","diff_url":"https://github.com/civicrm/civihr/pull/2154.diff","patch_url":"https://github.com/civicrm/civihr/pull/2154.patch","issue_url":"https://api.github.com/repos/civicrm/civihr/issues/2154","number":2154,"state":"open","locked":false,"title":"PCHR-2593: Decorate UIB-DatePicker-Popup","user":{"login":"deb1990","id":5058867,"avatar_url":"https://avatars1.githubusercontent.com/u/5058867?v=4","gravatar_id":"","url":"https://api.github.com/users/deb1990","html_url":"https://github.com/deb1990","followers_url":"https://api.github.com/users/deb1990/followers","following_url":"https://api.github.com/users/deb1990/following{/other_user}","gists_url":"https://api.github.com/users/deb1990/gists{/gist_id}","starred_url":"https://api.github.com/users/deb1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deb1990/subscriptions","organizations_url":"https://api.github.com/users/deb1990/orgs","repos_url":"https://api.github.com/users/deb1990/repos","events_url":"https://api.github.com/users/deb1990/events{/privacy}","received_events_url":"https://api.github.com/users/deb1990/received_events","type":"User","site_admin":false},"body":"## Overview\r\nAs part of this PR, the Date Picker component has been removed, and the same functionality has been implemented by decorating `uib-datepicker-popup` directive.\r\n\r\n## Screencast\r\n![2642d](https://user-images.githubusercontent.com/5058867/30796714-efa55bd4-a1f0-11e7-843a-191db51cf2f9.gif)\r\n\r\n## Technical Details\r\n### Datepicker Component\r\n`uib-datepicker-popup` has been decorated in `datepicker-addon.js`, to switch to native HTML5 datepicker in mobile devices.\r\n\r\n**Mobile Device Detection**\r\n```js\r\nvar isMobile = document.getElementsByTagName('body')[0].classList.contains('mobile')\r\n```\r\n\r\n**Switching to HTML5 Datepicker**\r\n```js\r\nelement.prop('type', 'date');\r\n```\r\n\r\n**Clicking on the Input opens the datepicker**\r\n```js\r\nelement.on('click', onClick);\r\nscope.$on('$destroy', function () {\r\n element.off('click', onClick);\r\n});\r\n```\r\n\r\n**Calendar Icon is added by the Directive itself**\r\nIt is configurable using `show-calendar-icon` attribute. So if the calendar icon is not needed the following needs to be passed\r\n```html\r\n<input\r\n uib-datepicker-popup\r\n show-calendar-icon=\"false\">\r\n```\r\nBut it is true by default.\r\n\r\n**Updates in xeditable directive**\r\nXeditable uses `uib-datepicker-popup` internally to show a editable dat field. And it adds a calendar icon when `eShowCalendarButton` is true. As we are adding the same using `uib-datepicker-popup`, a new decorator(`xeditable-addon`) has been created to disable `eShowCalendarButton`.\r\n\r\n### Updates in other Extensions\r\nMarkup has been updated in Jobroles, Job Contract\r\n\r\n## Comments\r\n1.6 Commits needs to be moved to staging once this PR is approved.\r\n\r\n---\r\n\r\n- [x] Tests Pass\r\n","created_at":"2017-09-20T09:40:49Z","updated_at":"2017-09-25T12:09:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"95aaebec011e90304e3df7826a5d97dfa26b24e6","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/civicrm/civihr/pulls/2154/commits","review_comments_url":"https://api.github.com/repos/civicrm/civihr/pulls/2154/comments","review_comment_url":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/civicrm/civihr/issues/2154/comments","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/afa4d71a4cbe59b5dbd3e48d0250402a0672f498","head":{"label":"civicrm:PCHR-2593-native-datepicker-decorator","ref":"PCHR-2593-native-datepicker-decorator","sha":"afa4d71a4cbe59b5dbd3e48d0250402a0672f498","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"repo":{"id":10086903,"name":"civihr","full_name":"civicrm/civihr","owner":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civicrm/civihr","description":"CiviHR","fork":false,"url":"https://api.github.com/repos/civicrm/civihr","forks_url":"https://api.github.com/repos/civicrm/civihr/forks","keys_url":"https://api.github.com/repos/civicrm/civihr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civicrm/civihr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civicrm/civihr/teams","hooks_url":"https://api.github.com/repos/civicrm/civihr/hooks","issue_events_url":"https://api.github.com/repos/civicrm/civihr/issues/events{/number}","events_url":"https://api.github.com/repos/civicrm/civihr/events","assignees_url":"https://api.github.com/repos/civicrm/civihr/assignees{/user}","branches_url":"https://api.github.com/repos/civicrm/civihr/branches{/branch}","tags_url":"https://api.github.com/repos/civicrm/civihr/tags","blobs_url":"https://api.github.com/repos/civicrm/civihr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civicrm/civihr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civicrm/civihr/git/refs{/sha}","trees_url":"https://api.github.com/repos/civicrm/civihr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/{sha}","languages_url":"https://api.github.com/repos/civicrm/civihr/languages","stargazers_url":"https://api.github.com/repos/civicrm/civihr/stargazers","contributors_url":"https://api.github.com/repos/civicrm/civihr/contributors","subscribers_url":"https://api.github.com/repos/civicrm/civihr/subscribers","subscription_url":"https://api.github.com/repos/civicrm/civihr/subscription","commits_url":"https://api.github.com/repos/civicrm/civihr/commits{/sha}","git_commits_url":"https://api.github.com/repos/civicrm/civihr/git/commits{/sha}","comments_url":"https://api.github.com/repos/civicrm/civihr/comments{/number}","issue_comment_url":"https://api.github.com/repos/civicrm/civihr/issues/comments{/number}","contents_url":"https://api.github.com/repos/civicrm/civihr/contents/{+path}","compare_url":"https://api.github.com/repos/civicrm/civihr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civicrm/civihr/merges","archive_url":"https://api.github.com/repos/civicrm/civihr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civicrm/civihr/downloads","issues_url":"https://api.github.com/repos/civicrm/civihr/issues{/number}","pulls_url":"https://api.github.com/repos/civicrm/civihr/pulls{/number}","milestones_url":"https://api.github.com/repos/civicrm/civihr/milestones{/number}","notifications_url":"https://api.github.com/repos/civicrm/civihr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civicrm/civihr/labels{/name}","releases_url":"https://api.github.com/repos/civicrm/civihr/releases{/id}","deployments_url":"https://api.github.com/repos/civicrm/civihr/deployments","created_at":"2013-05-15T20:06:06Z","updated_at":"2017-07-24T09:17:58Z","pushed_at":"2017-09-25T11:51:26Z","git_url":"git://github.com/civicrm/civihr.git","ssh_url":"git@github.com:civicrm/civihr.git","clone_url":"https://github.com/civicrm/civihr.git","svn_url":"https://github.com/civicrm/civihr","homepage":null,"size":52892,"stargazers_count":17,"watchers_count":17,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":18,"forks":34,"open_issues":18,"watchers":17,"default_branch":"staging"}},"base":{"label":"civicrm:la-milestone-3","ref":"la-milestone-3","sha":"bffd95386db944c649f0c53562fcf0983c3dd106","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"repo":{"id":10086903,"name":"civihr","full_name":"civicrm/civihr","owner":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civicrm/civihr","description":"CiviHR","fork":false,"url":"https://api.github.com/repos/civicrm/civihr","forks_url":"https://api.github.com/repos/civicrm/civihr/forks","keys_url":"https://api.github.com/repos/civicrm/civihr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civicrm/civihr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civicrm/civihr/teams","hooks_url":"https://api.github.com/repos/civicrm/civihr/hooks","issue_events_url":"https://api.github.com/repos/civicrm/civihr/issues/events{/number}","events_url":"https://api.github.com/repos/civicrm/civihr/events","assignees_url":"https://api.github.com/repos/civicrm/civihr/assignees{/user}","branches_url":"https://api.github.com/repos/civicrm/civihr/branches{/branch}","tags_url":"https://api.github.com/repos/civicrm/civihr/tags","blobs_url":"https://api.github.com/repos/civicrm/civihr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civicrm/civihr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civicrm/civihr/git/refs{/sha}","trees_url":"https://api.github.com/repos/civicrm/civihr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/{sha}","languages_url":"https://api.github.com/repos/civicrm/civihr/languages","stargazers_url":"https://api.github.com/repos/civicrm/civihr/stargazers","contributors_url":"https://api.github.com/repos/civicrm/civihr/contributors","subscribers_url":"https://api.github.com/repos/civicrm/civihr/subscribers","subscription_url":"https://api.github.com/repos/civicrm/civihr/subscription","commits_url":"https://api.github.com/repos/civicrm/civihr/commits{/sha}","git_commits_url":"https://api.github.com/repos/civicrm/civihr/git/commits{/sha}","comments_url":"https://api.github.com/repos/civicrm/civihr/comments{/number}","issue_comment_url":"https://api.github.com/repos/civicrm/civihr/issues/comments{/number}","contents_url":"https://api.github.com/repos/civicrm/civihr/contents/{+path}","compare_url":"https://api.github.com/repos/civicrm/civihr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civicrm/civihr/merges","archive_url":"https://api.github.com/repos/civicrm/civihr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civicrm/civihr/downloads","issues_url":"https://api.github.com/repos/civicrm/civihr/issues{/number}","pulls_url":"https://api.github.com/repos/civicrm/civihr/pulls{/number}","milestones_url":"https://api.github.com/repos/civicrm/civihr/milestones{/number}","notifications_url":"https://api.github.com/repos/civicrm/civihr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civicrm/civihr/labels{/name}","releases_url":"https://api.github.com/repos/civicrm/civihr/releases{/id}","deployments_url":"https://api.github.com/repos/civicrm/civihr/deployments","created_at":"2013-05-15T20:06:06Z","updated_at":"2017-07-24T09:17:58Z","pushed_at":"2017-09-25T11:51:26Z","git_url":"git://github.com/civicrm/civihr.git","ssh_url":"git@github.com:civicrm/civihr.git","clone_url":"https://github.com/civicrm/civihr.git","svn_url":"https://github.com/civicrm/civihr","homepage":null,"size":52892,"stargazers_count":17,"watchers_count":17,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":18,"forks":34,"open_issues":18,"watchers":17,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/2154"},"html":{"href":"https://github.com/civicrm/civihr/pull/2154"},"issue":{"href":"https://api.github.com/repos/civicrm/civihr/issues/2154"},"comments":{"href":"https://api.github.com/repos/civicrm/civihr/issues/2154/comments"},"review_comments":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/2154/comments"},"review_comment":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/2154/commits"},"statuses":{"href":"https://api.github.com/repos/civicrm/civihr/statuses/afa4d71a4cbe59b5dbd3e48d0250402a0672f498"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"deb1990"}}