green_light 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,10 +17,13 @@ Generate the required green_light configuration:-
17
17
 
18
18
  rails g green_light:install
19
19
 
20
- Include the JQuery validation plugin and green_light javascript in your application.js file:-
20
+ Include the JQuery validation plugin in your app/assets/javascripts/application.js file:-
21
21
 
22
22
  //= require jquery.validate
23
- //= require green_light
23
+
24
+ Since the validation rules are creating dynmically they need to be included at the top of your layout file:-
25
+
26
+ <%= javascript_include_tag "green_light" %>
24
27
 
25
28
  Specify which models you want to have client-side validation in the config/green_light.yml file e.g.:-
26
29
 
@@ -44,7 +47,7 @@ And finally, add some validations to your models!
44
47
  For validations that are not yet supported, the gem will degrade gracefully to the standard Rails server-side validation.
45
48
 
46
49
 
47
- == Legecy Rails 3 Support
50
+ == Legacy Rails 3 Support
48
51
 
49
52
  For Rails 3 support use the older version (0.0.3) of green_light
50
53
 
@@ -0,0 +1,8 @@
1
+ class AssetsController < ApplicationController
2
+ respond_to :js
3
+
4
+ def green_light
5
+ @rules = GreenLight::Rules.generate(GREEN_LIGHT[:validate_models])
6
+ respond_with(@rules)
7
+ end
8
+ end
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * Build validation rules based on models specified in the green_light config
3
3
  */
4
- <% unless GREEN_LIGHT[:validate_models].empty? %>
5
- <% @rules = GreenLight::Rules.generate(GREEN_LIGHT[:validate_models]) %>
4
+ <% if @rules %>
6
5
  $().ready(function() {
7
6
  $(".green_light").validate(<%= @rules.html_safe %>);
8
7
  });
@@ -1,3 +1,3 @@
1
1
  module GreenLight
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: green_light
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Phil McClure
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-03 00:00:00 +01:00
18
+ date: 2011-08-04 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -35,8 +35,9 @@ files:
35
35
  - README.rdoc
36
36
  - Rakefile
37
37
  - app/.DS_Store
38
- - app/assets/javascripts/green_light.js.erb
38
+ - app/controllers/assets_controller.rb
39
39
  - app/controllers/javascripts_controller.rb
40
+ - app/views/assets/green_light.js.erb
40
41
  - config/routes.rb
41
42
  - green_light.gemspec
42
43
  - lib/.DS_Store
@@ -89,9 +90,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  requirements: []
90
91
 
91
92
  rubyforge_project: green_light
92
- rubygems_version: 1.5.2
93
+ rubygems_version: 1.4.2
93
94
  signing_key:
94
95
  specification_version: 3
95
96
  summary: Simple client side validation that keeps validation in the models
96
- test_files: []
97
-
97
+ test_files:
98
+ - spec/green_light_spec.rb
99
+ - spec/spec_helper.rb