form_assistant 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -0,0 +1,96 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{form_assistant}
8
+ s.version = "1.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ryan Heath", "Chris Scharf"]
12
+ s.date = %q{2012-07-06}
13
+ s.description = %q{Custom form builder that attempts to make your forms friendly}
14
+ s.email = %q{scharfie@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.textile"
18
+ ]
19
+ s.files = [
20
+ "Gemfile",
21
+ "Gemfile.lock",
22
+ "LICENSE.txt",
23
+ "README.textile",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "autotest/discover.rb",
27
+ "autotest/testunit.rb",
28
+ "form_assistant.gemspec",
29
+ "forms/_check_box.html.erb",
30
+ "forms/_field.html.erb",
31
+ "forms/_fieldset.html.erb",
32
+ "forms/_file_field.html.erb",
33
+ "forms/_password_field.html.erb",
34
+ "forms/_radio_button.html.erb",
35
+ "forms/_text_area.html.erb",
36
+ "forms/_text_field.html.erb",
37
+ "init.rb",
38
+ "install.rb",
39
+ "lib/form_assistant.rb",
40
+ "lib/form_assistant/error.rb",
41
+ "lib/form_assistant/field_errors.rb",
42
+ "lib/form_assistant/rules.rb",
43
+ "tasks/form_assistant_tasks.rake",
44
+ "test/forms/_field.html.erb",
45
+ "test/forms/_fieldset.html.erb",
46
+ "test/forms/_text_field.html.erb",
47
+ "test/forms/_widget.html.erb",
48
+ "test/helper.rb",
49
+ "test/mock_rails.rb",
50
+ "test/test_field_errors.rb",
51
+ "test/test_form_assistant.rb",
52
+ "uninstall.rb"
53
+ ]
54
+ s.homepage = %q{http://github.com/scharfie/form_assistant}
55
+ s.licenses = ["MIT"]
56
+ s.require_paths = ["lib"]
57
+ s.rubygems_version = %q{1.4.2}
58
+ s.summary = %q{Custom form builder that attempts to make your forms friendly}
59
+
60
+ if s.respond_to? :specification_version then
61
+ s.specification_version = 3
62
+
63
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
64
+ s.add_runtime_dependency(%q<rake>, ["= 0.8.7"])
65
+ s.add_development_dependency(%q<activesupport>, ["~> 2.3"])
66
+ s.add_development_dependency(%q<actionpack>, ["~> 2.3"])
67
+ s.add_development_dependency(%q<activerecord>, ["~> 2.3"])
68
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
69
+ s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
70
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
71
+ s.add_development_dependency(%q<rcov>, [">= 0"])
72
+ s.add_development_dependency(%q<mocha>, [">= 0"])
73
+ else
74
+ s.add_dependency(%q<rake>, ["= 0.8.7"])
75
+ s.add_dependency(%q<activesupport>, ["~> 2.3"])
76
+ s.add_dependency(%q<actionpack>, ["~> 2.3"])
77
+ s.add_dependency(%q<activerecord>, ["~> 2.3"])
78
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
79
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
80
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
81
+ s.add_dependency(%q<rcov>, [">= 0"])
82
+ s.add_dependency(%q<mocha>, [">= 0"])
83
+ end
84
+ else
85
+ s.add_dependency(%q<rake>, ["= 0.8.7"])
86
+ s.add_dependency(%q<activesupport>, ["~> 2.3"])
87
+ s.add_dependency(%q<actionpack>, ["~> 2.3"])
88
+ s.add_dependency(%q<activerecord>, ["~> 2.3"])
89
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
90
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
91
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
92
+ s.add_dependency(%q<rcov>, [">= 0"])
93
+ s.add_dependency(%q<mocha>, [">= 0"])
94
+ end
95
+ end
96
+
@@ -36,41 +36,43 @@ module RPH
36
36
  # # in config/intializers/form_assistant.rb
37
37
  # ActionView::Base.default_form_builder = RPH::FormAssistant::FormBuilder
38
38
  class FormBuilder < ActionView::Helpers::FormBuilder
39
- cattr_accessor :ignore_templates
40
- cattr_accessor :ignore_labels
41
- cattr_accessor :ignore_errors
42
- cattr_accessor :template_root
43
-
44
39
  # used if no other template is available
45
40
  attr_accessor :fallback_template
46
-
47
- # if set to true, none of the templates will be used;
48
- # however, labels can still be automatically attached
49
- # and all FormAssistant helpers are still avaialable
50
- self.ignore_templates = false
51
-
52
- # if set to true, labels will become nil everywhere (both
53
- # with and without templates)
54
- self.ignore_labels = false
55
-
56
- # set to true if you'd rather use #error_messages_for()
57
- self.ignore_errors = false
58
41
 
59
- # sets the root directory where templates will be searched
60
- # note: the template root should be nested within the
61
- # configured view path (which defaults to app/views)
62
- self.template_root = File.join(Rails.configuration.view_path, 'forms')
63
-
64
42
  # override the field_error_proc so that it no longer wraps the field
65
43
  # with <div class="fieldWithErrors">...</div>, but just returns the field
66
44
  ActionView::Base.field_error_proc = Proc.new { |html_tag, instance| html_tag }
67
-
68
- private
69
- # render(:partial => '...') doesn't want the full path of the template
70
- def self.template_root(full_path = false)
71
- full_path ? @@template_root : @@template_root.gsub(Rails.configuration.view_path + '/', '')
45
+
46
+ class << self
47
+ attr_accessor :ignore_templates
48
+ attr_accessor :ignore_labels
49
+ attr_accessor :ignore_errors
50
+ attr_accessor :template_root
51
+
52
+ # if set to true, none of the templates will be used;
53
+ # however, labels can still be automatically attached
54
+ # and all FormAssistant helpers are still avaialable
55
+ @ignore_templates = false
56
+
57
+ # if set to true, labels will become nil everywhere (both
58
+ # with and without templates)
59
+ @ignore_labels = false
60
+
61
+ # set to true if you'd rather use #error_messages_for()
62
+ @ignore_errors = false
63
+
64
+ # sets the root directory where templates will be searched
65
+ # note: the template root should be nested within the
66
+ # configured view path (which defaults to app/views)
67
+ def template_root(full_path = false)
68
+ @template_root ||= File.join(Rails.configuration.view_path, 'forms')
69
+
70
+ # render(:partial => '...') doesn't want the full path of the template
71
+ full_path ? @template_root : @template_root.gsub(Rails.configuration.view_path + '/', '')
72
+ end
72
73
  end
73
74
 
75
+ private
74
76
  # get the error messages (if any) for a field
75
77
  def error_message_for(fields)
76
78
  errors = []
data/test/helper.rb CHANGED
@@ -18,8 +18,9 @@ $:.unshift(File.join(File.dirname(__FILE__), *%w[../lib]))
18
18
  require 'ostruct'
19
19
  require 'active_support'
20
20
  require 'action_controller'
21
+ require 'active_support/test_case'
21
22
  # require 'action_controller/test_process'
22
- # require 'action_view/test_case'
23
+ require 'action_view/test_case'
23
24
  require 'active_record'
24
25
 
25
26
  require 'mocha'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: form_assistant
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 1.0.0
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Heath
@@ -173,6 +173,7 @@ files:
173
173
  - VERSION
174
174
  - autotest/discover.rb
175
175
  - autotest/testunit.rb
176
+ - form_assistant.gemspec
176
177
  - forms/_check_box.html.erb
177
178
  - forms/_field.html.erb
178
179
  - forms/_fieldset.html.erb