{"action":"created","comment":{"url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls/comments/84988368","pull_request_review_id":5730983,"id":84988368,"diff_hunk":"@@ -0,0 +1,53 @@\n+class FloatFieldType < FieldType\n+\n+  attr_accessor :float\n+ \n+  validates_numericality_of :float\n+  validate :less_than, if: :validate_min?\n+  validate :greater_than, if: :validate_max?\n+\n+  def validations=(validations_hash ={})\n+    @validations = validations_hash.deep_symbolize_keys\n+  end\n+\n+  def data=(data_hash)\n+    @float = data_hash.deep_symbolize_keys[:float]\n+  end\n+\n+  def field_item_as_indexed_json_for_field_type(field_item, options = {})\n+    json = {}\n+    json[mapping_field_name] = field_item.data['float']\n+    json\n+  end\n+\n+  def mapping\n+    {name: mapping_field_name, type: :float}\n+  end\n+\n+  private\n+\n+  def mapping_field_name\n+    \"#{field_name.parameterize('_')}_float\"\n+  end\n+\n+  def less_than\n+     errors.add(:float, \"must be less_than #{@validations[:max]}\") if @float <= @validations[:max]\n+  end\n+\n+  def greater_than\n+     errors.add(:float, \"must be greater_than #{@validations[:min]}\") if @float >= @validations[:min]\n+  end\n+\n+  def validate_max?\n+    @validations.key? :max\n+  end\n+\n+  def validate_min?\n+    @validations.key? :min\n+  end\n+  \n+  def valid_presence_validation?","path":"app/models/float_field_type.rb","position":49,"original_position":49,"commit_id":"4b18ad340c7db78b5d207d0be7b652a769545cdf","original_commit_id":"4b18ad340c7db78b5d207d0be7b652a769545cdf","user":{"login":"toastercup","id":1045168,"avatar_url":"https://avatars.githubusercontent.com/u/1045168?v=3","gravatar_id":"","url":"https://api.github.com/users/toastercup","html_url":"https://github.com/toastercup","followers_url":"https://api.github.com/users/toastercup/followers","following_url":"https://api.github.com/users/toastercup/following{/other_user}","gists_url":"https://api.github.com/users/toastercup/gists{/gist_id}","starred_url":"https://api.github.com/users/toastercup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toastercup/subscriptions","organizations_url":"https://api.github.com/users/toastercup/orgs","repos_url":"https://api.github.com/users/toastercup/repos","events_url":"https://api.github.com/users/toastercup/events{/privacy}","received_events_url":"https://api.github.com/users/toastercup/received_events","type":"User","site_admin":false},"body":"There's no validation setup for `presence` (though there probably should be), so this isn't used anywhere, currently.","created_at":"2016-10-25T20:03:44Z","updated_at":"2016-10-25T20:03:44Z","html_url":"https://github.com/cortex-cms/cortex-plugins-core/pull/15#discussion_r84988368","pull_request_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls/comments/84988368"},"html":{"href":"https://github.com/cortex-cms/cortex-plugins-core/pull/15#discussion_r84988368"},"pull_request":{"href":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls/15","id":90879100,"html_url":"https://github.com/cortex-cms/cortex-plugins-core/pull/15","diff_url":"https://github.com/cortex-cms/cortex-plugins-core/pull/15.diff","patch_url":"https://github.com/cortex-cms/cortex-plugins-core/pull/15.patch","issue_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/issues/15","number":15,"state":"open","locked":false,"title":"Numeric Field Types ","user":{"login":"MKwenhua","id":10361180,"avatar_url":"https://avatars.githubusercontent.com/u/10361180?v=3","gravatar_id":"","url":"https://api.github.com/users/MKwenhua","html_url":"https://github.com/MKwenhua","followers_url":"https://api.github.com/users/MKwenhua/followers","following_url":"https://api.github.com/users/MKwenhua/following{/other_user}","gists_url":"https://api.github.com/users/MKwenhua/gists{/gist_id}","starred_url":"https://api.github.com/users/MKwenhua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MKwenhua/subscriptions","organizations_url":"https://api.github.com/users/MKwenhua/orgs","repos_url":"https://api.github.com/users/MKwenhua/repos","events_url":"https://api.github.com/users/MKwenhua/events{/privacy}","received_events_url":"https://api.github.com/users/MKwenhua/received_events","type":"User","site_admin":false},"body":"Here I added a float and numeric field types `FloatFieldType` and `IntegerFieldType`. \r\n\r\n- The branch [numeric-inputs-example](https://github.com/cbdr/cortex/tree/numeric-inputs-example) has two of these field types added to `blog.rake` and I modified `field/show.haml` in the wizard.\r\n","created_at":"2016-10-25T19:52:23Z","updated_at":"2016-10-25T20:05:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8e3fc4d4bff41f668010682a3d4eb78341615958","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls/15/commits","review_comments_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls/15/comments","review_comment_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/issues/15/comments","statuses_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/statuses/4b18ad340c7db78b5d207d0be7b652a769545cdf","head":{"label":"cortex-cms:float-number-fields","ref":"float-number-fields","sha":"4b18ad340c7db78b5d207d0be7b652a769545cdf","user":{"login":"cortex-cms","id":12399718,"avatar_url":"https://avatars.githubusercontent.com/u/12399718?v=3","gravatar_id":"","url":"https://api.github.com/users/cortex-cms","html_url":"https://github.com/cortex-cms","followers_url":"https://api.github.com/users/cortex-cms/followers","following_url":"https://api.github.com/users/cortex-cms/following{/other_user}","gists_url":"https://api.github.com/users/cortex-cms/gists{/gist_id}","starred_url":"https://api.github.com/users/cortex-cms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cortex-cms/subscriptions","organizations_url":"https://api.github.com/users/cortex-cms/orgs","repos_url":"https://api.github.com/users/cortex-cms/repos","events_url":"https://api.github.com/users/cortex-cms/events{/privacy}","received_events_url":"https://api.github.com/users/cortex-cms/received_events","type":"Organization","site_admin":false},"repo":{"id":68278544,"name":"cortex-plugins-core","full_name":"cortex-cms/cortex-plugins-core","owner":{"login":"cortex-cms","id":12399718,"avatar_url":"https://avatars.githubusercontent.com/u/12399718?v=3","gravatar_id":"","url":"https://api.github.com/users/cortex-cms","html_url":"https://github.com/cortex-cms","followers_url":"https://api.github.com/users/cortex-cms/followers","following_url":"https://api.github.com/users/cortex-cms/following{/other_user}","gists_url":"https://api.github.com/users/cortex-cms/gists{/gist_id}","starred_url":"https://api.github.com/users/cortex-cms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cortex-cms/subscriptions","organizations_url":"https://api.github.com/users/cortex-cms/orgs","repos_url":"https://api.github.com/users/cortex-cms/repos","events_url":"https://api.github.com/users/cortex-cms/events{/privacy}","received_events_url":"https://api.github.com/users/cortex-cms/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cortex-cms/cortex-plugins-core","description":"The combined set of core FieldTypes for the Cortex CMS platform","fork":false,"url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core","forks_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/forks","keys_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/teams","hooks_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/hooks","issue_events_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/issues/events{/number}","events_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/events","assignees_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/assignees{/user}","branches_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/branches{/branch}","tags_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/tags","blobs_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/statuses/{sha}","languages_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/languages","stargazers_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/stargazers","contributors_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/contributors","subscribers_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/subscribers","subscription_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/subscription","commits_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/contents/{+path}","compare_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/merges","archive_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/downloads","issues_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/issues{/number}","pulls_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls{/number}","milestones_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/milestones{/number}","notifications_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/labels{/name}","releases_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/releases{/id}","deployments_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/deployments","created_at":"2016-09-15T08:36:33Z","updated_at":"2016-10-24T17:59:26Z","pushed_at":"2016-10-25T19:52:23Z","git_url":"git://github.com/cortex-cms/cortex-plugins-core.git","ssh_url":"git@github.com:cortex-cms/cortex-plugins-core.git","clone_url":"https://github.com/cortex-cms/cortex-plugins-core.git","svn_url":"https://github.com/cortex-cms/cortex-plugins-core","homepage":null,"size":122,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"cortex-cms:develop","ref":"develop","sha":"31a5ae4828d3b5b24775d70932d1751ae2cf4794","user":{"login":"cortex-cms","id":12399718,"avatar_url":"https://avatars.githubusercontent.com/u/12399718?v=3","gravatar_id":"","url":"https://api.github.com/users/cortex-cms","html_url":"https://github.com/cortex-cms","followers_url":"https://api.github.com/users/cortex-cms/followers","following_url":"https://api.github.com/users/cortex-cms/following{/other_user}","gists_url":"https://api.github.com/users/cortex-cms/gists{/gist_id}","starred_url":"https://api.github.com/users/cortex-cms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cortex-cms/subscriptions","organizations_url":"https://api.github.com/users/cortex-cms/orgs","repos_url":"https://api.github.com/users/cortex-cms/repos","events_url":"https://api.github.com/users/cortex-cms/events{/privacy}","received_events_url":"https://api.github.com/users/cortex-cms/received_events","type":"Organization","site_admin":false},"repo":{"id":68278544,"name":"cortex-plugins-core","full_name":"cortex-cms/cortex-plugins-core","owner":{"login":"cortex-cms","id":12399718,"avatar_url":"https://avatars.githubusercontent.com/u/12399718?v=3","gravatar_id":"","url":"https://api.github.com/users/cortex-cms","html_url":"https://github.com/cortex-cms","followers_url":"https://api.github.com/users/cortex-cms/followers","following_url":"https://api.github.com/users/cortex-cms/following{/other_user}","gists_url":"https://api.github.com/users/cortex-cms/gists{/gist_id}","starred_url":"https://api.github.com/users/cortex-cms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cortex-cms/subscriptions","organizations_url":"https://api.github.com/users/cortex-cms/orgs","repos_url":"https://api.github.com/users/cortex-cms/repos","events_url":"https://api.github.com/users/cortex-cms/events{/privacy}","received_events_url":"https://api.github.com/users/cortex-cms/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cortex-cms/cortex-plugins-core","description":"The combined set of core FieldTypes for the Cortex CMS platform","fork":false,"url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core","forks_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/forks","keys_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/teams","hooks_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/hooks","issue_events_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/issues/events{/number}","events_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/events","assignees_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/assignees{/user}","branches_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/branches{/branch}","tags_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/tags","blobs_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/statuses/{sha}","languages_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/languages","stargazers_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/stargazers","contributors_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/contributors","subscribers_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/subscribers","subscription_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/subscription","commits_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/contents/{+path}","compare_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/merges","archive_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/downloads","issues_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/issues{/number}","pulls_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls{/number}","milestones_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/milestones{/number}","notifications_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/labels{/name}","releases_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/releases{/id}","deployments_url":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/deployments","created_at":"2016-09-15T08:36:33Z","updated_at":"2016-10-24T17:59:26Z","pushed_at":"2016-10-25T19:52:23Z","git_url":"git://github.com/cortex-cms/cortex-plugins-core.git","ssh_url":"git@github.com:cortex-cms/cortex-plugins-core.git","clone_url":"https://github.com/cortex-cms/cortex-plugins-core.git","svn_url":"https://github.com/cortex-cms/cortex-plugins-core","homepage":null,"size":122,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls/15"},"html":{"href":"https://github.com/cortex-cms/cortex-plugins-core/pull/15"},"issue":{"href":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/issues/15"},"comments":{"href":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/cortex-cms/cortex-plugins-core/statuses/4b18ad340c7db78b5d207d0be7b652a769545cdf"}}}}
{"actor":{"display_login":"toastercup"}}