styled_inputs 0.0.3 → 0.0.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.
- data/CHANGELOG +4 -0
- data/README +0 -1
- data/Rakefile +1 -1
- data/lib/styled_inputs/extensions/instance_tag.rb +2 -2
- data/lib/styled_inputs/extensions/tag_helper.rb +2 -2
- data/lib/styled_inputs.rb +2 -2
- data/test/styled_inputs_test.rb +21 -0
- metadata +2 -2
data/CHANGELOG
CHANGED
data/README
CHANGED
data/Rakefile
CHANGED
@@ -8,8 +8,8 @@ module PluginAWeek #:nodoc:
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def tag_with_styled_inputs(name, options) #:nodoc:
|
12
|
-
tag_without_styled_inputs(name, styled_input(name, options))
|
11
|
+
def tag_with_styled_inputs(name, options, *args) #:nodoc:
|
12
|
+
tag_without_styled_inputs(name, styled_input(name, options), *args)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -8,8 +8,8 @@ module PluginAWeek #:nodoc:
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def tag_with_styled_inputs(name, options = nil,
|
12
|
-
tag_without_styled_inputs(name, styled_input(name, options),
|
11
|
+
def tag_with_styled_inputs(name, options = nil, *args) #:nodoc:
|
12
|
+
tag_without_styled_inputs(name, styled_input(name, options), *args)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/lib/styled_inputs.rb
CHANGED
@@ -25,8 +25,8 @@ module PluginAWeek #:nodoc:
|
|
25
25
|
module StyledInputs
|
26
26
|
# Appends the input type to the value currently stored in the html options
|
27
27
|
# for the tag.
|
28
|
-
def styled_input(name, options)
|
29
|
-
options = options.stringify_keys
|
28
|
+
def styled_input(name, options = nil)
|
29
|
+
options = (options || {}).stringify_keys
|
30
30
|
|
31
31
|
if name.to_s == 'input' && options.include?('type')
|
32
32
|
options['class'] = (options['class'].to_s + " #{options['type']}").strip
|
data/test/styled_inputs_test.rb
CHANGED
@@ -127,3 +127,24 @@ class FormHelperTest < Test::Unit::TestCase
|
|
127
127
|
assert_equal '<input class="radio" id="person_agree_1" name="person[agree]" type="radio" value="1" />', radio_button(:person, :agree, 1)
|
128
128
|
end
|
129
129
|
end
|
130
|
+
|
131
|
+
class TagHelperTest < Test::Unit::TestCase
|
132
|
+
include PluginAWeek::StyledInputs
|
133
|
+
include ActionView::Helpers::TagHelper
|
134
|
+
|
135
|
+
def test_should_allow_no_options_to_be_specified
|
136
|
+
assert_equal '<br />', tag('br')
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_should_allow_options_to_be_specified
|
140
|
+
assert_equal '<input class="text" disabled="disabled" type="text" />', tag('input', {:type => 'text', :disabled => true})
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_should_allow_open_to_be_specified
|
144
|
+
assert_equal '<br>', tag('br', nil, true)
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_should_allow_escape_to_be_specified
|
148
|
+
assert_equal '<img src="open & shut.png" />', tag('img', {:src => 'open & shut.png'}, false, false)
|
149
|
+
end
|
150
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: styled_inputs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Pfeifer
|
@@ -9,7 +9,7 @@ autorequire: styled_inputs
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-06-
|
12
|
+
date: 2008-06-03 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|