andrewroth-client_side_validations-formtastic 2.0.0.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- data/client_side_validations-formtastic.gemspec +28 -0
- data/lib/client_side_validations-formtastic.rb +7 -0
- data/lib/client_side_validations/formtastic.rb +4 -0
- data/lib/client_side_validations/formtastic/engine.rb +2 -0
- data/lib/client_side_validations/formtastic/form_builder.rb +21 -0
- data/lib/client_side_validations/formtastic/helpers.rb +3 -0
- data/lib/client_side_validations/formtastic/helpers/input_helper.rb +12 -0
- data/lib/client_side_validations/formtastic/version.rb +5 -0
- data/lib/client_side_validations/generators/formtastic.rb +15 -0
- data/vendor/assets/javascripts/rails.validations.formtastic.js +37 -0
- metadata +155 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/client_side_validations/formtastic/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Brian Cardarella"]
|
6
|
+
gem.email = ["bcardarella@gmail.com"]
|
7
|
+
gem.description = %q{Formtastic Plugin for ClientSideValidaitons}
|
8
|
+
gem.summary = %q{Formtastic Plugin for ClientSideValidations}
|
9
|
+
gem.homepage = 'https://github.com/dockyard/client_side_validations-formtastic'
|
10
|
+
|
11
|
+
gem.files = `git ls-files -- {lib/*,vendor/*,*.gemspec}`.split("\n")
|
12
|
+
gem.name = 'andrewroth-client_side_validations-formtastic'
|
13
|
+
gem.require_paths = ['lib']
|
14
|
+
gem.version = ClientSideValidations::Formtastic::VERSION
|
15
|
+
|
16
|
+
gem.add_dependency 'andrewroth-client_side_validations', '~> 3.2.0.beta.5'
|
17
|
+
gem.add_dependency 'formtastic', '~> 2.0.0'
|
18
|
+
|
19
|
+
gem.add_development_dependency 'rails', '~> 3.2.0'
|
20
|
+
gem.add_development_dependency 'mocha'
|
21
|
+
|
22
|
+
# For QUnit testing
|
23
|
+
gem.add_development_dependency 'sinatra', '~> 1.0'
|
24
|
+
gem.add_development_dependency 'shotgun'
|
25
|
+
gem.add_development_dependency 'thin'
|
26
|
+
gem.add_development_dependency 'json'
|
27
|
+
gem.add_development_dependency 'coffee-script'
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ClientSideValidations
|
2
|
+
module Formtastic
|
3
|
+
module FormBuilder
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.class_eval do
|
7
|
+
def self.client_side_form_settings(options, form_helper)
|
8
|
+
{
|
9
|
+
:type => self.to_s,
|
10
|
+
:inline_error_class => ::Formtastic::FormBuilder.default_inline_error_class
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Formtastic::FormBuilder.send(:include, ClientSideValidations::Formtastic::FormBuilder)
|
21
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module ClientSideValidations::Formtastic::Helpers::InputHelper
|
2
|
+
def input(method, options = {})
|
3
|
+
if options.key?(:validate)
|
4
|
+
options[:input_html] ||= {}
|
5
|
+
options[:input_html].merge!(:validate => options[:validate])
|
6
|
+
options.delete(:validate)
|
7
|
+
end
|
8
|
+
super(method, options)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
::Formtastic::FormBuilder.send(:include, ::ClientSideValidations::Formtastic::Helpers::InputHelper)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ClientSideValidations
|
2
|
+
module Generators
|
3
|
+
class SimpleForm
|
4
|
+
def self.assets
|
5
|
+
[{
|
6
|
+
:path => File.expand_path('../../../../vendor/assets/javascripts', __FILE__),
|
7
|
+
:file => 'rails.validations.formtastic.js'
|
8
|
+
}]
|
9
|
+
end
|
10
|
+
|
11
|
+
Generators.register_assets(self)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
Client Side Validations - Formtastic - v2.0.0.beta.3
|
4
|
+
https://github.com/dockyard/client_side_validations-formtastic
|
5
|
+
|
6
|
+
Copyright (c) 2012 DockYard, LLC
|
7
|
+
Licensed under the MIT license
|
8
|
+
http://www.opensource.org/licenses/mit-license.php
|
9
|
+
*/
|
10
|
+
|
11
|
+
(function() {
|
12
|
+
|
13
|
+
ClientSideValidations.formBuilders['Formtastic::FormBuilder'] = {
|
14
|
+
add: function(element, settings, message) {
|
15
|
+
var errorElement, wrapper;
|
16
|
+
if (element.data('valid') !== false) {
|
17
|
+
wrapper = element.closest('li');
|
18
|
+
errorElement = $('<p/>', {
|
19
|
+
"class": settings.inline_error_class,
|
20
|
+
text: message
|
21
|
+
});
|
22
|
+
wrapper.addClass('error');
|
23
|
+
return wrapper.append(errorElement);
|
24
|
+
} else {
|
25
|
+
return element.parent().find("p." + settings.inline_error_class).text(message);
|
26
|
+
}
|
27
|
+
},
|
28
|
+
remove: function(element, settings) {
|
29
|
+
var errorElement, wrapper;
|
30
|
+
wrapper = element.closest('li.error');
|
31
|
+
errorElement = wrapper.find("p." + settings.inline_error_class);
|
32
|
+
wrapper.removeClass('error');
|
33
|
+
return errorElement.remove();
|
34
|
+
}
|
35
|
+
};
|
36
|
+
|
37
|
+
}).call(this);
|
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: andrewroth-client_side_validations-formtastic
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0.beta.3
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Brian Cardarella
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: andrewroth-client_side_validations
|
16
|
+
requirement: &2152181140 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.2.0.beta.5
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2152181140
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: formtastic
|
27
|
+
requirement: &2152259180 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.0.0
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2152259180
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rails
|
38
|
+
requirement: &2152256380 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 3.2.0
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2152256380
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: mocha
|
49
|
+
requirement: &2152285420 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2152285420
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: sinatra
|
60
|
+
requirement: &2152282640 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '1.0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2152282640
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: shotgun
|
71
|
+
requirement: &2152280740 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *2152280740
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: thin
|
82
|
+
requirement: &2152279060 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *2152279060
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: json
|
93
|
+
requirement: &2152278400 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *2152278400
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: coffee-script
|
104
|
+
requirement: &2152311540 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *2152311540
|
113
|
+
description: Formtastic Plugin for ClientSideValidaitons
|
114
|
+
email:
|
115
|
+
- bcardarella@gmail.com
|
116
|
+
executables: []
|
117
|
+
extensions: []
|
118
|
+
extra_rdoc_files: []
|
119
|
+
files:
|
120
|
+
- client_side_validations-formtastic.gemspec
|
121
|
+
- lib/client_side_validations-formtastic.rb
|
122
|
+
- lib/client_side_validations/formtastic.rb
|
123
|
+
- lib/client_side_validations/formtastic/engine.rb
|
124
|
+
- lib/client_side_validations/formtastic/form_builder.rb
|
125
|
+
- lib/client_side_validations/formtastic/helpers.rb
|
126
|
+
- lib/client_side_validations/formtastic/helpers/input_helper.rb
|
127
|
+
- lib/client_side_validations/formtastic/version.rb
|
128
|
+
- lib/client_side_validations/generators/formtastic.rb
|
129
|
+
- vendor/assets/javascripts/rails.validations.formtastic.js
|
130
|
+
homepage: https://github.com/dockyard/client_side_validations-formtastic
|
131
|
+
licenses: []
|
132
|
+
post_install_message:
|
133
|
+
rdoc_options: []
|
134
|
+
require_paths:
|
135
|
+
- lib
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
144
|
+
requirements:
|
145
|
+
- - ! '>'
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: 1.3.1
|
148
|
+
requirements: []
|
149
|
+
rubyforge_project:
|
150
|
+
rubygems_version: 1.8.10
|
151
|
+
signing_key:
|
152
|
+
specification_version: 3
|
153
|
+
summary: Formtastic Plugin for ClientSideValidations
|
154
|
+
test_files: []
|
155
|
+
has_rdoc:
|