sinatra-tag-helpers 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/sinatra/tag-helpers.rb +13 -5
- data/lib/sinatra/tag-helpers/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGEyZDNmNmY2NTgyYmZhMWY4YTE4MjQ3ZGYzODhmZWQwNWJiMGZjZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWQyY2U0MTJjYTg4MjE4N2Q5YTFiYWUyYTBiMDEyZWViMTQ3YWQxNw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YWM5MGMxMTU4ZjkyNTEyNTVmODVmMzNmZWI0YmY4MjYwMmE5ZGUyZDUzZTg0
|
10
|
+
ZmRiNmY3NjYzNWI0NDgxYzIwM2M3Yzc0NzAxM2MzYjhmMjc3MzllZTQ4NTJk
|
11
|
+
YjIxZDY5MGU0NTg5NDkzZWIxODg1MTk1MGM2ZjFmOWUzNmU2OWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjVjZDkxMWI5Y2U0MzQwZDQ2MjU4NTU2ZTMyNDdlNDg0ZWI2ZDNjYzBkYjg0
|
14
|
+
NWNmMTRjMjBiOWIwNGMyNTZjN2Q3YWY3NTYwZWFiOWVkN2Y4ZjRlMmU1ZTlm
|
15
|
+
ZTQwOTVkNjU1MDUxYjFmMDMyM2Y4NjM0MDdmNDM5N2M2M2JjM2I=
|
data/lib/sinatra/tag-helpers.rb
CHANGED
@@ -154,7 +154,13 @@ module Sinatra
|
|
154
154
|
# </select>
|
155
155
|
#
|
156
156
|
def select_for(param, options, attributes = {})
|
157
|
-
|
157
|
+
attributes = {
|
158
|
+
:name => param,
|
159
|
+
:id => param,
|
160
|
+
:size => 1
|
161
|
+
}.merge(attributes)
|
162
|
+
|
163
|
+
select = ["<select #{ to_attributes(attributes) }>"]
|
158
164
|
|
159
165
|
options.collect do |key, val|
|
160
166
|
select.push option_for(param, :key => key, :value => val, :default => attributes[:default])
|
@@ -173,13 +179,13 @@ module Sinatra
|
|
173
179
|
|
174
180
|
if range.last > range.first
|
175
181
|
# top down
|
176
|
-
range.last.downto(range.first) do |
|
177
|
-
options[
|
182
|
+
range.last.downto(range.first) do |element|
|
183
|
+
options[element] = element
|
178
184
|
end
|
179
185
|
else
|
180
186
|
# bottom up
|
181
|
-
range.last.upto(range.first) do |
|
182
|
-
options[
|
187
|
+
range.last.upto(range.first) do |element|
|
188
|
+
options[element] = element
|
183
189
|
end
|
184
190
|
end
|
185
191
|
|
@@ -196,4 +202,6 @@ module Sinatra
|
|
196
202
|
select_for(param, options, attributes)
|
197
203
|
end
|
198
204
|
end
|
205
|
+
|
206
|
+
helpers TagHelpers
|
199
207
|
end
|