padrino-helpers 0.16.0.pre4 → 0.16.0

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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +29 -29
  3. data/Rakefile +1 -1
  4. data/lib/padrino/rendering/erb_template.rb +7 -7
  5. data/lib/padrino/rendering/erubi_template.rb +4 -4
  6. data/lib/padrino/rendering/erubis_template.rb +4 -4
  7. data/lib/padrino/rendering/haml_template.rb +1 -1
  8. data/lib/padrino/rendering/hamlit_template.rb +4 -4
  9. data/lib/padrino/rendering/slim_template.rb +5 -5
  10. data/lib/padrino/rendering.rb +54 -45
  11. data/lib/padrino/safe_buffer.rb +31 -36
  12. data/lib/padrino-helpers/asset_tag_helpers.rb +48 -48
  13. data/lib/padrino-helpers/form_builder/abstract_form_builder.rb +74 -70
  14. data/lib/padrino-helpers/form_builder/standard_form_builder.rb +20 -20
  15. data/lib/padrino-helpers/form_helpers/errors.rb +14 -14
  16. data/lib/padrino-helpers/form_helpers/options.rb +25 -24
  17. data/lib/padrino-helpers/form_helpers/security.rb +5 -5
  18. data/lib/padrino-helpers/form_helpers.rb +133 -133
  19. data/lib/padrino-helpers/format_helpers.rb +61 -63
  20. data/lib/padrino-helpers/number_helpers.rb +82 -78
  21. data/lib/padrino-helpers/output_helpers/abstract_handler.rb +5 -3
  22. data/lib/padrino-helpers/output_helpers/erb_handler.rb +2 -2
  23. data/lib/padrino-helpers/output_helpers/haml_handler.rb +1 -1
  24. data/lib/padrino-helpers/output_helpers.rb +16 -17
  25. data/lib/padrino-helpers/render_helpers.rb +28 -27
  26. data/lib/padrino-helpers/tag_helpers.rb +62 -58
  27. data/lib/padrino-helpers/translation_helpers.rb +2 -2
  28. data/lib/padrino-helpers.rb +1 -2
  29. data/padrino-helpers.gemspec +17 -17
  30. data/test/fixtures/apps/render.rb +2 -2
  31. data/test/fixtures/markup_app/app.rb +9 -8
  32. data/test/fixtures/markup_app/views/button_to.erb +3 -3
  33. data/test/fixtures/markup_app/views/button_to.haml +2 -2
  34. data/test/fixtures/markup_app/views/button_to.slim +3 -3
  35. data/test/fixtures/markup_app/views/content_for.erb +4 -4
  36. data/test/fixtures/markup_app/views/content_for.haml +4 -4
  37. data/test/fixtures/markup_app/views/content_for.slim +2 -2
  38. data/test/fixtures/markup_app/views/content_tag.erb +3 -3
  39. data/test/fixtures/markup_app/views/content_tag.haml +3 -3
  40. data/test/fixtures/markup_app/views/content_tag.slim +3 -3
  41. data/test/fixtures/markup_app/views/fields_for.erb +2 -2
  42. data/test/fixtures/markup_app/views/fields_for.haml +2 -2
  43. data/test/fixtures/markup_app/views/fields_for.slim +2 -2
  44. data/test/fixtures/markup_app/views/form_for.erb +41 -41
  45. data/test/fixtures/markup_app/views/form_for.haml +41 -41
  46. data/test/fixtures/markup_app/views/form_for.slim +41 -42
  47. data/test/fixtures/markup_app/views/form_tag.erb +47 -47
  48. data/test/fixtures/markup_app/views/form_tag.haml +48 -48
  49. data/test/fixtures/markup_app/views/form_tag.slim +49 -49
  50. data/test/fixtures/markup_app/views/link_to.erb +2 -2
  51. data/test/fixtures/markup_app/views/link_to.haml +2 -2
  52. data/test/fixtures/markup_app/views/link_to.slim +2 -2
  53. data/test/fixtures/markup_app/views/meta_tag.erb +2 -2
  54. data/test/fixtures/markup_app/views/meta_tag.haml +2 -2
  55. data/test/fixtures/markup_app/views/meta_tag.slim +2 -2
  56. data/test/fixtures/markup_app/views/simple_partial.erb +1 -1
  57. data/test/fixtures/markup_app/views/simple_partial.haml +1 -1
  58. data/test/fixtures/markup_app/views/simple_partial.slim +1 -1
  59. data/test/fixtures/render_app/app.rb +13 -12
  60. data/test/fixtures/render_app/views/_unsafe.html.builder +1 -1
  61. data/test/fixtures/render_app/views/_unsafe_object.html.builder +1 -1
  62. data/test/fixtures/render_app/views/explicit_engine.haml +3 -3
  63. data/test/helper.rb +19 -19
  64. data/test/test_asset_tag_helpers.rb +133 -133
  65. data/test/test_form_builder.rb +629 -628
  66. data/test/test_form_helpers.rb +610 -610
  67. data/test/test_format_helpers.rb +66 -63
  68. data/test/test_helpers.rb +2 -2
  69. data/test/test_locale.rb +13 -11
  70. data/test/test_number_helpers.rb +65 -65
  71. data/test/test_output_helpers.rb +76 -76
  72. data/test/test_render_helpers.rb +101 -101
  73. data/test/test_rendering.rb +329 -326
  74. data/test/test_rendering_extensions.rb +4 -4
  75. data/test/test_tag_helpers.rb +55 -55
  76. metadata +6 -6
@@ -6,14 +6,14 @@
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'
10
10
 
11
11
  .demo_has_content= content_for?(:demo)
12
12
  .fake_has_content= content_for?(:fake)
13
13
 
14
14
  - content_for :demo3 do
15
15
  p.duplication One
16
- - content_for :demo3, :flush => true do
16
+ - content_for :demo3, flush: true do
17
17
  p.duplication Two
18
18
 
19
19
  .demo3= yield_content :demo3
@@ -1,8 +1,8 @@
1
- <%= content_tag :p, "Test 1", :class => 'test', :id => "test1" %>
1
+ <%= content_tag :p, 'Test 1', class: 'test', id: 'test1' %>
2
2
 
3
- <%= content_tag :p, "Test 2" %>
3
+ <%= content_tag :p, 'Test 2' %>
4
4
 
5
- <% content_tag(:p, :class => 'test', :id => 'test3') do %>
5
+ <% content_tag(:p, class: 'test', id: 'test3') do %>
6
6
  <span>Test 3</span>
7
7
  <% end %>
8
8
 
@@ -1,8 +1,8 @@
1
- = content_tag :p, "Test 1", :class => 'test', :id => "test1"
1
+ = content_tag :p, 'Test 1', class: 'test', id: 'test1'
2
2
 
3
- = content_tag :p, "Test 2"
3
+ = content_tag :p, 'Test 2'
4
4
 
5
- = content_tag(:p, :class => 'test', :id => 'test3') do
5
+ = content_tag(:p, class: 'test', id: 'test3') do
6
6
  %span Test 3
7
7
 
8
8
  = content_tag(:p) do
@@ -1,8 +1,8 @@
1
- =content_tag :p, "Test 1", :class => 'test', :id => "test1"
1
+ =content_tag :p, 'Test 1', class: 'test', id: 'test1'
2
2
 
3
- =content_tag :p, "Test 2"
3
+ =content_tag :p, 'Test 2'
4
4
 
5
- =content_tag(:p, :class => 'test', :id => 'test3') do
5
+ =content_tag(:p, class: 'test', id: 'test3') do
6
6
  span Test 3
7
7
 
8
8
  =content_tag(:p) do
@@ -1,5 +1,5 @@
1
1
  <% @user = MarkupUser.new %>
2
- <% form_for @user , '/demo1', :id => 'demo-fields-for' do |f| %>
2
+ <% form_for @user, '/demo1', id: 'demo-fields-for' do |f| %>
3
3
  <%= f.text_field :gender %>
4
4
  <% fields_for @user.permission do |permission| %>
5
5
  <%= permission.check_box :can_edit %>
@@ -14,7 +14,7 @@
14
14
  <%= child_form.text_field :name %>
15
15
  <% unless child_form.object.new_record? %>
16
16
  <%= child_form.check_box '_destroy' %>
17
- <%= child_form.label '_destroy', :caption => 'Remove' %>
17
+ <%= child_form.label '_destroy', caption: 'Remove' %>
18
18
  <% end %>
19
19
  <% end %>
20
20
  <% end %>
@@ -1,5 +1,5 @@
1
1
  - @user = MarkupUser.new
2
- = form_for @user , '/demo1', :id => 'demo-fields-for' do |f|
2
+ = form_for @user , '/demo1', id: 'demo-fields-for' do |f|
3
3
  = f.text_field :gender
4
4
  = fields_for @user.permission do |permission|
5
5
  = permission.check_box :can_edit
@@ -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'
@@ -1,5 +1,5 @@
1
1
  - @user = MarkupUser.new
2
- = form_for @user , '/demo1', :id => 'demo-fields-for' do |f|
2
+ = form_for @user , '/demo1', id: 'demo-fields-for' do |f|
3
3
  = f.text_field :gender
4
4
  = fields_for @user.permission do |permission|
5
5
  = permission.check_box :can_edit
@@ -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'
@@ -1,100 +1,100 @@
1
- <% form_for MarkupUser.new, '/demo', :id => 'demo' do |f| %>
2
- <%= f.error_messages(:header_message => "custom MarkupUser cannot be saved!") %>
1
+ <% form_for MarkupUser.new, '/demo', id: 'demo' do |f| %>
2
+ <%= f.error_messages(header_message: "custom MarkupUser cannot be saved!") %>
3
3
  <%= f.hidden_field :session_id %>
4
4
  <p>
5
- <%= f.label :username, :caption => "Login: ", :class => 'user-label' %>
6
- <%= f.text_field :username, :class => 'user-text', :value => "John" %>
5
+ <%= f.label :username, caption: 'Login: ', class: 'user-label' %>
6
+ <%= f.text_field :username, class: 'user-text', value: 'John' %>
7
7
  </p>
8
8
  <p>
9
9
  <%= f.label :password %>
10
- <%= f.password_field :password, :class => 'user-password', :value => "secret" %>
10
+ <%= f.password_field :password, class: 'user-password', value: 'secret' %>
11
11
  </p>
12
12
  <p>
13
13
  <%= f.label :age %>
14
- <%= f.number_field :age, :class => 'numeric '%>
14
+ <%= f.number_field :age, class: 'numeric '%>
15
15
  </p>
16
16
  <p>
17
17
  <%= f.label :telephone %>
18
- <%= f.telephone_field :telephone, :class => 'numeric' %>
18
+ <%= f.telephone_field :telephone, class: 'numeric' %>
19
19
  </p>
20
20
  <p>
21
- <%= f.label :email, :caption => 'Email Address: ' %>
22
- <%= f.email_field :email, :class => 'string' %>
21
+ <%= f.label :email, caption: 'Email Address: ' %>
22
+ <%= f.email_field :email, class: 'string' %>
23
23
  </p>
24
24
  <p>
25
- <%= f.label :webpage, :caption => 'Your Web Page: ' %>
26
- <%= f.url_field :webpage, :class => 'string' %>
25
+ <%= f.label :webpage, caption: 'Your Web Page: ' %>
26
+ <%= f.url_field :webpage, class: 'string' %>
27
27
  </p>
28
28
  <p>
29
29
  <%= f.label :search %>
30
- <%= f.search_field :search, :class => 'string' %>
30
+ <%= f.search_field :search, class: 'string' %>
31
31
  </p>
32
32
  <p>
33
33
  <%= f.label :photo %>
34
- <%= f.file_field :photo, :class => 'user-photo' %>
34
+ <%= f.file_field :photo, class: 'user-photo' %>
35
35
  </p>
36
36
  <p>
37
- <%= f.label :about, :caption => "About Me: " %>
38
- <%= f.text_area :about, :class => 'user-about' %>
37
+ <%= f.label :about, caption: 'About Me: ' %>
38
+ <%= f.text_area :about, class: 'user-about' %>
39
39
  </p>
40
40
  <p>
41
- <%= f.label :gender, :caption => "Your gender: " %>
42
- <%= f.radio_button :gender, :value => 'male' %>
43
- <%= f.radio_button :gender, :value => 'female' %>
41
+ <%= f.label :gender, caption: 'Your gender: ' %>
42
+ <%= f.radio_button :gender, value: 'male' %>
43
+ <%= f.radio_button :gender, value: 'female' %>
44
44
  </p>
45
45
  <p>
46
- <%= f.label :country, :caption => "Your country" %>
47
- <%= f.select :country, :options => ['USA', 'Canada', 'Mexico'], :selected => 'USA', :class => 'selector' %>
46
+ <%= f.label :country, caption: 'Your country' %>
47
+ <%= f.select :country, options: ['USA', 'Canada', 'Mexico'], selected: 'USA', class: 'selector' %>
48
48
  </p>
49
49
  <p>
50
50
  <%= f.label :remember_me %>
51
- <%= f.check_box :remember_me, :value => '1' %>
51
+ <%= f.check_box :remember_me, value: '1' %>
52
52
  </p>
53
53
  <p>
54
54
  <%= f.label :datetime %>
55
- <%= f.datetime_field :datetime, :max => DateTime.new(2000, 4, 1, 12, 0, 0) %>
55
+ <%= f.datetime_field :datetime, max: DateTime.new(2000, 4, 1, 12, 0, 0) %>
56
56
  </p>
57
57
  <p>
58
58
  <%= f.label :datetime_local %>
59
- <%= f.datetime_local_field :datetime_local, :max => DateTime.new(2000, 4, 1, 12, 0, 0) %>
59
+ <%= f.datetime_local_field :datetime_local, max: DateTime.new(2000, 4, 1, 12, 0, 0) %>
60
60
  </p>
61
61
  <p>
62
62
  <%= f.label :date %>
63
- <%= f.date_field :date, :max => DateTime.new(2000, 4, 1) %>
63
+ <%= f.date_field :date, max: DateTime.new(2000, 4, 1) %>
64
64
  </p>
65
65
  <p>
66
66
  <%= f.label :month %>
67
- <%= f.month_field :month, :max => DateTime.new(2000, 4, 1) %>
67
+ <%= f.month_field :month, max: DateTime.new(2000, 4, 1) %>
68
68
  </p>
69
69
  <p>
70
70
  <%= f.label :week %>
71
- <%= f.week_field :week, :max => DateTime.new(2000, 4, 1) %>
71
+ <%= f.week_field :week, max: DateTime.new(2000, 4, 1) %>
72
72
  </p>
73
73
  <p>
74
74
  <%= f.label :time %>
75
- <%= f.time_field :time, :max => Time.new(2008, 6, 21, 13, 30, 0) %>
75
+ <%= f.time_field :time, max: Time.new(2008, 6, 21, 13, 30, 0) %>
76
76
  </p>
77
77
  <p>
78
78
  <%= f.label :color %>
79
- <%= f.color_field :color, :value => "#f00" %>
79
+ <%= f.color_field :color, value: '#f00' %>
80
80
  </p>
81
- <p><%= f.submit "Create", :class => 'success', :id => 'demo-button' %></p>
82
- <p><%= f.image_submit "buttons/post.png", :class => 'success', :id => 'image-button' %></p>
81
+ <p><%= f.submit "Create", class: 'success', id: 'demo-button' %></p>
82
+ <p><%= f.image_submit "buttons/post.png", class: 'success', id: 'image-button' %></p>
83
83
  <% end %>
84
84
 
85
- <% form_for MarkupUser.new, '/another_demo', :id => 'demo2', :method => 'get' do |f| %>
86
- <%= f.error_messages :header_message => "custom MarkupUser cannot be saved!" %>
85
+ <% form_for MarkupUser.new, '/another_demo', id: 'demo2', method: 'get' do |f| %>
86
+ <%= f.error_messages header_message: "custom MarkupUser cannot be saved!" %>
87
87
  <%= f.hidden_field :session_id %>
88
- <%= f.text_field_block :username, { :class => 'input' }, { :caption => 'Nickname: ', :class => 'label' } %>
89
- <%= f.password_field_block :code, { :class => 'input' } %>
90
- <%= f.text_area_block :about, { :class => 'textarea' } %>
91
- <%= f.file_field_block :photo, { :class => 'upload' } %>
92
- <%= f.check_box_block :remember_me, { :class => 'checker' } %>
93
- <%= f.select_block :state, :options => ['California', 'Texas'], :class => 'selector' %>
94
- <%= f.submit_block "Create", { :class => 'button' } %>
95
- <%= f.image_submit_block "buttons/ok.png", { :class => 'image' } %>
88
+ <%= f.text_field_block :username, { class: 'input' }, { caption: 'Nickname: ', class: 'label' } %>
89
+ <%= f.password_field_block :code, { class: 'input' } %>
90
+ <%= f.text_area_block :about, { class: 'textarea' } %>
91
+ <%= f.file_field_block :photo, { class: 'upload' } %>
92
+ <%= f.check_box_block :remember_me, { class: 'checker' } %>
93
+ <%= f.select_block :state, options: ['California', 'Texas'], class: 'selector' %>
94
+ <%= f.submit_block "Create", { class: 'button' } %>
95
+ <%= f.image_submit_block "buttons/ok.png", { class: 'image' } %>
96
96
  <% end %>
97
97
 
98
- <% form_for :markup_user, '/third_demo', :id => 'demo3', :method => 'get' do |f| %>
98
+ <% form_for :markup_user, '/third_demo', id: 'demo3', method: 'get' do |f| %>
99
99
  <%= f.text_field_block :username %>
100
100
  <% end %>
@@ -1,81 +1,81 @@
1
- = form_for MarkupUser.new, '/demo', :id => 'demo' do |f|
2
- = f.error_messages(:header_message => "custom MarkupUser cannot be saved!")
1
+ = form_for MarkupUser.new, '/demo', id: 'demo' do |f|
2
+ = f.error_messages(header_message: 'custom MarkupUser cannot be saved!')
3
3
  = f.hidden_field :session_id
4
4
  %p
5
- = f.label :username, :caption => "Login: ", :class => 'user-label'
6
- = f.text_field :username, :class => 'user-text', :value => "John"
5
+ = f.label :username, caption: 'Login: ', class: 'user-label'
6
+ = f.text_field :username, class: 'user-text', value: 'John'
7
7
  %p
8
8
  = f.label :password
9
- = f.password_field :password, :class => 'user-password', :value => "secret"
9
+ = f.password_field :password, class: 'user-password', value: 'secret'
10
10
  %p
11
11
  = f.label :age
12
- = f.number_field :age, :class => 'numeric'
12
+ = f.number_field :age, class: 'numeric'
13
13
  %p
14
14
  = f.label :telephone
15
- = f.telephone_field :telephone, :class => 'numeric'
15
+ = f.telephone_field :telephone, class: 'numeric'
16
16
  %p
17
- = f.label :email, :caption => 'Email Address: '
18
- = f.email_field :email, :class => 'string'
17
+ = f.label :email, caption: 'Email Address: '
18
+ = f.email_field :email, class: 'string'
19
19
  %p
20
- = f.label :webpage, :caption => 'Your Web Page: '
21
- = f.url_field :webpage, :class => 'string'
20
+ = f.label :webpage, caption: 'Your Web Page: '
21
+ = f.url_field :webpage, class: 'string'
22
22
  %p
23
23
  = f.label :search
24
- = f.search_field :search, :class => 'string'
24
+ = f.search_field :search, class: 'string'
25
25
  %p
26
26
  = f.label :photo
27
- = f.file_field :photo, :class => 'user-photo'
27
+ = f.file_field :photo, class: 'user-photo'
28
28
  %p
29
- = f.label :about, :caption => "About Me: "
30
- = f.text_area :about, :class => 'user-about'
29
+ = f.label :about, caption: 'About Me: '
30
+ = f.text_area :about, class: 'user-about'
31
31
  %p
32
- = f.label :gender, :caption => "Your gender: "
33
- = f.radio_button :gender, :value => 'male'
34
- = f.radio_button :gender, :value => 'female'
32
+ = f.label :gender, caption: 'Your gender: '
33
+ = f.radio_button :gender, value: 'male'
34
+ = f.radio_button :gender, value: 'female'
35
35
  %p
36
- = f.label :country, :caption => "Your country"
37
- = f.select :country, :options => ['USA', 'Canada', 'Mexico'], :selected => 'USA', :class => 'selector'
36
+ = f.label :country, caption: 'Your country'
37
+ = f.select :country, options: ['USA', 'Canada', 'Mexico'], selected: 'USA', class: 'selector'
38
38
  %p
39
39
  = f.label :remember_me
40
- = f.check_box :remember_me, :value => "1"
40
+ = f.check_box :remember_me, value: '1'
41
41
  %p
42
42
  = f.label :datetime
43
- = f.datetime_field :datetime, :max => DateTime.new(2000, 4, 1, 12, 0, 0)
43
+ = f.datetime_field :datetime, max: DateTime.new(2000, 4, 1, 12, 0, 0)
44
44
  %p
45
45
  = f.label :datetime_local
46
- = f.datetime_local_field :datetime_local, :max => DateTime.new(2000, 4, 1, 12, 0, 0)
46
+ = f.datetime_local_field :datetime_local, max: DateTime.new(2000, 4, 1, 12, 0, 0)
47
47
  %p
48
48
  = f.label :date
49
- = f.date_field :date, :max => DateTime.new(2000, 4, 1)
49
+ = f.date_field :date, max: DateTime.new(2000, 4, 1)
50
50
  %p
51
51
  = f.label :month
52
- = f.month_field :month, :max => DateTime.new(2000, 4, 1)
52
+ = f.month_field :month, max: DateTime.new(2000, 4, 1)
53
53
  %p
54
54
  = f.label :week
55
- = f.week_field :week, :max => DateTime.new(2000, 4, 1)
55
+ = f.week_field :week, max: DateTime.new(2000, 4, 1)
56
56
  %p
57
57
  = f.label :time
58
- = f.time_field :time, :max => Time.new(2008, 6, 21, 13, 30, 0)
58
+ = f.time_field :time, max: Time.new(2008, 6, 21, 13, 30, 0)
59
59
  %p
60
60
  = f.label :color
61
- = f.color_field :color, :value => "#f00"
61
+ = f.color_field :color, value: '#f00'
62
62
  </p>
63
63
  %p
64
- = f.submit "Create", :class => 'success', :id => 'demo-button'
64
+ = f.submit 'Create', class: 'success', id: 'demo-button'
65
65
  %p
66
- = f.image_submit "buttons/post.png", :class => 'success', :id => 'image-button'
66
+ = f.image_submit 'buttons/post.png', class: 'success', id: 'image-button'
67
67
 
68
- = form_for MarkupUser.new, '/another_demo', :id => 'demo2', :method => 'get' do |f|
69
- = f.error_messages :header_message => "custom MarkupUser cannot be saved!"
68
+ = form_for MarkupUser.new, '/another_demo', id: 'demo2', method: 'get' do |f|
69
+ = f.error_messages header_message: 'custom MarkupUser cannot be saved!'
70
70
  = f.hidden_field :session_id
71
- = f.text_field_block :username, { :class => 'input' }, { :caption => 'Nickname: ', :class => 'label' }
72
- = f.password_field_block :code, { :class => 'input' }
73
- = f.text_area_block :about, { :class => 'textarea' }
74
- = f.file_field_block :photo, { :class => 'upload' }
75
- = f.check_box_block :remember_me, { :class => 'checker' }
76
- = f.select_block :state, :options => ['California', 'Texas'], :class => 'selector'
77
- = f.submit_block "Create", { :class => 'button' }
78
- = f.image_submit_block "buttons/ok.png", { :class => 'image' }
71
+ = f.text_field_block :username, { class: 'input' }, { caption: 'Nickname: ', class: 'label' }
72
+ = f.password_field_block :code, { class: 'input' }
73
+ = f.text_area_block :about, { class: 'textarea' }
74
+ = f.file_field_block :photo, { class: 'upload' }
75
+ = f.check_box_block :remember_me, { class: 'checker' }
76
+ = f.select_block :state, options: ['California', 'Texas'], class: 'selector'
77
+ = f.submit_block 'Create', { class: 'button' }
78
+ = f.image_submit_block 'buttons/ok.png', { class: 'image' }
79
79
 
80
- = form_for :markup_user, '/third_demo', :id => 'demo3', :method => 'get' do |f|
80
+ = form_for :markup_user, '/third_demo', id: 'demo3', method: 'get' do |f|
81
81
  = f.text_field_block :username
@@ -1,80 +1,79 @@
1
- = form_for MarkupUser.new, '/demo', :id => 'demo' do |f|
2
- = f.error_messages(:header_message => "custom MarkupUser cannot be saved!")
1
+ = form_for MarkupUser.new, '/demo', id: 'demo' do |f|
2
+ = f.error_messages(header_message: 'custom MarkupUser cannot be saved!')
3
3
  = f.hidden_field :session_id
4
4
  p
5
- = f.label :username, :caption => "Login: ", :class => 'user-label'
6
- = f.text_field :username, :class => 'user-text', :value => "John"
5
+ = f.label :username, caption: 'Login: ', class: 'user-label'
6
+ = f.text_field :username, class: 'user-text', value: 'John'
7
7
  p
8
8
  = f.label :password
9
- = f.password_field :password, :class => 'user-password', :value => "secret"
9
+ = f.password_field :password, class: 'user-password', value: 'secret'
10
10
  p
11
11
  = f.label :age
12
- = f.number_field :age, :class => 'numeric'
12
+ = f.number_field :age, class: 'numeric'
13
13
  p
14
14
  = f.label :telephone
15
- = f.telephone_field :telephone, :class => 'numeric'
15
+ = f.telephone_field :telephone, class: 'numeric'
16
16
  p
17
- = f.label :email, :caption => 'Email Address: '
18
- = f.email_field :email, :class => 'string'
17
+ = f.label :email, caption: 'Email Address: '
18
+ = f.email_field :email, class: 'string'
19
19
  p
20
- = f.label :webpage, :caption => 'Your Web Page: '
21
- = f.url_field :webpage, :class => 'string'
20
+ = f.label :webpage, caption: 'Your Web Page: '
21
+ = f.url_field :webpage, class: 'string'
22
22
  p
23
23
  = f.label :search
24
- = f.search_field :search, :class => 'string'
24
+ = f.search_field :search, class: 'string'
25
25
  p
26
26
  = f.label :photo
27
- = f.file_field :photo, :class => 'user-photo'
27
+ = f.file_field :photo, class: 'user-photo'
28
28
  p
29
- = f.label :about, :caption => "About Me: "
30
- = f.text_area :about, :class => 'user-about'
29
+ = f.label :about, caption: 'About Me: '
30
+ = f.text_area :about, class: 'user-about'
31
31
  p
32
- = f.label :gender, :caption => "Your gender: "
33
- = f.radio_button :gender, :value => 'male'
34
- = f.radio_button :gender, :value => 'female'
32
+ = f.label :gender, caption: 'Your gender: '
33
+ = f.radio_button :gender, value: 'male'
34
+ = f.radio_button :gender, value: 'female'
35
35
  p
36
- = f.label :country, :caption => "Your country"
37
- = f.select :country, :options => ['USA', 'Canada', 'Mexico'], :selected => 'USA', :class => 'selector'
36
+ = f.label :country, caption: 'Your country'
37
+ = f.select :country, options: ['USA', 'Canada', 'Mexico'], selected: 'USA', class: 'selector'
38
38
  p
39
39
  = f.label :remember_me
40
- = f.check_box :remember_me, :value => "1"
40
+ = f.check_box :remember_me, value: '1'
41
41
  p
42
42
  = f.label :datetime
43
- = f.datetime_field :datetime, :max => DateTime.new(2000, 4, 1, 12, 0, 0)
43
+ = f.datetime_field :datetime, max: DateTime.new(2000, 4, 1, 12, 0, 0)
44
44
  p
45
45
  = f.label :datetime_local
46
- = f.datetime_local_field :datetime_local, :max => DateTime.new(2000, 4, 1, 12, 0, 0)
46
+ = f.datetime_local_field :datetime_local, max: DateTime.new(2000, 4, 1, 12, 0, 0)
47
47
  p
48
48
  = f.label :date
49
- = f.date_field :date, :max => DateTime.new(2000, 4, 1)
49
+ = f.date_field :date, max: DateTime.new(2000, 4, 1)
50
50
  p
51
51
  = f.label :month
52
- = f.month_field :month, :max => DateTime.new(2000, 4, 1)
52
+ = f.month_field :month, max: DateTime.new(2000, 4, 1)
53
53
  p
54
54
  = f.label :week
55
- = f.week_field :week, :max => DateTime.new(2000, 4, 1)
55
+ = f.week_field :week, max: DateTime.new(2000, 4, 1)
56
56
  p
57
57
  = f.label :time
58
- = f.time_field :time, :max => Time.new(2008, 6, 21, 13, 30, 0)
58
+ = f.time_field :time, max: Time.new(2008, 6, 21, 13, 30, 0)
59
59
  p
60
60
  = f.label :color
61
- = f.color_field :color, :value => "#f00"
61
+ = f.color_field :color, value: '#f00'
62
62
  p
63
- = f.submit "Create", :class => 'success', :id => 'demo-button'
63
+ = f.submit 'Create', class: 'success', id: 'demo-button'
64
64
  p
65
- = f.image_submit "buttons/post.png", :class => 'success', :id => 'image-button'
66
-
67
- = form_for MarkupUser.new, '/another_demo', :id => 'demo2', :method => 'get' do |f|
68
- = f.error_messages :header_message => "custom MarkupUser cannot be saved!"
65
+ = f.image_submit 'buttons/post.png', class: 'success', id: 'image-button'
66
+ = form_for MarkupUser.new, '/another_demo', id: 'demo2', method: 'get' do |f|
67
+ = f.error_messages header_message: 'custom MarkupUser cannot be saved!'
69
68
  = f.hidden_field :session_id
70
- = f.text_field_block :username, { :class => 'input' }, { :caption => 'Nickname: ', :class => 'label' }
71
- = f.password_field_block :code, { :class => 'input' }
72
- = f.text_area_block :about, { :class => 'textarea' }
73
- = f.file_field_block :photo, { :class => 'upload' }
74
- = f.check_box_block :remember_me, { :class => 'checker' }
75
- = f.select_block :state, :options => ['California', 'Texas'], :class => 'selector'
76
- = f.submit_block "Create", { :class => 'button' }
77
- = f.image_submit_block "buttons/ok.png", { :class => 'image' }
69
+ = f.text_field_block :username, { class: 'input' }, { caption: 'Nickname: ', class: 'label' }
70
+ = f.password_field_block :code, { class: 'input' }
71
+ = f.text_area_block :about, { class: 'textarea' }
72
+ = f.file_field_block :photo, { class: 'upload' }
73
+ = f.check_box_block :remember_me, { class: 'checker' }
74
+ = f.select_block :state, options: ['California', 'Texas'], class: 'selector'
75
+ = f.submit_block 'Create', { class: 'button' }
76
+ = f.image_submit_block "buttons/ok.png", { class: 'image' }
78
77
 
79
- = form_for :markup_user, '/third_demo', :id => 'demo3', :method => 'get' do |f|
78
+ = form_for :markup_user, '/third_demo', id: 'demo3', method: 'get' do |f|
80
79
  = f.text_field_block :username