{"action":"created","comment":{"url":"https://api.github.com/repos/hwdtech/smartforms/pulls/comments/65709035","id":65709035,"diff_hunk":"@@ -19,12 +20,58 @@ export default class Block {\n   }\n \n   afterRender() {\n+    if (!Array.isArray(this.config.validationRules)) {\n+      return;\n+    }\n+\n+    this.compiledRules = this.config.validationRules.map(rule => Object.assign({\n+      compiledRule: parser.parse(rule.rule)\n+    }, rule));\n+  }\n+\n+  get context() {\n+    let parent = this.parent;\n+\n+    while (parent && null !== parent.parent) {\n+      parent = parent.parent;\n+    }\n+\n+    return Object.assign({ fieldName: this.name }, parent && parent.value || this.value);\n   }\n \n   validate() {\n+    if (this.compiledRules && !this.checkCompiledRules()) {\n+      return false;\n+    }\n+    this.popover('destroy');\n+    this._popoverExist = false;\n+\n+    return true;\n+  }\n+\n+  checkCompiledRules() {\n+    const invalidRule = this.compiledRules.find(rule => !rule.compiledRule.eval(this.context));\n+\n+    if (invalidRule) {","path":"frontend/blocks/base/base.js","position":44,"original_position":44,"commit_id":"77f9912398e993557f9d6fd5d1d14c3a300b77d1","original_commit_id":"77f9912398e993557f9d6fd5d1d14c3a300b77d1","user":{"login":"mvahrameev","id":9433543,"avatar_url":"https://avatars.githubusercontent.com/u/9433543?v=3","gravatar_id":"","url":"https://api.github.com/users/mvahrameev","html_url":"https://github.com/mvahrameev","followers_url":"https://api.github.com/users/mvahrameev/followers","following_url":"https://api.github.com/users/mvahrameev/following{/other_user}","gists_url":"https://api.github.com/users/mvahrameev/gists{/gist_id}","starred_url":"https://api.github.com/users/mvahrameev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvahrameev/subscriptions","organizations_url":"https://api.github.com/users/mvahrameev/orgs","repos_url":"https://api.github.com/users/mvahrameev/repos","events_url":"https://api.github.com/users/mvahrameev/events{/privacy}","received_events_url":"https://api.github.com/users/mvahrameev/received_events","type":"User","site_admin":false},"body":"early return","created_at":"2016-06-03T13:45:53Z","updated_at":"2016-06-03T13:45:53Z","html_url":"https://github.com/hwdtech/smartforms/pull/71#discussion_r65709035","pull_request_url":"https://api.github.com/repos/hwdtech/smartforms/pulls/71","_links":{"self":{"href":"https://api.github.com/repos/hwdtech/smartforms/pulls/comments/65709035"},"html":{"href":"https://github.com/hwdtech/smartforms/pull/71#discussion_r65709035"},"pull_request":{"href":"https://api.github.com/repos/hwdtech/smartforms/pulls/71"}}},"pull_request":{"url":"https://api.github.com/repos/hwdtech/smartforms/pulls/71","id":72485692,"html_url":"https://github.com/hwdtech/smartforms/pull/71","diff_url":"https://github.com/hwdtech/smartforms/pull/71.diff","patch_url":"https://github.com/hwdtech/smartforms/pull/71.patch","issue_url":"https://api.github.com/repos/hwdtech/smartforms/issues/71","number":71,"state":"open","locked":false,"title":"Base validation","user":{"login":"IgorZiegler","id":10164848,"avatar_url":"https://avatars.githubusercontent.com/u/10164848?v=3","gravatar_id":"","url":"https://api.github.com/users/IgorZiegler","html_url":"https://github.com/IgorZiegler","followers_url":"https://api.github.com/users/IgorZiegler/followers","following_url":"https://api.github.com/users/IgorZiegler/following{/other_user}","gists_url":"https://api.github.com/users/IgorZiegler/gists{/gist_id}","starred_url":"https://api.github.com/users/IgorZiegler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IgorZiegler/subscriptions","organizations_url":"https://api.github.com/users/IgorZiegler/orgs","repos_url":"https://api.github.com/users/IgorZiegler/repos","events_url":"https://api.github.com/users/IgorZiegler/events{/privacy}","received_events_url":"https://api.github.com/users/IgorZiegler/received_events","type":"User","site_admin":false},"body":"- Add base validation which parse all validation rules in afterrender function and compiled it in validate function.\r\n - Add rules registration module which returns new parser with registered functions and properties\r\n - Add examples of validation rules in text.json \r\n - Added base popover logic\r\n - If you want to add popover to specific element just redefine get popoverEl method for your block\r\n - Redefine popoverEl Method for input","created_at":"2016-06-03T10:25:47Z","updated_at":"2016-06-03T13:45:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"808787d1fa24fc9dcfda0b877ac9e05c792e0ee7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hwdtech/smartforms/pulls/71/commits","review_comments_url":"https://api.github.com/repos/hwdtech/smartforms/pulls/71/comments","review_comment_url":"https://api.github.com/repos/hwdtech/smartforms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hwdtech/smartforms/issues/71/comments","statuses_url":"https://api.github.com/repos/hwdtech/smartforms/statuses/77f9912398e993557f9d6fd5d1d14c3a300b77d1","head":{"label":"hwdtech:60-base-validation","ref":"60-base-validation","sha":"77f9912398e993557f9d6fd5d1d14c3a300b77d1","user":{"login":"hwdtech","id":9063089,"avatar_url":"https://avatars.githubusercontent.com/u/9063089?v=3","gravatar_id":"","url":"https://api.github.com/users/hwdtech","html_url":"https://github.com/hwdtech","followers_url":"https://api.github.com/users/hwdtech/followers","following_url":"https://api.github.com/users/hwdtech/following{/other_user}","gists_url":"https://api.github.com/users/hwdtech/gists{/gist_id}","starred_url":"https://api.github.com/users/hwdtech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwdtech/subscriptions","organizations_url":"https://api.github.com/users/hwdtech/orgs","repos_url":"https://api.github.com/users/hwdtech/repos","events_url":"https://api.github.com/users/hwdtech/events{/privacy}","received_events_url":"https://api.github.com/users/hwdtech/received_events","type":"Organization","site_admin":false},"repo":{"id":58731799,"name":"smartforms","full_name":"hwdtech/smartforms","owner":{"login":"hwdtech","id":9063089,"avatar_url":"https://avatars.githubusercontent.com/u/9063089?v=3","gravatar_id":"","url":"https://api.github.com/users/hwdtech","html_url":"https://github.com/hwdtech","followers_url":"https://api.github.com/users/hwdtech/followers","following_url":"https://api.github.com/users/hwdtech/following{/other_user}","gists_url":"https://api.github.com/users/hwdtech/gists{/gist_id}","starred_url":"https://api.github.com/users/hwdtech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwdtech/subscriptions","organizations_url":"https://api.github.com/users/hwdtech/orgs","repos_url":"https://api.github.com/users/hwdtech/repos","events_url":"https://api.github.com/users/hwdtech/events{/privacy}","received_events_url":"https://api.github.com/users/hwdtech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hwdtech/smartforms","description":"","fork":false,"url":"https://api.github.com/repos/hwdtech/smartforms","forks_url":"https://api.github.com/repos/hwdtech/smartforms/forks","keys_url":"https://api.github.com/repos/hwdtech/smartforms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hwdtech/smartforms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hwdtech/smartforms/teams","hooks_url":"https://api.github.com/repos/hwdtech/smartforms/hooks","issue_events_url":"https://api.github.com/repos/hwdtech/smartforms/issues/events{/number}","events_url":"https://api.github.com/repos/hwdtech/smartforms/events","assignees_url":"https://api.github.com/repos/hwdtech/smartforms/assignees{/user}","branches_url":"https://api.github.com/repos/hwdtech/smartforms/branches{/branch}","tags_url":"https://api.github.com/repos/hwdtech/smartforms/tags","blobs_url":"https://api.github.com/repos/hwdtech/smartforms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hwdtech/smartforms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hwdtech/smartforms/git/refs{/sha}","trees_url":"https://api.github.com/repos/hwdtech/smartforms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hwdtech/smartforms/statuses/{sha}","languages_url":"https://api.github.com/repos/hwdtech/smartforms/languages","stargazers_url":"https://api.github.com/repos/hwdtech/smartforms/stargazers","contributors_url":"https://api.github.com/repos/hwdtech/smartforms/contributors","subscribers_url":"https://api.github.com/repos/hwdtech/smartforms/subscribers","subscription_url":"https://api.github.com/repos/hwdtech/smartforms/subscription","commits_url":"https://api.github.com/repos/hwdtech/smartforms/commits{/sha}","git_commits_url":"https://api.github.com/repos/hwdtech/smartforms/git/commits{/sha}","comments_url":"https://api.github.com/repos/hwdtech/smartforms/comments{/number}","issue_comment_url":"https://api.github.com/repos/hwdtech/smartforms/issues/comments{/number}","contents_url":"https://api.github.com/repos/hwdtech/smartforms/contents/{+path}","compare_url":"https://api.github.com/repos/hwdtech/smartforms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hwdtech/smartforms/merges","archive_url":"https://api.github.com/repos/hwdtech/smartforms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hwdtech/smartforms/downloads","issues_url":"https://api.github.com/repos/hwdtech/smartforms/issues{/number}","pulls_url":"https://api.github.com/repos/hwdtech/smartforms/pulls{/number}","milestones_url":"https://api.github.com/repos/hwdtech/smartforms/milestones{/number}","notifications_url":"https://api.github.com/repos/hwdtech/smartforms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hwdtech/smartforms/labels{/name}","releases_url":"https://api.github.com/repos/hwdtech/smartforms/releases{/id}","deployments_url":"https://api.github.com/repos/hwdtech/smartforms/deployments","created_at":"2016-05-13T11:02:39Z","updated_at":"2016-05-25T14:50:51Z","pushed_at":"2016-06-03T13:42:13Z","git_url":"git://github.com/hwdtech/smartforms.git","ssh_url":"git@github.com:hwdtech/smartforms.git","clone_url":"https://github.com/hwdtech/smartforms.git","svn_url":"https://github.com/hwdtech/smartforms","homepage":null,"size":1024,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":10,"forks":2,"open_issues":10,"watchers":3,"default_branch":"master"}},"base":{"label":"hwdtech:master","ref":"master","sha":"d3e9b41aa86141cece984159de04767d0d79864a","user":{"login":"hwdtech","id":9063089,"avatar_url":"https://avatars.githubusercontent.com/u/9063089?v=3","gravatar_id":"","url":"https://api.github.com/users/hwdtech","html_url":"https://github.com/hwdtech","followers_url":"https://api.github.com/users/hwdtech/followers","following_url":"https://api.github.com/users/hwdtech/following{/other_user}","gists_url":"https://api.github.com/users/hwdtech/gists{/gist_id}","starred_url":"https://api.github.com/users/hwdtech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwdtech/subscriptions","organizations_url":"https://api.github.com/users/hwdtech/orgs","repos_url":"https://api.github.com/users/hwdtech/repos","events_url":"https://api.github.com/users/hwdtech/events{/privacy}","received_events_url":"https://api.github.com/users/hwdtech/received_events","type":"Organization","site_admin":false},"repo":{"id":58731799,"name":"smartforms","full_name":"hwdtech/smartforms","owner":{"login":"hwdtech","id":9063089,"avatar_url":"https://avatars.githubusercontent.com/u/9063089?v=3","gravatar_id":"","url":"https://api.github.com/users/hwdtech","html_url":"https://github.com/hwdtech","followers_url":"https://api.github.com/users/hwdtech/followers","following_url":"https://api.github.com/users/hwdtech/following{/other_user}","gists_url":"https://api.github.com/users/hwdtech/gists{/gist_id}","starred_url":"https://api.github.com/users/hwdtech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwdtech/subscriptions","organizations_url":"https://api.github.com/users/hwdtech/orgs","repos_url":"https://api.github.com/users/hwdtech/repos","events_url":"https://api.github.com/users/hwdtech/events{/privacy}","received_events_url":"https://api.github.com/users/hwdtech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hwdtech/smartforms","description":"","fork":false,"url":"https://api.github.com/repos/hwdtech/smartforms","forks_url":"https://api.github.com/repos/hwdtech/smartforms/forks","keys_url":"https://api.github.com/repos/hwdtech/smartforms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hwdtech/smartforms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hwdtech/smartforms/teams","hooks_url":"https://api.github.com/repos/hwdtech/smartforms/hooks","issue_events_url":"https://api.github.com/repos/hwdtech/smartforms/issues/events{/number}","events_url":"https://api.github.com/repos/hwdtech/smartforms/events","assignees_url":"https://api.github.com/repos/hwdtech/smartforms/assignees{/user}","branches_url":"https://api.github.com/repos/hwdtech/smartforms/branches{/branch}","tags_url":"https://api.github.com/repos/hwdtech/smartforms/tags","blobs_url":"https://api.github.com/repos/hwdtech/smartforms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hwdtech/smartforms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hwdtech/smartforms/git/refs{/sha}","trees_url":"https://api.github.com/repos/hwdtech/smartforms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hwdtech/smartforms/statuses/{sha}","languages_url":"https://api.github.com/repos/hwdtech/smartforms/languages","stargazers_url":"https://api.github.com/repos/hwdtech/smartforms/stargazers","contributors_url":"https://api.github.com/repos/hwdtech/smartforms/contributors","subscribers_url":"https://api.github.com/repos/hwdtech/smartforms/subscribers","subscription_url":"https://api.github.com/repos/hwdtech/smartforms/subscription","commits_url":"https://api.github.com/repos/hwdtech/smartforms/commits{/sha}","git_commits_url":"https://api.github.com/repos/hwdtech/smartforms/git/commits{/sha}","comments_url":"https://api.github.com/repos/hwdtech/smartforms/comments{/number}","issue_comment_url":"https://api.github.com/repos/hwdtech/smartforms/issues/comments{/number}","contents_url":"https://api.github.com/repos/hwdtech/smartforms/contents/{+path}","compare_url":"https://api.github.com/repos/hwdtech/smartforms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hwdtech/smartforms/merges","archive_url":"https://api.github.com/repos/hwdtech/smartforms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hwdtech/smartforms/downloads","issues_url":"https://api.github.com/repos/hwdtech/smartforms/issues{/number}","pulls_url":"https://api.github.com/repos/hwdtech/smartforms/pulls{/number}","milestones_url":"https://api.github.com/repos/hwdtech/smartforms/milestones{/number}","notifications_url":"https://api.github.com/repos/hwdtech/smartforms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hwdtech/smartforms/labels{/name}","releases_url":"https://api.github.com/repos/hwdtech/smartforms/releases{/id}","deployments_url":"https://api.github.com/repos/hwdtech/smartforms/deployments","created_at":"2016-05-13T11:02:39Z","updated_at":"2016-05-25T14:50:51Z","pushed_at":"2016-06-03T13:42:13Z","git_url":"git://github.com/hwdtech/smartforms.git","ssh_url":"git@github.com:hwdtech/smartforms.git","clone_url":"https://github.com/hwdtech/smartforms.git","svn_url":"https://github.com/hwdtech/smartforms","homepage":null,"size":1024,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":10,"forks":2,"open_issues":10,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hwdtech/smartforms/pulls/71"},"html":{"href":"https://github.com/hwdtech/smartforms/pull/71"},"issue":{"href":"https://api.github.com/repos/hwdtech/smartforms/issues/71"},"comments":{"href":"https://api.github.com/repos/hwdtech/smartforms/issues/71/comments"},"review_comments":{"href":"https://api.github.com/repos/hwdtech/smartforms/pulls/71/comments"},"review_comment":{"href":"https://api.github.com/repos/hwdtech/smartforms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hwdtech/smartforms/pulls/71/commits"},"statuses":{"href":"https://api.github.com/repos/hwdtech/smartforms/statuses/77f9912398e993557f9d6fd5d1d14c3a300b77d1"}}}}
{"actor":{"display_login":"mvahrameev"}}