roym-classify_form_helpers 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc ADDED
@@ -0,0 +1,8 @@
1
+ = Classify Form Helpers
2
+ Rails gem to add default classes to the html output of form helpers. Like f.text_field, f.text_area, f.submit
3
+
4
+ == Install
5
+ gem install roym-classify_form_helpers --source http://gems.github.com
6
+
7
+ == Usage
8
+
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('classify_form_helpers', '0.1.0') do |p|
6
+ p.description = "Automatically add html class to form_helpers like f.text_field, f.text_area, f.submit"
7
+ p.url = "http://github.com/roym/classify_form_helpers"
8
+ p.author = "Roy van der Meij"
9
+ p.email = "royalain@gmail.com"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
15
+
16
+
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{classify_form_helpers}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Roy van der Meij"]
9
+ s.date = %q{2009-03-30}
10
+ s.description = %q{Automatically add html class to form_helpers like f.text_field, f.text_area, f.submit}
11
+ s.email = %q{royalain@gmail.com}
12
+ s.extra_rdoc_files = ["lib/classify_form_helpers.rb", "README.rdoc"]
13
+ s.files = ["lib/classify_form_helpers.rb", "Rakefile", "README.rdoc", "Manifest", "classify_form_helpers.gemspec"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://github.com/roym/classify_form_helpers}
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Classify_form_helpers", "--main", "README.rdoc"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{classify_form_helpers}
19
+ s.rubygems_version = %q{1.3.1}
20
+ s.summary = %q{Automatically add html class to form_helpers like f.text_field, f.text_area, f.submit}
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 2
25
+
26
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
+ else
28
+ end
29
+ else
30
+ end
31
+ end
@@ -0,0 +1,59 @@
1
+ module ActionView::Helpers::FormHelper
2
+ alias :old_label :label
3
+ def label(object_name, method, text = nil, options = {})
4
+ add_default_class("label", options)
5
+ old_label(object_name, method, text, options)
6
+ end
7
+
8
+ alias :old_text_field :text_field
9
+ def text_field(object_name, method, options = {})
10
+ add_default_class("text_field", options)
11
+ old_text_field(object_name, method, options)
12
+ end
13
+
14
+ alias :old_password_field :password_field
15
+ def password_field(object_name, method, options = {})
16
+ add_default_class("password_field", options)
17
+ old_password_field(object_name, method, options)
18
+ end
19
+
20
+ alias :old_hidden_field :hidden_field
21
+ def hidden_field(object_name, method, options = {})
22
+ add_default_class("hidden_field", options)
23
+ old_hidden_field(object_name, method, options)
24
+ end
25
+
26
+ alias :old_file_field :file_field
27
+ def file_field(object_name, method, options = {})
28
+ add_default_class("file_field", options)
29
+ old_file_field(object_name, method, options)
30
+ end
31
+
32
+ alias :old_text_area :text_area
33
+ def text_area(object_name, method, options = {})
34
+ add_default_class("text_area", options)
35
+ old_text_area(object_name, method, options)
36
+ end
37
+
38
+ alias :old_check_box :check_box
39
+ def check_box(object_name, method, options = {}, checked_value = "1", unchecked_value = "0")
40
+ add_default_class("check_box", options)
41
+ old_check_box(object_name, method, options, checked_value, unchecked_value)
42
+ end
43
+
44
+ alias :old_radio_button :radio_button
45
+ def radio_button(object_name, method, tag_value, options = {})
46
+ add_default_class("radio_button", options)
47
+ old_radio_button(object_name, method, tag_value, options)
48
+ end
49
+
50
+ private
51
+ def add_default_class(class_name, options)
52
+ if options[:class]
53
+ options[:class] = "#{class_name} #{options[:class]}"
54
+ else
55
+ options[:class] = "#{class_name}"
56
+ end
57
+ end
58
+ end
59
+
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: roym-classify_form_helpers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Roy van der Meij
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-30 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Automatically add html class to form_helpers like f.text_field, f.text_area, f.submit
17
+ email: royalain@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - lib/classify_form_helpers.rb
24
+ - README.rdoc
25
+ files:
26
+ - lib/classify_form_helpers.rb
27
+ - Rakefile
28
+ - README.rdoc
29
+ - Manifest
30
+ - classify_form_helpers.gemspec
31
+ has_rdoc: true
32
+ homepage: http://github.com/roym/classify_form_helpers
33
+ post_install_message:
34
+ rdoc_options:
35
+ - --line-numbers
36
+ - --inline-source
37
+ - --title
38
+ - Classify_form_helpers
39
+ - --main
40
+ - README.rdoc
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ version:
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "1.2"
54
+ version:
55
+ requirements: []
56
+
57
+ rubyforge_project: classify_form_helpers
58
+ rubygems_version: 1.2.0
59
+ signing_key:
60
+ specification_version: 2
61
+ summary: Automatically add html class to form_helpers like f.text_field, f.text_area, f.submit
62
+ test_files: []
63
+