input_css 0.0.1 → 0.1.0

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.
Files changed (3) hide show
  1. data/lib/input_css/version.rb +1 -1
  2. data/lib/input_css.rb +16 -18
  3. metadata +36 -54
@@ -1,3 +1,3 @@
1
1
  module InputCSS
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/input_css.rb CHANGED
@@ -6,35 +6,33 @@ require "input_css/version"
6
6
  module ActionView
7
7
  module Helpers
8
8
  module TagHelper
9
- # intercept #tag method to modify the 'options'
10
9
  def tag_with_default_css(name, options=nil, open=false, escape=true)
11
10
  options = css_options_for_tag(name, options)
12
11
  tag_without_default_css(name, options, open, escape)
13
12
  end
14
-
15
- # save the original method
16
13
  alias_method_chain :tag, :default_css
17
14
 
18
15
  private
19
- def css_options_for_tag(name, options)
20
- options = HashWithIndifferentAccess.new(options)
21
- return options if options[:type] == 'hidden'
22
16
 
23
- # alter CSS class based on type
24
- # (only for <input ... /> tags)
25
- if name.to_s.downcase =~ /^input$/
26
- type, css = options[:type], options[:class]
27
- type = 'text' if type == 'password'
28
- options[:class] = "#{css.to_s} #{type.to_s}".gsub!(/^\s*/, '') unless css && css.split.include?(type)
29
- end
30
- options
17
+ def css_options_for_tag(name, options)
18
+ options = HashWithIndifferentAccess.new(options)
19
+ return options if options[:type] == 'hidden'
20
+
21
+ # alter CSS class based on type
22
+ # (only for <input ... /> tags)
23
+ if name.to_s.downcase =~ /^input$/
24
+ type, css = options[:type], options[:class]
25
+ type = 'text' if type == 'password'
26
+ options[:class] = "#{css.to_s} #{type.to_s}".gsub!(/^\s*/, '') unless css && css.split.include?(type)
31
27
  end
28
+ options
29
+ end
32
30
  end
33
-
34
- # ensure that the new #tag_with_default_css
35
- # method is always called
31
+
36
32
  class InstanceTag
37
33
  alias_method :tag_without_error_wrapping, :tag_with_default_css
38
- end
34
+ options
35
+ end if defined?(InstanceTag) # Rails 3 compat
39
36
  end
40
37
  end
38
+
metadata CHANGED
@@ -1,49 +1,42 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: input_css
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- version: 0.0.1
5
+ version: 0.1.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Ryan Heath
14
9
  - Micah Geisel
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2012-01-06 00:00:00 -08:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
23
- name: rails
13
+ date: 2013-06-23 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
24
16
  prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 3
31
- segments:
32
- - 0
33
- version: "0"
34
17
  type: :runtime
35
- version_requirements: *id001
36
- description: "This plugin taps into Rails tag helpers and adds a CSS class equal to the type attribute for all \xE2\x80\x98input\xE2\x80\x99 fields."
37
- email:
18
+ name: rails
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ! '>='
23
+ - !ruby/object:Gem::Version
24
+ version: '0'
25
+ requirement: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ description: This plugin taps into Rails tag helpers and adds a CSS class equal to
32
+ the type attribute for all ‘input’ fields.
33
+ email:
38
34
  - rpheath@gmail.com
39
35
  - micah@botandrose.com
40
36
  executables: []
41
-
42
37
  extensions: []
43
-
44
38
  extra_rdoc_files: []
45
-
46
- files:
39
+ files:
47
40
  - .gitignore
48
41
  - Gemfile
49
42
  - MIT-LICENSE
@@ -60,39 +53,28 @@ files:
60
53
  - spec/spec_helper.rb
61
54
  - tasks/input_css_tasks.rake
62
55
  - uninstall.rb
63
- has_rdoc: true
64
56
  homepage: https://github.com/botandrose/input_css
65
57
  licenses: []
66
-
67
58
  post_install_message:
68
59
  rdoc_options: []
69
-
70
- require_paths:
60
+ require_paths:
71
61
  - lib
72
- required_ruby_version: !ruby/object:Gem::Requirement
62
+ required_ruby_version: !ruby/object:Gem::Requirement
73
63
  none: false
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- hash: 3
78
- segments:
79
- - 0
80
- version: "0"
81
- required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
69
  none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- hash: 3
87
- segments:
88
- - 0
89
- version: "0"
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
90
74
  requirements: []
91
-
92
75
  rubyforge_project: input_css
93
- rubygems_version: 1.6.2
76
+ rubygems_version: 1.8.25
94
77
  signing_key:
95
78
  specification_version: 3
96
79
  summary: Adds CSS classes for Rails input tags
97
80
  test_files: []
98
-