padrino-helpers 0.13.0 → 0.13.1.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/padrino-helpers/form_helpers/options.rb +3 -3
- data/lib/padrino-helpers/tag_helpers.rb +1 -1
- data/lib/padrino/rendering.rb +2 -1
- data/test/test_form_helpers.rb +2 -2
- data/test/test_rendering.rb +13 -1
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3fdcc6a81ec716ac04cd1d695ccf508e3582370
|
4
|
+
data.tar.gz: a27d8a7a4ac6fef846b9a9771648a84c11761948
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a880544ead387a3d35c51d01ca87e557de0920fc26d54254cba74ce414c432d6dd15796aca907e5bb050cde172737cb9d54858eae7b45bdd6fd39b62288492eb
|
7
|
+
data.tar.gz: 3e20fcc06fad879fc834bcdcaf22b620e4768a42ce156c61d8298333631043314a18f4dec4a6886a1b7eafdd61c9fb572f082318272058d94b7e57a6792af727
|
@@ -57,9 +57,9 @@ module Padrino
|
|
57
57
|
def options_for_select(option_items, state = {})
|
58
58
|
return [] if option_items.blank?
|
59
59
|
option_items.map do |caption, value, attributes|
|
60
|
-
html_attributes = { :value => value
|
61
|
-
html_attributes[:selected] ||= option_is_selected?(value, caption, state[:selected])
|
62
|
-
html_attributes[:disabled] ||= option_is_selected?(value, caption, state[:disabled])
|
60
|
+
html_attributes = { :value => value || caption }.merge(attributes||{})
|
61
|
+
html_attributes[:selected] ||= option_is_selected?(html_attributes[:value], caption, state[:selected])
|
62
|
+
html_attributes[:disabled] ||= option_is_selected?(html_attributes[:value], caption, state[:disabled])
|
63
63
|
content_tag(:option, caption, html_attributes)
|
64
64
|
end
|
65
65
|
end
|
@@ -226,7 +226,7 @@ module Padrino
|
|
226
226
|
# tag :img, :src => 'images/pony.jpg', :alt => 'My Little Pony'
|
227
227
|
# # => <img src="images/pony.jpg" alt="My Little Pony" />
|
228
228
|
#
|
229
|
-
# tag :img, :src => 'sinatra.jpg, :data => { :nsfw => false, :geo => [34.087, -118.407] }
|
229
|
+
# tag :img, :src => 'sinatra.jpg', :data => { :nsfw => false, :geo => [34.087, -118.407] }
|
230
230
|
# # => <img src="sinatra.jpg" data-nsfw="false" data-geo="34.087 -118.407" />
|
231
231
|
#
|
232
232
|
def tag(name, options = nil, open = false)
|
data/lib/padrino/rendering.rb
CHANGED
@@ -343,7 +343,8 @@ module Padrino
|
|
343
343
|
end
|
344
344
|
|
345
345
|
def content_type_symbol(type)
|
346
|
-
if defined?(::Rack::Mime::MIME_TYPES) && type.kind_of?(String)
|
346
|
+
if defined?(::Rack::Mime::MIME_TYPES) && type.kind_of?(String) &&
|
347
|
+
::Rack::Mime::MIME_TYPES.key(type)
|
347
348
|
type = ::Rack::Mime::MIME_TYPES.key(type).sub(/\./,'').to_sym
|
348
349
|
end
|
349
350
|
CONTENT_TYPE_ALIASES[type] || type
|
data/test/test_form_helpers.rb
CHANGED
@@ -781,8 +781,8 @@ describe "FormHelpers" do
|
|
781
781
|
end
|
782
782
|
|
783
783
|
it 'should display selected options falling back to checking content' do
|
784
|
-
options = [['one'], ['two'], ['three', 'three']]
|
785
|
-
actual_html = select_tag(:number, :options => options, :selected => 'one')
|
784
|
+
options = [['one', nil, :value => nil], ['two', nil, :value => nil], ['three', 'three']]
|
785
|
+
actual_html = select_tag(:number, :options => options, :selected => 'one')
|
786
786
|
assert_has_tag('select option', :selected => 'selected', :count => 1) { actual_html }
|
787
787
|
assert_has_tag('select option', :content => 'one', :selected => 'selected') { actual_html }
|
788
788
|
end
|
data/test/test_rendering.rb
CHANGED
@@ -151,6 +151,18 @@ describe "Rendering" do
|
|
151
151
|
assert_equal 'layout404 file', body
|
152
152
|
end
|
153
153
|
|
154
|
+
it 'should work with set content type not contained in rack-types' do
|
155
|
+
create_view "index.md.erb", "Hello"
|
156
|
+
mock_app do
|
157
|
+
get("/") {
|
158
|
+
content_type "text/x-markdown; charset=UTF-8"
|
159
|
+
render "index.erb", { :layout => nil }
|
160
|
+
}
|
161
|
+
end
|
162
|
+
get "/"
|
163
|
+
assert_equal "Hello", body
|
164
|
+
end
|
165
|
+
|
154
166
|
it 'should not use html file when DEFAULT_RENDERING_OPTIONS[:strict_format] == true' do
|
155
167
|
create_layout :foo, "html file", :format => :html
|
156
168
|
|
@@ -677,7 +689,7 @@ describe "Rendering" do
|
|
677
689
|
class Application < Sinatra::Base
|
678
690
|
register Padrino::Rendering
|
679
691
|
get '/' do
|
680
|
-
render :post, :views => File.dirname(__FILE__)+'/fixtures/apps/views/blog'
|
692
|
+
render :post, :views => File.dirname(__FILE__)+'/fixtures/apps/views/blog'
|
681
693
|
end
|
682
694
|
end
|
683
695
|
@app = Application.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.1.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-10-
|
14
|
+
date: 2015-10-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: padrino-support
|
@@ -19,46 +19,46 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.13.
|
22
|
+
version: 0.13.1.beta1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.13.
|
29
|
+
version: 0.13.1.beta1
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: tilt
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- - ~>
|
34
|
+
- - "~>"
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: 1.4.1
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - ~>
|
41
|
+
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 1.4.1
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: i18n
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- - ~>
|
48
|
+
- - "~>"
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0.6'
|
51
|
-
- -
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 0.6.7
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - ~>
|
58
|
+
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0.6'
|
61
|
-
- -
|
61
|
+
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: 0.6.7
|
64
64
|
description: Tag helpers, asset helpers, form helpers, form builders and many more
|
@@ -69,9 +69,9 @@ extensions: []
|
|
69
69
|
extra_rdoc_files:
|
70
70
|
- README.rdoc
|
71
71
|
files:
|
72
|
-
- .document
|
73
|
-
- .gitignore
|
74
|
-
- .yardopts
|
72
|
+
- ".document"
|
73
|
+
- ".gitignore"
|
74
|
+
- ".yardopts"
|
75
75
|
- LICENSE.txt
|
76
76
|
- README.rdoc
|
77
77
|
- Rakefile
|
@@ -224,19 +224,19 @@ licenses:
|
|
224
224
|
metadata: {}
|
225
225
|
post_install_message:
|
226
226
|
rdoc_options:
|
227
|
-
- --charset=UTF-8
|
227
|
+
- "--charset=UTF-8"
|
228
228
|
require_paths:
|
229
229
|
- lib
|
230
230
|
required_ruby_version: !ruby/object:Gem::Requirement
|
231
231
|
requirements:
|
232
|
-
- -
|
232
|
+
- - ">="
|
233
233
|
- !ruby/object:Gem::Version
|
234
234
|
version: '0'
|
235
235
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
236
|
requirements:
|
237
|
-
- -
|
237
|
+
- - ">"
|
238
238
|
- !ruby/object:Gem::Version
|
239
|
-
version: 1.3.
|
239
|
+
version: 1.3.1
|
240
240
|
requirements: []
|
241
241
|
rubyforge_project: padrino-helpers
|
242
242
|
rubygems_version: 2.4.8
|