padrino-helpers 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/README.rdoc +1 -1
  2. data/lib/padrino-helpers/asset_tag_helpers.rb +1 -1
  3. data/lib/padrino-helpers/form_builder/abstract_form_builder.rb +3 -3
  4. data/lib/padrino-helpers/form_builder/standard_form_builder.rb +3 -3
  5. data/lib/padrino-helpers/form_helpers.rb +1 -1
  6. data/lib/padrino-helpers/format_helpers.rb +1 -1
  7. data/lib/padrino-helpers/locale/da.yml +1 -1
  8. data/lib/padrino-helpers/locale/en.yml +1 -1
  9. data/lib/padrino-helpers/locale/es.yml +1 -1
  10. data/lib/padrino-helpers/locale/hu.yml +1 -1
  11. data/lib/padrino-helpers/locale/it.yml +1 -1
  12. data/lib/padrino-helpers/locale/no.yml +1 -1
  13. data/lib/padrino-helpers/locale/pl.yml +1 -1
  14. data/lib/padrino-helpers/locale/pt_br.yml +1 -1
  15. data/lib/padrino-helpers/locale/ru.yml +1 -1
  16. data/lib/padrino-helpers/locale/tr.yml +1 -1
  17. data/lib/padrino-helpers/locale/uk.yml +1 -1
  18. data/lib/padrino-helpers/number_helpers.rb +1 -1
  19. data/lib/padrino-helpers/output_helpers/abstract_handler.rb +1 -1
  20. data/lib/padrino-helpers/output_helpers/erb_handler.rb +1 -1
  21. data/lib/padrino-helpers/output_helpers/haml_handler.rb +1 -1
  22. data/lib/padrino-helpers/output_helpers/slim_handler.rb +1 -1
  23. data/lib/padrino-helpers/output_helpers.rb +3 -3
  24. data/lib/padrino-helpers/render_helpers.rb +2 -1
  25. data/lib/padrino-helpers/tag_helpers.rb +18 -2
  26. data/lib/padrino-helpers/translation_helpers.rb +1 -1
  27. data/lib/padrino-helpers.rb +1 -1
  28. data/padrino-helpers.gemspec +2 -2
  29. data/test/fixtures/markup_app/app.rb +1 -1
  30. data/test/fixtures/markup_app/views/capture_concat.erb +1 -1
  31. data/test/fixtures/markup_app/views/content_for.erb +1 -1
  32. data/test/fixtures/markup_app/views/content_for.haml +1 -1
  33. data/test/fixtures/markup_app/views/content_for.slim +1 -1
  34. data/test/fixtures/markup_app/views/content_tag.erb +1 -1
  35. data/test/fixtures/markup_app/views/current_engine.erb +1 -1
  36. data/test/fixtures/markup_app/views/current_engine.haml +1 -1
  37. data/test/fixtures/markup_app/views/current_engine.slim +1 -1
  38. data/test/fixtures/markup_app/views/fields_for.erb +1 -1
  39. data/test/fixtures/markup_app/views/fields_for.haml +1 -1
  40. data/test/fixtures/markup_app/views/fields_for.slim +1 -1
  41. data/test/fixtures/markup_app/views/form_for.erb +1 -1
  42. data/test/fixtures/markup_app/views/form_for.haml +1 -1
  43. data/test/fixtures/markup_app/views/form_for.slim +1 -1
  44. data/test/fixtures/markup_app/views/form_tag.erb +1 -1
  45. data/test/fixtures/markup_app/views/form_tag.haml +1 -1
  46. data/test/fixtures/markup_app/views/form_tag.slim +1 -1
  47. data/test/fixtures/markup_app/views/link_to.erb +1 -1
  48. data/test/fixtures/markup_app/views/link_to.haml +1 -1
  49. data/test/fixtures/markup_app/views/link_to.slim +1 -1
  50. data/test/fixtures/markup_app/views/mail_to.erb +1 -1
  51. data/test/fixtures/markup_app/views/mail_to.haml +1 -1
  52. data/test/fixtures/markup_app/views/mail_to.slim +1 -1
  53. data/test/fixtures/markup_app/views/meta_tag.erb +1 -1
  54. data/test/fixtures/markup_app/views/meta_tag.haml +1 -1
  55. data/test/fixtures/markup_app/views/meta_tag.slim +1 -1
  56. data/test/fixtures/markup_app/views/partials/_erb.erb +1 -1
  57. data/test/fixtures/markup_app/views/partials/_haml.haml +1 -1
  58. data/test/fixtures/markup_app/views/partials/_slim.slim +1 -1
  59. data/test/fixtures/markup_app/views/simple_partial.erb +1 -1
  60. data/test/fixtures/markup_app/views/simple_partial.haml +1 -1
  61. data/test/fixtures/markup_app/views/simple_partial.slim +1 -1
  62. data/test/fixtures/render_app/app.rb +6 -1
  63. data/test/fixtures/render_app/views/current_engine.haml +1 -1
  64. data/test/fixtures/render_app/views/current_engines/_erb.erb +1 -1
  65. data/test/fixtures/render_app/views/current_engines/_haml.haml +1 -1
  66. data/test/fixtures/render_app/views/current_engines/_slim.slim +1 -1
  67. data/test/fixtures/render_app/views/erb/test.erb +1 -1
  68. data/test/fixtures/render_app/views/explicit_engine.haml +1 -1
  69. data/test/fixtures/render_app/views/haml/test.haml +1 -1
  70. data/test/fixtures/render_app/views/template/_user.haml +1 -1
  71. data/test/fixtures/render_app/views/template/haml_template.haml +1 -1
  72. data/test/fixtures/render_app/views/template/some_template.haml +1 -1
  73. data/test/helper.rb +2 -2
  74. data/test/test_asset_tag_helpers.rb +1 -1
  75. data/test/test_form_helpers.rb +1 -1
  76. data/test/test_format_helpers.rb +1 -1
  77. data/test/test_number_helpers.rb +1 -1
  78. data/test/test_output_helpers.rb +1 -1
  79. data/test/test_render_helpers.rb +8 -1
  80. data/test/test_tag_helpers.rb +6 -1
  81. metadata +26 -4
data/README.rdoc CHANGED
@@ -236,4 +236,4 @@ For more information on using the render and partial helpers, check out the guid
236
236
 
237
237
  == Copyright
238
238
 
239
- Copyright (c) 2011 Padrino. See LICENSE for details.
239
+ Copyright (c) 2011 Padrino. See LICENSE for details.
@@ -285,4 +285,4 @@ module Padrino
285
285
  end
286
286
  end # AssetTagHelpers
287
287
  end # Helpers
288
- end # Padrino
288
+ end # Padrino
@@ -1,7 +1,7 @@
1
1
  module Padrino
2
2
  module Helpers
3
- module FormBuilder #:nodoc:
4
- class AbstractFormBuilder #:nodoc:
3
+ module FormBuilder # @private
4
+ class AbstractFormBuilder # @private
5
5
  attr_accessor :template, :object
6
6
 
7
7
  def initialize(template, object, options={})
@@ -217,4 +217,4 @@ module Padrino
217
217
  end # AbstractFormBuilder
218
218
  end # FormBuilder
219
219
  end # Helpers
220
- end # Padrino
220
+ end # Padrino
@@ -2,8 +2,8 @@ require File.expand_path(File.dirname(__FILE__) + '/abstract_form_builder') unle
2
2
 
3
3
  module Padrino
4
4
  module Helpers
5
- module FormBuilder #:nodoc:
6
- class StandardFormBuilder < AbstractFormBuilder #:nodoc:
5
+ module FormBuilder # @private
6
+ class StandardFormBuilder < AbstractFormBuilder # @private
7
7
 
8
8
  ##
9
9
  # StandardFormBuilder
@@ -40,4 +40,4 @@ module Padrino
40
40
  end # StandardFormBuilder
41
41
  end # FormBuilder
42
42
  end # Helpers
43
- end # Padrino
43
+ end # Padrino
@@ -443,4 +443,4 @@ module Padrino
443
443
  end
444
444
  end # FormHelpers
445
445
  end # Helpers
446
- end # Padrino
446
+ end # Padrino
@@ -257,4 +257,4 @@ module Padrino
257
257
  end
258
258
  end # FormatHelpers
259
259
  end # Helpers
260
- end # Padrino
260
+ end # Padrino
@@ -88,4 +88,4 @@ da:
88
88
  header:
89
89
  one: "En fejl forhindrede %{model} i at blive gemt"
90
90
  other: "%{count} fejl forhindrede denne %{model} i at blive gemt"
91
- body: "Der var problemer med følgende felter:"
91
+ body: "Der var problemer med følgende felter:"
@@ -100,4 +100,4 @@ en:
100
100
  header:
101
101
  one: "1 error prohibited this %{model} from being saved"
102
102
  other: "%{count} errors prohibited this %{model} from being saved"
103
- body: "There were problems with the following fields:"
103
+ body: "There were problems with the following fields:"
@@ -100,4 +100,4 @@ es:
100
100
  header:
101
101
  one: "1 error impidió que %{model} se guardara"
102
102
  other: "%{count} erroress impidieron que %{model} se guardara"
103
- body: "Hay problemas con los siguientes campos:"
103
+ body: "Hay problemas con los siguientes campos:"
@@ -100,4 +100,4 @@ hu:
100
100
  header:
101
101
  one: "1 hiba akadályozza a(z) %{model} mentését"
102
102
  other: "%{count} hiba akadályozza a(z) %{model} mentését"
103
- body: "A következő mezőkkel van baj:"
103
+ body: "A következő mezőkkel van baj:"
@@ -86,4 +86,4 @@ it:
86
86
  header:
87
87
  one: "Non posso salvare questo %{model}: 1 errore"
88
88
  other: "Non posso salvare questo %{model}: %{count} errori."
89
- body: "Per favore ricontrolla i seguenti campi:"
89
+ body: "Per favore ricontrolla i seguenti campi:"
@@ -88,4 +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:"
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 @@ pt_br:
100
100
  header:
101
101
  one: "Não posso salvar %{model}: 1 erro"
102
102
  other: "Não posso salvar %{model}: %{count} erros."
103
- body: "Por favor, verifique novamente os seguintes campos:"
103
+ body: "Por favor, verifique novamente os seguintes campos:"
@@ -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: "Допущені помилки в наступних полях:"
@@ -270,4 +270,4 @@ module Padrino
270
270
  end
271
271
  end # NumberHelpers
272
272
  end # Helpers
273
- end # Padrino
273
+ end # Padrino
@@ -100,4 +100,4 @@ module Padrino
100
100
  end # AbstractHandler
101
101
  end # OutputHelpers
102
102
  end # Helpers
103
- end # Padrino
103
+ end # Padrino
@@ -76,4 +76,4 @@ module Padrino
76
76
  OutputHelpers.register(ErbHandler)
77
77
  end # OutputHelpers
78
78
  end # Helpers
79
- end # Padrino
79
+ end # Padrino
@@ -61,4 +61,4 @@ module Padrino
61
61
  OutputHelpers.register(HamlHandler)
62
62
  end # OutputHelpers
63
63
  end # Helpers
64
- end # Padrino
64
+ end # Padrino
@@ -79,4 +79,4 @@ module Padrino
79
79
  OutputHelpers.register(SlimHandler)
80
80
  end # OutputHelpers
81
81
  end # Helpers
82
- end # Padrino
82
+ end # Padrino
@@ -2,7 +2,7 @@ module Padrino
2
2
  module Helpers
3
3
  module OutputHelpers
4
4
 
5
- def self.included(base) #:nodoc:
5
+ def self.included(base) # @private
6
6
  base.send(:include, SinatraCurrentEngine) unless base.method_defined?(:current_engine)
7
7
  end
8
8
 
@@ -12,7 +12,7 @@ module Padrino
12
12
  module SinatraCurrentEngine
13
13
  attr_reader :current_engine
14
14
 
15
- def render(engine, *) #:nodoc:
15
+ def render(engine, *) # @private
16
16
  @current_engine, engine_was = engine, @current_engine
17
17
  output = super
18
18
  @current_engine = engine_was
@@ -125,4 +125,4 @@ module Padrino
125
125
  end
126
126
  end # OutputHelpers
127
127
  end # Helpers
128
- end # Padrino
128
+ end # Padrino
@@ -12,6 +12,7 @@ module Padrino
12
12
  # partial 'photo/item', :engine => :erb
13
13
  #
14
14
  def partial(template, options={})
15
+ logger.debug "PARTIAL: #{template} called" if defined?(logger)
15
16
  options.reverse_merge!(:locals => {}, :layout => false)
16
17
  path = template.to_s.split(File::SEPARATOR)
17
18
  object_name = path[-1].to_sym
@@ -37,4 +38,4 @@ module Padrino
37
38
  alias :render_partial :partial
38
39
  end # RenderHelpers
39
40
  end # Helpers
40
- end # Padrino
41
+ end # Padrino
@@ -1,6 +1,15 @@
1
1
  module Padrino
2
2
  module Helpers
3
3
  module TagHelpers
4
+ ##
5
+ # Tag values escaped to html entities
6
+ #
7
+ ESCAPE_VALUES = {
8
+ "<" => "&lt;",
9
+ ">" => "&gt;",
10
+ '"' => "&quot;"
11
+ }
12
+
4
13
  ##
5
14
  # Creates an html input field with given type and options
6
15
  #
@@ -42,7 +51,7 @@ module Padrino
42
51
  content, open_tag = options.delete(:content), options.delete(:open)
43
52
  content = content.join("\n") if content.respond_to?(:join)
44
53
  identity_tag_attributes.each { |attr| options[attr] = attr.to_s if options[attr] }
45
- html_attrs = options.map { |a, v| v.nil? || v == false ? nil : "#{a}=\"#{v}\"" }.compact.join(" ")
54
+ html_attrs = options.map { |a, v| v.nil? || v == false ? nil : "#{a}=\"#{escape_value(v)}\"" }.compact.join(" ")
46
55
  base_tag = (html_attrs.present? ? "<#{name} #{html_attrs}" : "<#{name}")
47
56
  base_tag << (open_tag ? ">" : (content ? ">#{content}</#{name}>" : " />"))
48
57
  end
@@ -54,6 +63,13 @@ module Padrino
54
63
  def identity_tag_attributes
55
64
  [:checked, :disabled, :selected, :multiple]
56
65
  end
66
+
67
+ ##
68
+ # Escape tag values to their HTML/XML entities.
69
+ #
70
+ def escape_value(string)
71
+ string.to_s.gsub(Regexp.union(*ESCAPE_VALUES.keys)){|c| ESCAPE_VALUES[c] }
72
+ end
57
73
  end # TagHelpers
58
74
  end # Helpers
59
- end # Padrino
75
+ end # Padrino
@@ -18,4 +18,4 @@ module Padrino
18
18
  alias :l :localize
19
19
  end # TranslationHelpers
20
20
  end # Helpers
21
- end # Padrino
21
+ end # Padrino
@@ -48,4 +48,4 @@ module Padrino
48
48
  alias :included :registered
49
49
  end
50
50
  end # Helpers
51
- end # Padrino
51
+ end # Padrino
@@ -23,5 +23,5 @@ Gem::Specification.new do |s|
23
23
  s.rdoc_options = ["--charset=UTF-8"]
24
24
 
25
25
  s.add_dependency("padrino-core", Padrino.version)
26
- s.add_dependency("i18n", "~> 0.5.0")
27
- end
26
+ s.add_dependency("i18n", "~> 0.6")
27
+ end
@@ -70,4 +70,4 @@ end
70
70
 
71
71
  module Outer
72
72
  class UserAccount; end
73
- end
73
+ end
@@ -11,4 +11,4 @@
11
11
  <span>This is erb</span>
12
12
  <% end %>
13
13
 
14
- <% ruby_not_template_block %>
14
+ <% ruby_not_template_block %>
@@ -8,4 +8,4 @@
8
8
  <h1>This is content yielded with name <%= fname + " " + lname %></h1>
9
9
  <% end %>
10
10
 
11
- <div class='demo2'><%= yield_content :demo2, "Johnny", "Smith" %></div>
11
+ <div class='demo2'><%= yield_content :demo2, "Johnny", "Smith" %></div>
@@ -6,4 +6,4 @@
6
6
  - content_for :demo2 do |fname, lname|
7
7
  %h1 This is content yielded with name #{fname + " " + lname}
8
8
 
9
- .demo2= yield_content :demo2, "Johnny", "Smith"
9
+ .demo2= yield_content :demo2, "Johnny", "Smith"
@@ -6,4 +6,4 @@
6
6
  - content_for :demo2 do |fname, lname|
7
7
  h1 This is content yielded with name #{fname + " " + lname}
8
8
 
9
- .demo2== yield_content :demo2, "Johnny", "Smith"
9
+ .demo2== yield_content :demo2, "Johnny", "Smith"
@@ -8,4 +8,4 @@
8
8
 
9
9
  <% content_tag(:p) do %>
10
10
  <span>Test 4</span>
11
- <% end %>
11
+ <% end %>
@@ -2,4 +2,4 @@
2
2
  <p class="haml"><%= haml :'partials/_haml' %></p>
3
3
  <p class="erb"><%= erb :'partials/_erb' %></p>
4
4
  <p class="slim"><%= slim :'partials/_slim' %></p>
5
- <p class="end"><%= current_engine %></p>
5
+ <p class="end"><%= current_engine %></p>
@@ -2,4 +2,4 @@
2
2
  %p.haml= haml :'partials/_haml'
3
3
  %p.erb= erb :'partials/_erb'
4
4
  %p.slim= slim :'partials/_slim'
5
- %p.end= current_engine
5
+ %p.end= current_engine
@@ -2,4 +2,4 @@ p.start= current_engine
2
2
  p.haml= haml :'partials/_haml'
3
3
  p.erb= erb :'partials/_erb'
4
4
  p.slim= slim :'partials/_slim'
5
- p.end= current_engine
5
+ p.end= current_engine
@@ -17,4 +17,4 @@
17
17
  <%= child_form.label '_destroy', :caption => 'Remove' %>
18
18
  <% end %>
19
19
  <% end %>
20
- <% end %>
20
+ <% end %>
@@ -12,4 +12,4 @@
12
12
  = child_form.text_field :name
13
13
  - unless child_form.object.new_record?
14
14
  = child_form.check_box '_destroy'
15
- = child_form.label '_destroy', :caption => 'Remove'
15
+ = child_form.label '_destroy', :caption => 'Remove'
@@ -12,4 +12,4 @@
12
12
  == child_form.text_field :name
13
13
  - unless child_form.object.new_record?
14
14
  == child_form.check_box '_destroy'
15
- == child_form.label '_destroy', :caption => 'Remove'
15
+ == child_form.label '_destroy', :caption => 'Remove'
@@ -53,4 +53,4 @@
53
53
 
54
54
  <% form_for :markup_user, '/third_demo', :id => 'demo3', :method => 'get' do |f| %>
55
55
  <%= f.text_field_block :username %>
56
- <% end %>
56
+ <% end %>
@@ -44,4 +44,4 @@
44
44
  = f.image_submit_block "buttons/ok.png", { :class => 'image' }
45
45
 
46
46
  - form_for :markup_user, '/third_demo', :id => 'demo3', :method => 'get' do |f|
47
- = f.text_field_block :username
47
+ = f.text_field_block :username
@@ -44,4 +44,4 @@
44
44
  == f.image_submit_block "buttons/ok.png", { :class => 'image' }
45
45
 
46
46
  == form_for :markup_user, '/third_demo', :id => 'demo3', :method => 'get' do |f|
47
- == f.text_field_block :username
47
+ == f.text_field_block :username
@@ -53,4 +53,4 @@
53
53
  <%= button_tag "Cancel" %>
54
54
  <%= image_submit_tag "buttons/submit.png" %>
55
55
  <% end %>
56
- <% end %>
56
+ <% end %>
@@ -42,4 +42,4 @@
42
42
  - field_set_tag(:class => 'buttons') do
43
43
  = submit_tag "Login"
44
44
  = button_tag "Cancel"
45
- = image_submit_tag "buttons/submit.png"
45
+ = image_submit_tag "buttons/submit.png"
@@ -42,4 +42,4 @@
42
42
  == field_set_tag(:class => 'buttons') do
43
43
  == submit_tag "Login"
44
44
  == button_tag "Cancel"
45
- == image_submit_tag "buttons/submit.png"
45
+ == image_submit_tag "buttons/submit.png"
@@ -2,4 +2,4 @@
2
2
 
3
3
  <% link_to("/test2", :class => 'test', :id => 'test2') do %>
4
4
  <span>Test 2 With Block</span>
5
- <% end %>
5
+ <% end %>
@@ -1,4 +1,4 @@
1
1
  = link_to "Test 1 No Block", '/test1', :class => 'test', :id => 'test1'
2
2
 
3
3
  - link_to("/test2", :class => 'test', :id => 'test2') do
4
- %span Test 2 With Block
4
+ %span Test 2 With Block
@@ -1,4 +1,4 @@
1
1
  = link_to "Test 1 No Block", '/test1', :class => 'test', :id => 'test1'
2
2
 
3
3
  - link_to("/test2", :class => 'test', :id => 'test2') do
4
- span Test 2 With Block
4
+ span Test 2 With Block
@@ -1,3 +1,3 @@
1
1
  <p class='simple'><%= mail_to 'test@demo.com' %></p>
2
2
 
3
- <p class='captioned'><%= mail_to 'test@demo.com', "Click my Email" %></p>
3
+ <p class='captioned'><%= mail_to 'test@demo.com', "Click my Email" %></p>
@@ -1,3 +1,3 @@
1
1
  %p.simple= mail_to 'test@demo.com'
2
2
 
3
- %p.captioned= mail_to 'test@demo.com', "Click my Email"
3
+ %p.captioned= mail_to 'test@demo.com', "Click my Email"
@@ -1,3 +1,3 @@
1
1
  p.simple== mail_to 'test@demo.com'
2
2
 
3
- p.captioned== mail_to 'test@demo.com', "Click my Email"
3
+ p.captioned== mail_to 'test@demo.com', "Click my Email"
@@ -1,3 +1,3 @@
1
1
  <%= meta_tag "weblog,news", :name => "keywords" %>
2
2
 
3
- <%= meta_tag "text/html; charset=UTF-8", :"http-equiv" => "Content-Type" %>
3
+ <%= meta_tag "text/html; charset=UTF-8", :"http-equiv" => "Content-Type" %>
@@ -1,3 +1,3 @@
1
1
  = meta_tag "weblog,news", :name => "keywords"
2
2
 
3
- = meta_tag "text/html; charset=UTF-8", :"http-equiv" => "Content-Type"
3
+ = meta_tag "text/html; charset=UTF-8", :"http-equiv" => "Content-Type"
@@ -1,3 +1,3 @@
1
1
  == meta_tag "weblog,news", :name => "keywords"
2
2
 
3
- == meta_tag "text/html; charset=UTF-8", :"http-equiv" => "Content-Type"
3
+ == meta_tag "text/html; charset=UTF-8", :"http-equiv" => "Content-Type"
@@ -1 +1 @@
1
- <%= current_engine %>
1
+ <%= current_engine %>
@@ -1 +1 @@
1
- =current_engine
1
+ =current_engine
@@ -1 +1 @@
1
- =current_engine
1
+ =current_engine
@@ -1 +1 @@
1
- <p class="erb"><%= partial 'partials/erb', :engine => "erb" %></p>
1
+ <p class="erb"><%= partial 'partials/erb', :engine => "erb" %></p>
@@ -1 +1 @@
1
- %p.haml= partial 'partials/haml', :engine => "haml"
1
+ %p.haml= partial 'partials/haml', :engine => "haml"
@@ -1 +1 @@
1
- p.slim= partial 'partials/slim', :engine => "slim"
1
+ p.slim= partial 'partials/slim', :engine => "slim"
@@ -42,4 +42,9 @@ class RenderDemo < Padrino::Application
42
42
  get '/partial/locals' do
43
43
  partial 'template/user', :locals => { :user => RenderUser.new('John'), :extra => "bar" }
44
44
  end
45
- end
45
+
46
+ # partial starting with forward slash
47
+ get '/partial/foward_slash' do
48
+ partial '/template/user', :object => RenderUser.new('John'), :locals => { :extra => "bar" }
49
+ end
50
+ end
@@ -2,4 +2,4 @@
2
2
  %p.haml= partial 'current_engines/haml'
3
3
  %p.erb= partial 'current_engines/erb'
4
4
  %p.slim= partial 'current_engines/slim'
5
- %p.end= current_engine
5
+ %p.end= current_engine
@@ -1 +1 @@
1
- <span><%= current_engine %></span>
1
+ <span><%= current_engine %></span>
@@ -1 +1 @@
1
- %span=current_engine
1
+ %span=current_engine
@@ -1 +1 @@
1
- span=current_engine
1
+ span=current_engine
@@ -1 +1 @@
1
- <h1>This is a <%= @template %> template!</h1>
1
+ <h1>This is a <%= @template %> template!</h1>
@@ -2,4 +2,4 @@
2
2
  %p.haml= partial "current_engines/haml", :engine => :haml
3
3
  %p.erb= partial 'current_engines/erb', :engine => :erb
4
4
  %p.slim= partial 'current_engines/slim', :engine => :slim
5
- %p.end= current_engine
5
+ %p.end= current_engine
@@ -1 +1 @@
1
- %h1 This is a #{@template} template!
1
+ %h1 This is a #{@template} template!
@@ -4,4 +4,4 @@
4
4
  %p Extra is #{extra}
5
5
 
6
6
  - if defined?(user_counter)
7
- %p My counter is #{user_counter}
7
+ %p My counter is #{user_counter}
@@ -1 +1 @@
1
- %h1 This is a #{@template} template sent from render_template!
1
+ %h1 This is a #{@template} template sent from render_template!
@@ -1,2 +1,2 @@
1
1
 
2
- %h1 This is a haml template which was detected!
2
+ %h1 This is a haml template which was detected!
data/test/helper.rb CHANGED
@@ -71,8 +71,8 @@ end
71
71
 
72
72
  module Webrat
73
73
  module Logging
74
- def logger # :nodoc:
74
+ def logger # # @private
75
75
  @logger = nil
76
76
  end
77
77
  end
78
- end
78
+ end
@@ -317,4 +317,4 @@ class TestAssetTagHelpers < Test::Unit::TestCase
317
317
  assert_has_tag('link', :type => 'my-type', :rel => 'my-rel', :href => "/blog/post.rss", :title => 'my-title') { feed_tag :rss, "/blog/post.rss", :type => "my-type", :rel => "my-rel", :title => "my-title" }
318
318
  end
319
319
  end
320
- end
320
+ end
@@ -642,4 +642,4 @@ class TestFormHelpers < Test::Unit::TestCase
642
642
  assert_have_selector 'form.advanced-form input[type=image]', :count => 1, :src => "/images/buttons/submit.png?#{@stamp}"
643
643
  end
644
644
  end
645
- end
645
+ end
@@ -224,4 +224,4 @@ class TestFormatHelpers < Test::Unit::TestCase
224
224
  assert_equal "<data-confirm=\\\"are you sure\\\">", js_escape_html("<data-confirm=\"are you sure\">")
225
225
  end
226
226
  end
227
- end
227
+ end
@@ -133,4 +133,4 @@ class TestNumberHelpers < Test::Unit::TestCase
133
133
  assert_equal '1.000,1 TB', number_to_human_size(terabytes(1000.1), :delimiter => '.', :separator => ',')
134
134
  end
135
135
  end
136
- end
136
+ end
@@ -130,4 +130,4 @@ class TestOutputHelpers < Test::Unit::TestCase
130
130
  assert_have_selector 'p.slim', :content => "slim"
131
131
  end
132
132
  end
133
- end
133
+ end
@@ -47,6 +47,13 @@ class TestRenderHelpers < Test::Unit::TestCase
47
47
  end
48
48
  end
49
49
 
50
+ context 'for #partial method taking a path starting with forward slash' do
51
+ setup { visit '/partial/foward_slash' }
52
+ should "render partial without throwing an error" do
53
+ assert_have_selector "h1", :content => "User name is John"
54
+ end
55
+ end
56
+
50
57
  context 'for #current_engine method' do
51
58
  should 'detect correctly current engine for a padrino application' do
52
59
  visit '/current_engine'
@@ -66,4 +73,4 @@ class TestRenderHelpers < Test::Unit::TestCase
66
73
  assert_have_selector 'p.end', :content => "haml"
67
74
  end
68
75
  end
69
- end
76
+ end
@@ -34,6 +34,11 @@ class TestTagHelpers < Test::Unit::TestCase
34
34
  actual_html = tag(:p, :class => 'demo', :open => true)
35
35
  assert_equal "<p class=\"demo\">", actual_html
36
36
  end
37
+
38
+ should "escape html" do
39
+ actual_html = tag(:br, :class => 'Example "bar"')
40
+ assert_equal "<br class=\"Example &quot;bar&quot;\" />", actual_html
41
+ end
37
42
  end
38
43
 
39
44
  context 'for #content_tag method' do
@@ -97,4 +102,4 @@ class TestTagHelpers < Test::Unit::TestCase
97
102
  assert_has_tag('input[type=checkbox]', :disabled => 'disabled') { actual_html }
98
103
  end
99
104
  end
100
- end
105
+ end
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-helpers
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 51
4
5
  prerelease:
5
- version: 0.10.1
6
+ segments:
7
+ - 0
8
+ - 10
9
+ - 2
10
+ version: 0.10.2
6
11
  platform: ruby
7
12
  authors:
8
13
  - Padrino Team
@@ -13,7 +18,7 @@ autorequire:
13
18
  bindir: bin
14
19
  cert_chain: []
15
20
 
16
- date: 2011-08-01 00:00:00 -07:00
21
+ date: 2011-08-31 00:00:00 -07:00
17
22
  default_executable:
18
23
  dependencies:
19
24
  - !ruby/object:Gem::Dependency
@@ -24,7 +29,12 @@ dependencies:
24
29
  requirements:
25
30
  - - "="
26
31
  - !ruby/object:Gem::Version
27
- version: 0.10.1
32
+ hash: 51
33
+ segments:
34
+ - 0
35
+ - 10
36
+ - 2
37
+ version: 0.10.2
28
38
  type: :runtime
29
39
  version_requirements: *id001
30
40
  - !ruby/object:Gem::Dependency
@@ -35,7 +45,11 @@ dependencies:
35
45
  requirements:
36
46
  - - ~>
37
47
  - !ruby/object:Gem::Version
38
- version: 0.5.0
48
+ hash: 7
49
+ segments:
50
+ - 0
51
+ - 6
52
+ version: "0.6"
39
53
  type: :runtime
40
54
  version_requirements: *id002
41
55
  description: Tag helpers, asset helpers, form helpers, form builders and many more helpers for padrino
@@ -158,12 +172,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
158
172
  requirements:
159
173
  - - ">="
160
174
  - !ruby/object:Gem::Version
175
+ hash: 3
176
+ segments:
177
+ - 0
161
178
  version: "0"
162
179
  required_rubygems_version: !ruby/object:Gem::Requirement
163
180
  none: false
164
181
  requirements:
165
182
  - - ">="
166
183
  - !ruby/object:Gem::Version
184
+ hash: 23
185
+ segments:
186
+ - 1
187
+ - 3
188
+ - 6
167
189
  version: 1.3.6
168
190
  requirements: []
169
191