angular_form_validation 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11725886ca6e27c1f606d828fc40473dda03846c
4
- data.tar.gz: 166942396caca2d814e75eb501334f368015c718
3
+ metadata.gz: f578b749f910ec47907ac54f7e6b7aba98ed1bc8
4
+ data.tar.gz: 46da3171d53f7e5f5fdb98dc54380b4d392791f6
5
5
  SHA512:
6
- metadata.gz: 7d9edf93356387e8edbf171a3217eac0911b1c4e86314bb756f6ef2f072410b40c2ea9708ef58c411bfb8d9c870b6bb39f5a23faede69aca4ecae3bdf4aabde6
7
- data.tar.gz: 39a0fb9eeccc812d46b15e2f8ff8d1e993d5307e604d3031c4459dad748a6a9e3aa864f20456d3e4359f7658fe6f47619d65f617cf6f1fb15bbc3f5595453fb3
6
+ metadata.gz: 37d5fa90fe24da176df43242dac6dd08b7729c89a347003c369c5045973d13f3a64175f1aa7688f26928eb9c763493b5a37c2fe812b554e9b073a5c2d0352859
7
+ data.tar.gz: 4c240d7ebc3f0b08e68782c6528aca97ad42025d56bae3a80073d7cf2b24748eb40ee2c8430f1605d429230e386b77890d7b8d2df46b87cb2de666040552a80a
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Angular Form Validation Gem
2
2
 
3
- Ruby gem to easily implement angular validation via form_form and form_tag helpers
3
+ Ruby gem to easily implement angular validation via Rails form helpers form_for and form_tag
4
4
 
5
5
  ## Installation
6
6
 
@@ -13,6 +13,29 @@ gem 'angular_form_validation'
13
13
 
14
14
  As a result, you can easily have JavaScript validation on all forms with a minimum effort, nice real-time visual feedback on form inputs and take advantage of two-way bindings.
15
15
 
16
+ ![Gem Demo](http://d1iix9iwi7lpon.cloudfront.net/images/gif/angular-form-gem-demo.gif)
17
+
18
+ ## Usage for form_tag
19
+
20
+ Write the standard form_for and specify which input is required for validation purposes:
21
+
22
+ form_for @product_category do |f|
23
+ label_tag :ref_code
24
+ f.text_field :ref_code, required: true
25
+ label_tag :name
26
+ f.text_field :name, required: true
27
+ f.submit "Create"
28
+ end
29
+
30
+ This will generate the following form:
31
+
32
+ <form accept-charset="UTF-8" action="/catalog/product-categories" class="ng-pristine ng-invalid ng-invalid-required" id="new_product_category" method="post" name="postProductCategory">
33
+ <label for="ref_code">Ref code</label>
34
+ <input id="product_category_ref_code" name="product_category[ref_code]" ng-init="product_category.ref_code=''" ng-model="product_category.ref_code" required="required" type="text" class="ng-pristine ng-invalid ng-invalid-required"> <label for="name">Name</label>
35
+ <input id="product_category_name" name="product_category[name]" ng-init="product_category.name=''" ng-model="product_category.name" required="required" type="text" class="ng-pristine ng-invalid ng-invalid-required">
36
+ <input name="commit" ng-disabled="postProductCategory.$invalid" type="submit" value="Create" disabled="disabled">
37
+ </form>
38
+
16
39
  ## Usage for form_tag
17
40
 
18
41
  When using the helper form_tag, it is required to use the following helpers:
@@ -32,3 +55,13 @@ This helper can be used on form buttons to add the ng-disabled attribute:
32
55
  Example:
33
56
 
34
57
  <%= button_tag t("common.form.actions.save_btn"), ng_submit_opts(@product_config) %
58
+
59
+ ### Example
60
+
61
+ form_tag product_category_path do |f|
62
+ label_tag :ref_code
63
+ text_field_tag :ref_code, params[:ref_code], { required: true }.merge(ng_model_opts(@product_category, :ref_code)
64
+ label_tag :name
65
+ text_field_tag :name, params[:name], { required: true }.merge(ng_model_opts(@product_category, :name)
66
+ button_tag "Create", ng_submit_opts(@product_category)
67
+ end
Binary file
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.version = AngularFormValidation::VERSION
9
9
  spec.authors = ["Olivier Robert", "Nimbl3"]
10
10
  spec.email = ["olivier@nimbl3.com"]
11
- spec.summary = "Implement easily angular validation via form_form and form_tag helpers"
11
+ spec.summary = "Implement easily angular validation via form_for and form_tag helpers"
12
12
  spec.description = ""
13
13
  spec.homepage = "https://github.com/nimbl3/angular-form-validation"
14
14
  spec.license = "MIT"
@@ -1,3 +1,3 @@
1
1
  module AngularFormValidation
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angular_form_validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Robert
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-15 00:00:00.000000000 Z
12
+ date: 2014-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -51,7 +51,7 @@ files:
51
51
  - LICENSE.txt
52
52
  - README.md
53
53
  - Rakefile
54
- - angular_form_validation-0.1.5.gem
54
+ - angular_form_validation-0.1.6.gem
55
55
  - angular_form_validation.gemspec
56
56
  - lib/angular_form_validation.rb
57
57
  - lib/angular_form_validation/form/builder.rb
@@ -82,5 +82,5 @@ rubyforge_project:
82
82
  rubygems_version: 2.2.2
83
83
  signing_key:
84
84
  specification_version: 4
85
- summary: Implement easily angular validation via form_form and form_tag helpers
85
+ summary: Implement easily angular validation via form_for and form_tag helpers
86
86
  test_files: []
Binary file