padrino-helpers 0.9.19 → 0.9.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,4 +43,4 @@ module Padrino
43
43
  alias :included :registered
44
44
  end
45
45
  end # Helpers
46
- end # Padrino
46
+ end # Padrino
@@ -223,7 +223,7 @@ module Padrino
223
223
  when :js then 'javascripts'
224
224
  else kind.to_s
225
225
  end
226
- source = source.to_s.gsub(/\s/, '')
226
+ source = source.to_s.gsub(/\s/, '%20')
227
227
  ignore_extension = (asset_folder.to_s == kind.to_s) # don't append extension
228
228
  source << ".#{kind}" unless ignore_extension or source =~ /\.#{kind}/
229
229
  result_path = source if source =~ %r{^/} # absolute path
@@ -1,11 +1,11 @@
1
1
  module Padrino
2
2
  module Helpers
3
- module DomHelpers
3
+ module DomHelpers
4
4
  ##
5
5
  # Create DOM id from given object. You can also specify optional prefix.
6
6
  #
7
7
  # ==== Examples
8
- #
8
+ #
9
9
  # @user = User.new
10
10
  # dom_id(@user, "new") # => "new_user"
11
11
  #
@@ -13,7 +13,7 @@ module Padrino
13
13
  # @user.id # => 10
14
14
  # dom_id(@user) # => user_10
15
15
  # dom_id(@user, "edit") # => edit_user_10
16
- #
16
+ #
17
17
  def dom_id(object, prefix=nil)
18
18
  chain = []
19
19
  chain << prefix if prefix
@@ -21,11 +21,11 @@ module Padrino
21
21
  chain << object.id if object.respond_to?('id') && object.id
22
22
  chain.join('_')
23
23
  end
24
-
24
+
25
25
  ##
26
- # Create DOM class name from given object. You can also specify optional
26
+ # Create DOM class name from given object. You can also specify optional
27
27
  # prefix.
28
- #
28
+ #
29
29
  # ==== Examples
30
30
  #
31
31
  # @user = User.new
@@ -43,4 +43,4 @@ module Padrino
43
43
  end
44
44
  end # DomHelpers
45
45
  end # Helpers
46
- end # Padrino
46
+ end # Padrino
@@ -44,7 +44,7 @@ module Padrino
44
44
  options[:enctype] = "multipart/form-data" if options.delete(:multipart)
45
45
  options["data-remote"] = "true" if options.delete(:remote)
46
46
  options["data-method"] = data_method if data_method
47
- options["accept-charset"] = "UTF-8"
47
+ options["accept-charset"] ||= "UTF-8"
48
48
  inner_form_html = hidden_form_method_field(desired_method)
49
49
  inner_form_html += hidden_field_tag(:"_utf8", :value => "&#9731;") + capture_html(&block)
50
50
  concat_content content_tag('form', inner_form_html, options)
@@ -392,4 +392,4 @@ module Padrino
392
392
  end
393
393
  end # FormHelpers
394
394
  end # Helpers
395
- end # Padrino
395
+ end # Padrino
@@ -100,4 +100,4 @@ cz:
100
100
  header:
101
101
  one: "Při ukládání %{model} došlo k chybě a nebylo jej možné uložit"
102
102
  other: "Při ukládání %{model} došlo ke %{count} chybám a nebylo možné jej uložit"
103
- body: "Následující pole obsahují chybně vyplněné údaje:"
103
+ body: "Následující pole obsahují chybně vyplněné údaje:"
@@ -75,4 +75,4 @@ nl:
75
75
  header:
76
76
  one: "1 fout verhindert het opslaan van dit %{model} object"
77
77
  other: "%{count} fouten verhinderen het opslaan van dit %{model} object"
78
- body: "Controleer alstublieft de volgende velden:"
78
+ body: "Controleer alstublieft de volgende velden:"
@@ -88,5 +88,4 @@
88
88
  header:
89
89
  one: "En feil forhindrer %{model} å bli lagret"
90
90
  other: "%{count} feil forhindrer denne %{model} i å bli lagret"
91
- body: "Det er problemer med følgende felter:"
92
-
91
+ body: "Det er problemer med følgende felter:"
@@ -92,4 +92,4 @@ pl:
92
92
  header:
93
93
  one: "%{model} nie został zachowany z powodu jednego błędu"
94
94
  other: "%{model} nie został zachowany z powodu %{count} błędów"
95
- body: "Błędy dotyczą następujących pól:"
95
+ body: "Błędy dotyczą następujących pól:"
@@ -100,4 +100,4 @@ ru:
100
100
  header:
101
101
  one: "Данные «%{model}» не могут быть сохранены из-за 1 ошибки"
102
102
  other: "Данные «%{model}» не могут быть сохранены из-за %{count} ошибок"
103
- body: "Допущены ошибки в следующих полях:"
103
+ body: "Допущены ошибки в следующих полях:"
@@ -100,4 +100,4 @@ tr:
100
100
  header:
101
101
  one: "1 hata oluştu; %{model} kaydedilemedi"
102
102
  other: "%{count} hata oluştu; %{model} kaydedilemedi"
103
- body: "Hata oluşan alanlar:"
103
+ body: "Hata oluşan alanlar:"
@@ -100,4 +100,4 @@ uk:
100
100
  header:
101
101
  one: "Дані «%{model}» не можуть бути збережені через 1 помилки"
102
102
  other: "Дані «%{model}» не можуть бути збережені через %{count} помилок"
103
- body: "Допущені помилки в наступних полях:"
103
+ body: "Допущені помилки в наступних полях:"
@@ -80,9 +80,9 @@ class TestAssetTagHelpers < Test::Unit::TestCase
80
80
  should "display link element for mail to with caption and mail options" do
81
81
  actual_html = mail_to('test@demo.com', "My Email", :subject => 'demo test', :class => 'demo', :cc => 'foo@test.com')
82
82
  assert_has_tag(:a, :class => 'demo') { actual_html }
83
- assert_match /mailto\:test\@demo.com\?/, actual_html
84
- assert_match /cc=foo\@test\.com/, actual_html
85
- assert_match /subject\=demo\%20test/, actual_html
83
+ assert_match %r{mailto\:test\@demo.com\?}, actual_html
84
+ assert_match %r{cc=foo\@test\.com}, actual_html
85
+ assert_match %r{subject\=demo\%20test}, actual_html
86
86
  end
87
87
 
88
88
  should "display mail link element in haml" do
@@ -140,13 +140,17 @@ class TestAssetTagHelpers < Test::Unit::TestCase
140
140
  end
141
141
  should "display image tag relative link with incorrect spacing" do
142
142
  time = stop_time_for_test
143
- assert_has_tag('img.photo', :src => "/images/relative/pic.gif?#{time.to_i}") {
143
+ assert_has_tag('img.photo', :src => "/images/%20relative/%20pic.gif%20%20?#{time.to_i}") {
144
144
  image_tag(' relative/ pic.gif ', :class => 'photo') }
145
145
  end
146
146
  should "not use a timestamp if stamp setting is false" do
147
147
  self.class.expects(:asset_stamp).returns(false)
148
148
  assert_has_tag('img', :src => "/absolute/pic.gif") { image_tag('/absolute/pic.gif') }
149
149
  end
150
+ should "have xhtml convention tag" do
151
+ self.class.expects(:asset_stamp).returns(false)
152
+ assert_equal image_tag('/absolute/pic.gif'), '<img src="/absolute/pic.gif" />'
153
+ end
150
154
  end
151
155
 
152
156
  context 'for #stylesheet_link_tag method' do
@@ -25,7 +25,7 @@ class TestDomHelpers < Test::Unit::TestCase
25
25
  assert_equal dom_id(test_obj), "test_object_10"
26
26
  end
27
27
  end
28
-
28
+
29
29
  context 'for #dom_class method' do
30
30
  should "return DOM class name based on name of given object" do
31
31
  assert_equal dom_class(TestObject.new), "test_object"
@@ -34,4 +34,4 @@ class TestDomHelpers < Test::Unit::TestCase
34
34
  assert_equal dom_class(TestObject.new, "new"), "new_test_object"
35
35
  end
36
36
  end
37
- end
37
+ end
@@ -21,54 +21,54 @@ class TestFormBuilder < Test::Unit::TestCase
21
21
 
22
22
  context 'for #form_for method' do
23
23
  should "display correct form html" do
24
- actual_html = form_for(@user, '/register', :id => 'register', :"accept-charset" => "utf-8", :method => 'post') { "Demo" }
25
- assert_has_tag('form', :"accept-charset" => "utf-8", :action => '/register', :id => 'register', :method => 'post', :content => "Demo") { actual_html }
24
+ actual_html = form_for(@user, '/register', :id => 'register', :"accept-charset" => "UTF-8", :method => 'post') { "Demo" }
25
+ assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/register', :id => 'register', :method => 'post', :content => "Demo") { actual_html }
26
26
  assert_has_tag('form input[type=hidden]', :name => '_method', :count => 0) { actual_html } # no method action field
27
27
  end
28
28
 
29
29
  should "display correct form html with fake object" do
30
- actual_html = form_for(:markup_user, '/register', :id => 'register', :"accept-charset" => "utf-8", :method => 'post') { |f| f.text_field :username }
31
- assert_has_tag('form', :"accept-charset" => "utf-8", :action => '/register', :id => 'register', :method => 'post') { actual_html }
30
+ actual_html = form_for(:markup_user, '/register', :id => 'register', :"accept-charset" => "UTF-8", :method => 'post') { |f| f.text_field :username }
31
+ assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/register', :id => 'register', :method => 'post') { actual_html }
32
32
  assert_has_tag('form input', :type => 'text', :name => 'markup_user[username]') { actual_html }
33
33
  assert_has_tag('form input[type=hidden]', :name => '_method', :count => 0) { actual_html } # no method action field
34
34
  end
35
35
 
36
36
  should "display correct form html for namespaced object" do
37
- actual_html = form_for(Outer::UserAccount.new, '/register', :"accept-charset" => "utf-8", :method => 'post') { |f| f.text_field :username }
38
- assert_has_tag('form', :"accept-charset" => "utf-8", :action => '/register', :method => 'post') { actual_html }
37
+ actual_html = form_for(Outer::UserAccount.new, '/register', :"accept-charset" => "UTF-8", :method => 'post') { |f| f.text_field :username }
38
+ assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/register', :method => 'post') { actual_html }
39
39
  assert_has_tag('form input', :type => 'text', :name => 'outer-user_account[username]') { actual_html }
40
40
  end
41
41
 
42
42
  should "display correct form html with remote option" do
43
- actual_html = form_for(@user, '/update', :"accept-charset" => "utf-8", :remote => true) { "Demo" }
44
- assert_has_tag('form', :"accept-charset" => "utf-8", :action => '/update', :method => 'post', "data-remote" => 'true') { actual_html }
43
+ actual_html = form_for(@user, '/update', :"accept-charset" => "UTF-8", :remote => true) { "Demo" }
44
+ assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/update', :method => 'post', "data-remote" => 'true') { actual_html }
45
45
  end
46
46
 
47
47
  should "display correct form html with remote option and method put" do
48
- actual_html = form_for(@user, '/update', :"accept-charset" => "utf-8", :remote => true, :method => 'put') { "Demo" }
49
- assert_has_tag('form', :"accept-charset" => "utf-8", :method => 'post', "data-method" => 'put', "data-remote" => 'true') { actual_html }
48
+ actual_html = form_for(@user, '/update', :"accept-charset" => "UTF-8", :remote => true, :method => 'put') { "Demo" }
49
+ assert_has_tag('form', :"accept-charset" => "UTF-8", :method => 'post', "data-method" => 'put', "data-remote" => 'true') { actual_html }
50
50
  assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'put') { actual_html }
51
51
  end
52
52
 
53
53
  should "display correct form html with method :put" do
54
- actual_html = form_for(@user, '/update', :"accept-charset" => "utf-8", :method => 'put') { "Demo" }
55
- assert_has_tag('form', :"accept-charset" => "utf-8", :action => '/update', :method => 'post') { actual_html }
54
+ actual_html = form_for(@user, '/update', :"accept-charset" => "UTF-8", :method => 'put') { "Demo" }
55
+ assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/update', :method => 'post') { actual_html }
56
56
  assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'put') { actual_html }
57
57
  end
58
58
 
59
59
  should "display correct form html with method :delete" do
60
- actual_html = form_for(@user, '/destroy', :"accept-charset" => "utf-8", :method => 'delete') { "Demo" }
61
- assert_has_tag('form', :"accept-charset" => "utf-8", :action => '/destroy', :method => 'post') { actual_html }
60
+ actual_html = form_for(@user, '/destroy', :"accept-charset" => "UTF-8", :method => 'delete') { "Demo" }
61
+ assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/destroy', :method => 'post') { actual_html }
62
62
  assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'delete') { actual_html }
63
63
  end
64
64
 
65
65
  should "display correct form html with multipart" do
66
- actual_html = form_for(@user, '/register', :"accept-charset" => "utf-8", :multipart => true) { "Demo" }
67
- assert_has_tag('form', :"accept-charset" => "utf-8", :action => '/register', :enctype => "multipart/form-data") { actual_html }
66
+ actual_html = form_for(@user, '/register', :"accept-charset" => "UTF-8", :multipart => true) { "Demo" }
67
+ assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/register', :enctype => "multipart/form-data") { actual_html }
68
68
  end
69
69
 
70
70
  should "support changing form builder type" do
71
- form_html = proc { form_for(@user, '/register', :"accept-charset" => "utf-8", :builder => "AbstractFormBuilder") { |f| f.text_field_block(:name) } }
71
+ form_html = proc { form_for(@user, '/register', :"accept-charset" => "UTF-8", :builder => "AbstractFormBuilder") { |f| f.text_field_block(:name) } }
72
72
  assert_raise(NoMethodError) { form_html.call }
73
73
  end
74
74
 
@@ -685,4 +685,4 @@ class TestFormBuilder < Test::Unit::TestCase
685
685
  assert_have_selector '#demo2 p input', :type => 'image', :class => 'image', :src => "/images/buttons/ok.png?#{@stamp}"
686
686
  end
687
687
  end
688
- end
688
+ end
@@ -10,49 +10,49 @@ class TestFormHelpers < Test::Unit::TestCase
10
10
 
11
11
  context 'for #form_tag method' do
12
12
  should "display correct forms in ruby" do
13
- actual_html = form_tag('/register', :"accept-charset" => "utf-8", :class => 'test', :method => "post") { "Demo" }
14
- assert_has_tag(:form, :"accept-charset" => "utf-8", :class => "test") { actual_html }
13
+ actual_html = form_tag('/register', :"accept-charset" => "UTF-8", :class => 'test', :method => "post") { "Demo" }
14
+ assert_has_tag(:form, :"accept-charset" => "UTF-8", :class => "test") { actual_html }
15
15
  assert_has_tag('form input', :type => 'hidden', :name => '_method', :count => 0) { actual_html }
16
16
  end
17
17
 
18
18
  should "display correct text inputs within form_tag" do
19
- actual_html = form_tag('/register', :"accept-charset" => "utf-8", :class => 'test') { text_field_tag(:username) }
19
+ actual_html = form_tag('/register', :"accept-charset" => "UTF-8", :class => 'test') { text_field_tag(:username) }
20
20
  assert_has_tag('form input', :type => 'text', :name => "username") { actual_html }
21
21
  end
22
22
 
23
23
  should "display correct form with remote" do
24
- actual_html = form_tag('/update', :"accept-charset" => "utf-8", :class => 'put-form', :remote => true) { "Demo" }
25
- assert_has_tag(:form, :class => "put-form", :"accept-charset" => "utf-8", :"data-remote" => 'true') { actual_html }
24
+ actual_html = form_tag('/update', :"accept-charset" => "UTF-8", :class => 'put-form', :remote => true) { "Demo" }
25
+ assert_has_tag(:form, :class => "put-form", :"accept-charset" => "UTF-8", :"data-remote" => 'true') { actual_html }
26
26
  assert_has_no_tag(:form, "data-method" => 'post') { actual_html }
27
27
  end
28
28
 
29
29
  should "display correct form with remote and method is put" do
30
- actual_html = form_tag('/update', :"accept-charset" => "utf-8", :method => 'put', :remote => true) { "Demo" }
31
- assert_has_tag(:form, "data-remote" => 'true', :"accept-charset" => "utf-8", :"data-method" => 'put') { actual_html }
30
+ actual_html = form_tag('/update', :"accept-charset" => "UTF-8", :method => 'put', :remote => true) { "Demo" }
31
+ assert_has_tag(:form, "data-remote" => 'true', :"accept-charset" => "UTF-8", :"data-method" => 'put') { actual_html }
32
32
  assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'put') { actual_html }
33
33
  end
34
34
 
35
35
  should "display correct form with method :put" do
36
- actual_html = form_tag('/update', :"accept-charset" => "utf-8", :class => 'put-form', :method => "put") { "Demo" }
37
- assert_has_tag(:form, :class => "put-form", :"accept-charset" => "utf-8", :method => 'post') { actual_html }
36
+ actual_html = form_tag('/update', :"accept-charset" => "UTF-8", :class => 'put-form', :method => "put") { "Demo" }
37
+ assert_has_tag(:form, :class => "put-form", :"accept-charset" => "UTF-8", :method => 'post') { actual_html }
38
38
  assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'put') { actual_html }
39
39
  end
40
40
 
41
41
  should "display correct form with method :delete and charset" do
42
- actual_html = form_tag('/remove', :"accept-charset" => "utf-8", :class => 'delete-form', :method => "delete") { "Demo" }
43
- assert_has_tag(:form, :class => "delete-form", :"accept-charset" => "utf-8", :method => 'post') { actual_html }
42
+ actual_html = form_tag('/remove', :"accept-charset" => "UTF-8", :class => 'delete-form', :method => "delete") { "Demo" }
43
+ assert_has_tag(:form, :class => "delete-form", :"accept-charset" => "UTF-8", :method => 'post') { actual_html }
44
44
  assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'delete') { actual_html }
45
45
  assert_has_tag('form input', :type => 'hidden', :name => "_utf8") { actual_html }
46
46
  end
47
47
 
48
48
  should "display correct form with charset" do
49
- actual_html = form_tag('/charset', :"accept-charset" => "utf-8", :class => 'charset-form') { "Demo" }
50
- assert_has_tag(:form, :class => "charset-form", :"accept-charset" => "utf-8", :method => 'post') { actual_html }
49
+ actual_html = form_tag('/charset', :"accept-charset" => "UTF-8", :class => 'charset-form') { "Demo" }
50
+ assert_has_tag(:form, :class => "charset-form", :"accept-charset" => "UTF-8", :method => 'post') { actual_html }
51
51
  assert_has_tag('form input', :type => 'hidden', :name => "_utf8") { actual_html }
52
52
  end
53
53
 
54
54
  should "display correct form with multipart encoding" do
55
- actual_html = form_tag('/remove', :"accept-charset" => "utf-8", :multipart => true) { "Demo" }
55
+ actual_html = form_tag('/remove', :"accept-charset" => "UTF-8", :multipart => true) { "Demo" }
56
56
  assert_has_tag(:form, :enctype => "multipart/form-data") { actual_html }
57
57
  end
58
58
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-helpers
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 19
10
- version: 0.9.19
9
+ - 20
10
+ version: 0.9.20
11
11
  platform: ruby
12
12
  authors:
13
13
  - Padrino Team
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-11-17 00:00:00 +01:00
21
+ date: 2011-01-19 00:00:00 -08:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -29,12 +29,12 @@ dependencies:
29
29
  requirements:
30
30
  - - "="
31
31
  - !ruby/object:Gem::Version
32
- hash: 29
32
+ hash: 19
33
33
  segments:
34
34
  - 0
35
35
  - 9
36
- - 19
37
- version: 0.9.19
36
+ - 20
37
+ version: 0.9.20
38
38
  type: :runtime
39
39
  version_requirements: *id001
40
40
  - !ruby/object:Gem::Dependency