merb-helpers 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. data/LICENSE +20 -0
  2. data/README +180 -0
  3. data/Rakefile +77 -0
  4. data/TODO +5 -0
  5. data/lib/merb-helpers.rb +38 -0
  6. data/lib/merb-helpers/core_ext.rb +57 -0
  7. data/lib/merb-helpers/core_ext/numeric.rb +388 -0
  8. data/lib/merb-helpers/date_time_formatting.rb +127 -0
  9. data/lib/merb-helpers/date_time_helpers.rb +190 -0
  10. data/lib/merb-helpers/form/builder.rb +410 -0
  11. data/lib/merb-helpers/form/helpers.rb +448 -0
  12. data/lib/merb-helpers/form_helpers.rb +24 -0
  13. data/lib/merb-helpers/tag_helpers.rb +61 -0
  14. data/lib/merb-helpers/text_helpers.rb +61 -0
  15. data/lib/merb-helpers/time_dsl.rb +59 -0
  16. data/spec/core_ext_spec.rb +19 -0
  17. data/spec/fixture/app/controllers/application.rb +4 -0
  18. data/spec/fixture/app/controllers/bound_check_box.rb +2 -0
  19. data/spec/fixture/app/controllers/bound_file_field.rb +2 -0
  20. data/spec/fixture/app/controllers/bound_hidden_field.rb +2 -0
  21. data/spec/fixture/app/controllers/bound_option_tag.rb +2 -0
  22. data/spec/fixture/app/controllers/bound_password_field.rb +2 -0
  23. data/spec/fixture/app/controllers/bound_radio_button.rb +2 -0
  24. data/spec/fixture/app/controllers/bound_radio_group.rb +2 -0
  25. data/spec/fixture/app/controllers/bound_select.rb +2 -0
  26. data/spec/fixture/app/controllers/bound_text_area.rb +2 -0
  27. data/spec/fixture/app/controllers/bound_text_field.rb +2 -0
  28. data/spec/fixture/app/controllers/button.rb +2 -0
  29. data/spec/fixture/app/controllers/check_box.rb +2 -0
  30. data/spec/fixture/app/controllers/custom_builder.rb +2 -0
  31. data/spec/fixture/app/controllers/delete_button.rb +2 -0
  32. data/spec/fixture/app/controllers/exceptions.rb +25 -0
  33. data/spec/fixture/app/controllers/field_set.rb +2 -0
  34. data/spec/fixture/app/controllers/fields_for.rb +3 -0
  35. data/spec/fixture/app/controllers/file_field.rb +2 -0
  36. data/spec/fixture/app/controllers/foo.rb +23 -0
  37. data/spec/fixture/app/controllers/form.rb +2 -0
  38. data/spec/fixture/app/controllers/form_for.rb +2 -0
  39. data/spec/fixture/app/controllers/hidden_field.rb +2 -0
  40. data/spec/fixture/app/controllers/label.rb +3 -0
  41. data/spec/fixture/app/controllers/numeric_ext.rb +3 -0
  42. data/spec/fixture/app/controllers/option_tag.rb +2 -0
  43. data/spec/fixture/app/controllers/password_field.rb +2 -0
  44. data/spec/fixture/app/controllers/radio_button.rb +2 -0
  45. data/spec/fixture/app/controllers/radio_group.rb +2 -0
  46. data/spec/fixture/app/controllers/select.rb +2 -0
  47. data/spec/fixture/app/controllers/specs_controller.rb +11 -0
  48. data/spec/fixture/app/controllers/submit.rb +2 -0
  49. data/spec/fixture/app/controllers/tag_helper.rb +21 -0
  50. data/spec/fixture/app/controllers/text_area.rb +2 -0
  51. data/spec/fixture/app/controllers/text_field.rb +3 -0
  52. data/spec/fixture/app/helpers/global_helpers.rb +8 -0
  53. data/spec/fixture/app/models/fake_dm_model.rb +25 -0
  54. data/spec/fixture/app/models/first_generic_fake_model.rb +57 -0
  55. data/spec/fixture/app/models/second_generic_fake_model.rb +18 -0
  56. data/spec/fixture/app/models/third_generic_fake_model.rb +3 -0
  57. data/spec/fixture/app/views/bound_check_box_specs/basic.html.erb +4 -0
  58. data/spec/fixture/app/views/bound_check_box_specs/checked.html.erb +4 -0
  59. data/spec/fixture/app/views/bound_check_box_specs/errors.html.erb +4 -0
  60. data/spec/fixture/app/views/bound_check_box_specs/label.html.erb +3 -0
  61. data/spec/fixture/app/views/bound_check_box_specs/on_and_off.html.erb +3 -0
  62. data/spec/fixture/app/views/bound_check_box_specs/raise_value_error.html.erb +3 -0
  63. data/spec/fixture/app/views/bound_file_field_specs/additional_attributes.html.erb +3 -0
  64. data/spec/fixture/app/views/bound_file_field_specs/takes_string.html.erb +3 -0
  65. data/spec/fixture/app/views/bound_file_field_specs/with_label.html.erb +3 -0
  66. data/spec/fixture/app/views/bound_hidden_field_specs/basic.html.erb +3 -0
  67. data/spec/fixture/app/views/bound_hidden_field_specs/errors.html.erb +3 -0
  68. data/spec/fixture/app/views/bound_hidden_field_specs/hidden_error.html.erb +3 -0
  69. data/spec/fixture/app/views/bound_hidden_field_specs/label.html.erb +3 -0
  70. data/spec/fixture/app/views/bound_option_tag_specs/grouped.html.erb +3 -0
  71. data/spec/fixture/app/views/bound_option_tag_specs/nested.html.erb +3 -0
  72. data/spec/fixture/app/views/bound_option_tag_specs/text_and_value.html.erb +4 -0
  73. data/spec/fixture/app/views/bound_password_field_specs/attributes.html.erb +3 -0
  74. data/spec/fixture/app/views/bound_password_field_specs/basic.html.erb +3 -0
  75. data/spec/fixture/app/views/bound_password_field_specs/label.html.erb +3 -0
  76. data/spec/fixture/app/views/bound_radio_button_specs/basic.html.erb +3 -0
  77. data/spec/fixture/app/views/bound_radio_group_specs/basic.html.erb +3 -0
  78. data/spec/fixture/app/views/bound_radio_group_specs/hashes.html.erb +3 -0
  79. data/spec/fixture/app/views/bound_radio_group_specs/mixed.html.erb +4 -0
  80. data/spec/fixture/app/views/bound_radio_group_specs/override_id.html.erb +3 -0
  81. data/spec/fixture/app/views/bound_select_specs/basic.html.erb +3 -0
  82. data/spec/fixture/app/views/bound_select_specs/blank.html.erb +3 -0
  83. data/spec/fixture/app/views/bound_select_specs/multiple.html.erb +3 -0
  84. data/spec/fixture/app/views/bound_select_specs/prompt.html.erb +3 -0
  85. data/spec/fixture/app/views/bound_select_specs/with_options.html.erb +3 -0
  86. data/spec/fixture/app/views/bound_select_specs/with_options_with_blank.html.erb +3 -0
  87. data/spec/fixture/app/views/bound_text_area_specs/basic.html.erb +3 -0
  88. data/spec/fixture/app/views/bound_text_field_specs/basic.html.erb +3 -0
  89. data/spec/fixture/app/views/button_specs/button_with_label.html.erb +1 -0
  90. data/spec/fixture/app/views/button_specs/button_with_values.html.erb +1 -0
  91. data/spec/fixture/app/views/button_specs/disabled_button.html.erb +1 -0
  92. data/spec/fixture/app/views/check_box_specs/basic.html.erb +1 -0
  93. data/spec/fixture/app/views/check_box_specs/boolean.html.erb +1 -0
  94. data/spec/fixture/app/views/check_box_specs/disabled.html.erb +1 -0
  95. data/spec/fixture/app/views/check_box_specs/label.html.erb +1 -0
  96. data/spec/fixture/app/views/check_box_specs/on_off_is_boolean.html.erb +1 -0
  97. data/spec/fixture/app/views/check_box_specs/raise_unless_both_on_and_off.html.erb +2 -0
  98. data/spec/fixture/app/views/check_box_specs/raises_error_if_not_boolean.html.erb +1 -0
  99. data/spec/fixture/app/views/check_box_specs/raises_error_if_on_off_and_boolean_false.html.erb +1 -0
  100. data/spec/fixture/app/views/check_box_specs/simple.html.erb +1 -0
  101. data/spec/fixture/app/views/check_box_specs/to_string.html.erb +8 -0
  102. data/spec/fixture/app/views/check_box_specs/unchecked.html.erb +2 -0
  103. data/spec/fixture/app/views/custom_builder_specs/everything.html.erb +10 -0
  104. data/spec/fixture/app/views/delete_button_specs/delete_with_explicit_url.html.erb +1 -0
  105. data/spec/fixture/app/views/delete_button_specs/delete_with_extra_params.html.erb +1 -0
  106. data/spec/fixture/app/views/delete_button_specs/delete_with_label.html.erb +1 -0
  107. data/spec/fixture/app/views/delete_button_specs/simple_delete.html.erb +1 -0
  108. data/spec/fixture/app/views/exeptions/client_error.html.erb +37 -0
  109. data/spec/fixture/app/views/exeptions/internal_server_error.html.erb +216 -0
  110. data/spec/fixture/app/views/exeptions/not_acceptable.html.erb +38 -0
  111. data/spec/fixture/app/views/exeptions/not_found.html.erb +40 -0
  112. data/spec/fixture/app/views/fields_for_specs/basic.html.erb +3 -0
  113. data/spec/fixture/app/views/fields_for_specs/midstream.html.erb +7 -0
  114. data/spec/fixture/app/views/fields_for_specs/nil.html.erb +3 -0
  115. data/spec/fixture/app/views/fieldset_specs/legend.html.erb +3 -0
  116. data/spec/fixture/app/views/file_field_specs/disabled.html.erb +1 -0
  117. data/spec/fixture/app/views/file_field_specs/makes_multipart.html.erb +3 -0
  118. data/spec/fixture/app/views/file_field_specs/with_label.html.erb +1 -0
  119. data/spec/fixture/app/views/file_field_specs/with_values.html.erb +1 -0
  120. data/spec/fixture/app/views/foo/bar.html.erb +0 -0
  121. data/spec/fixture/app/views/form_for_specs/basic.html.erb +3 -0
  122. data/spec/fixture/app/views/form_specs/create_a_form.html.erb +3 -0
  123. data/spec/fixture/app/views/form_specs/create_a_multipart_form.html.erb +3 -0
  124. data/spec/fixture/app/views/form_specs/fake_delete_if_set.html.erb +3 -0
  125. data/spec/fixture/app/views/form_specs/fake_put_if_set.html.erb +3 -0
  126. data/spec/fixture/app/views/form_specs/get_if_set.html.erb +3 -0
  127. data/spec/fixture/app/views/form_specs/post_by_default.html.erb +3 -0
  128. data/spec/fixture/app/views/form_specs/resourceful_form.html.erb +3 -0
  129. data/spec/fixture/app/views/hidden_field_specs/basic.html.erb +1 -0
  130. data/spec/fixture/app/views/hidden_field_specs/disabled.html.erb +1 -0
  131. data/spec/fixture/app/views/hidden_field_specs/label.html.erb +1 -0
  132. data/spec/fixture/app/views/label_specs/basic.html.erb +1 -0
  133. data/spec/fixture/app/views/layout/application.html.erb +11 -0
  134. data/spec/fixture/app/views/numeric_ext_specs/minutes_to_hours.html.erb +1 -0
  135. data/spec/fixture/app/views/numeric_ext_specs/to_concurrency_default.html.erb +1 -0
  136. data/spec/fixture/app/views/numeric_ext_specs/two_digits.html.erb +1 -0
  137. data/spec/fixture/app/views/option_tag_specs/array.html.erb +1 -0
  138. data/spec/fixture/app/views/option_tag_specs/clean.html.erb +1 -0
  139. data/spec/fixture/app/views/option_tag_specs/collection.html.erb +1 -0
  140. data/spec/fixture/app/views/option_tag_specs/multiple_selects.html.erb +1 -0
  141. data/spec/fixture/app/views/option_tag_specs/no_extra_attributes.html.erb +1 -0
  142. data/spec/fixture/app/views/option_tag_specs/optgroups.html.erb +1 -0
  143. data/spec/fixture/app/views/option_tag_specs/selected.html.erb +1 -0
  144. data/spec/fixture/app/views/option_tag_specs/with_blank.html.erb +1 -0
  145. data/spec/fixture/app/views/option_tag_specs/with_prompt.html.erb +1 -0
  146. data/spec/fixture/app/views/password_field_specs/basic.html.erb +1 -0
  147. data/spec/fixture/app/views/password_field_specs/disabled.html.erb +1 -0
  148. data/spec/fixture/app/views/radio_button_specs/basic.html.erb +1 -0
  149. data/spec/fixture/app/views/radio_button_specs/disabled.html.erb +1 -0
  150. data/spec/fixture/app/views/radio_button_specs/label.html.erb +1 -0
  151. data/spec/fixture/app/views/radio_group_specs/attributes.html.erb +1 -0
  152. data/spec/fixture/app/views/radio_group_specs/basic.html.erb +1 -0
  153. data/spec/fixture/app/views/radio_group_specs/hash.html.erb +1 -0
  154. data/spec/fixture/app/views/radio_group_specs/specific_attributes.html.erb +1 -0
  155. data/spec/fixture/app/views/select_specs/blank.html.erb +1 -0
  156. data/spec/fixture/app/views/select_specs/multiple.html.erb +1 -0
  157. data/spec/fixture/app/views/submit_specs/disabled_submit.html.erb +1 -0
  158. data/spec/fixture/app/views/submit_specs/submit_with_label.html.erb +1 -0
  159. data/spec/fixture/app/views/submit_specs/submit_with_values.html.erb +1 -0
  160. data/spec/fixture/app/views/tag_helper/nested_tags.html.erb +5 -0
  161. data/spec/fixture/app/views/tag_helper/tag_with_attributes.html.erb +1 -0
  162. data/spec/fixture/app/views/tag_helper/tag_with_content.html.erb +1 -0
  163. data/spec/fixture/app/views/tag_helper/tag_with_content_in_the_block.html.erb +3 -0
  164. data/spec/fixture/app/views/text_area_specs/basic.html.erb +1 -0
  165. data/spec/fixture/app/views/text_area_specs/disabled.html.erb +1 -0
  166. data/spec/fixture/app/views/text_area_specs/label.html.erb +1 -0
  167. data/spec/fixture/app/views/text_area_specs/nil.html.erb +1 -0
  168. data/spec/fixture/app/views/text_field_specs/basic.html.erb +1 -0
  169. data/spec/fixture/app/views/text_field_specs/class.html.erb +1 -0
  170. data/spec/fixture/app/views/text_field_specs/disabled.html.erb +1 -0
  171. data/spec/fixture/app/views/text_field_specs/label.html.erb +1 -0
  172. data/spec/fixture/config/environments/development.rb +6 -0
  173. data/spec/fixture/config/environments/production.rb +5 -0
  174. data/spec/fixture/config/environments/test.rb +6 -0
  175. data/spec/fixture/config/init.rb +46 -0
  176. data/spec/fixture/config/rack.rb +11 -0
  177. data/spec/fixture/config/router.rb +36 -0
  178. data/spec/fixture/log/merb.main.pid +1 -0
  179. data/spec/fixture/log/merb_test.log +624 -0
  180. data/spec/fixture/public/images/merb.jpg +0 -0
  181. data/spec/fixture/public/merb.fcgi +4 -0
  182. data/spec/fixture/public/stylesheets/master.css +119 -0
  183. data/spec/merb_helpers_config_spec.rb +82 -0
  184. data/spec/merb_helpers_date_time_spec.rb +257 -0
  185. data/spec/merb_helpers_form_spec.rb +1266 -0
  186. data/spec/merb_helpers_tag_helper_spec.rb +46 -0
  187. data/spec/merb_helpers_text_spec.rb +67 -0
  188. data/spec/numeric_extlib_spec.rb +135 -0
  189. data/spec/ordinalize_spec.rb +51 -0
  190. data/spec/spec_helper.rb +149 -0
  191. data/spec/time_dsl_spec.rb +43 -0
  192. metadata +303 -0
@@ -0,0 +1,57 @@
1
+ class FakeModel
2
+
3
+ attr_accessor :vin, :make, :model
4
+
5
+ def self.columns
6
+ [FakeColumn.new(:foo, :string),
7
+ FakeColumn.new(:foobad, :string),
8
+ FakeColumn.new(:desc, :string),
9
+ FakeColumn.new(:bar, :integer),
10
+ FakeColumn.new(:barbad, :integer),
11
+ FakeColumn.new(:baz, :boolean),
12
+ FakeColumn.new(:bazbad, :boolean),
13
+ FakeColumn.new(:bat, :boolean),
14
+ FakeColumn.new(:batbad, :boolean)
15
+ ]
16
+ end
17
+
18
+ def valid?
19
+ false
20
+ end
21
+
22
+ def new_record?
23
+ false
24
+ end
25
+
26
+ def errors
27
+ FakeErrors.new(self)
28
+ end
29
+
30
+ def foo
31
+ "foowee"
32
+ end
33
+ alias_method :foobad, :foo
34
+
35
+ def bar
36
+ 7
37
+ end
38
+ alias_method :barbad, :bar
39
+
40
+ def baz
41
+ true
42
+ end
43
+ alias_method :bazbad, :baz
44
+
45
+ def bat
46
+ false
47
+ end
48
+ alias_method :batbad, :bat
49
+
50
+ def nothing
51
+ nil
52
+ end
53
+
54
+ def to_s
55
+ 'fake_model'
56
+ end
57
+ end
@@ -0,0 +1,18 @@
1
+ class FakeModel2 < FakeModel
2
+ def id
3
+ 1
4
+ end
5
+
6
+ def foo
7
+ "foowee2"
8
+ end
9
+ alias_method :foobad, :foo
10
+
11
+ def bar
12
+ "barbar"
13
+ end
14
+
15
+ def new_record?
16
+ true
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ class FakeModel3
2
+ attr_accessor :foo, :bar
3
+ end
@@ -0,0 +1,4 @@
1
+ <%= form_for @obj do %>
2
+ <%= check_box(:baz) %>
3
+ <%= check_box(:bat) %>
4
+ <% end =%>
@@ -0,0 +1,4 @@
1
+ <%= form_for @obj do %>
2
+ <%= check_box(:foo, :on => "foowee", :off => "NO") %>
3
+ <%= check_box(:foo, :on => "YES", :off => "NO", :true_if => "zoo") %>
4
+ <% end =%>
@@ -0,0 +1,4 @@
1
+ <%= form_for @obj do %>
2
+ <%= check_box(:bazbad) %>
3
+ <%= check_box(:batbad) %>
4
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= check_box(:foo, :label => "LABEL") %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= check_box(:bat, :off => "off", :on => "on") %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= check_box(:baz, :value => "Awesome") %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= file_field(:foo, :bar => "7") %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= file_field :foo %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= file_field :foo, :label => "LABEL" %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= hidden_field(:foo) %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= hidden_field(:foobad) %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @model do %>
2
+ <%= hidden_field(:foo, :bar =>"7") %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= hidden_field(:foo, :label => "LABEL") %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @model1 do %>
2
+ <%= select(:vin, :text_method => "model", :collection => @collection) %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= select(:foo, :collection => [["small", "Small"], ["medium", "Medium"], ["large", "Large"]]) %>
3
+ <% end =%>
@@ -0,0 +1,4 @@
1
+ <%= form_for @obj do %>
2
+ <%= select( :foo, :collection => [FakeModel.new, FakeModel2.new], :text_method => "foo", :value_method => "bar" ) %>
3
+ <% end =%>
4
+
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= password_field(:foo, :bar => "7", :label => "LABEL") %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= radio_button(:foo, :bar => "7", :label => "LABEL") %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= radio_group (:foo, ["foowee", "baree"]) %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= radio_group(:foo, [{:value => 5, :label => "Five"}, {:value => 'bar', :label => 'Bar', :id => 'bar_id'}]) %>
3
+ <% end =%>
@@ -0,0 +1,4 @@
1
+ <%= form_for @obj do %>
2
+ <%= radio_group (:foo, [:bar]) %>
3
+ <%= radio_group (:foo, [{:value => 'bar', :label => 'Bar'}])%>
4
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= radio_group(:foo, [{:value => 'bar', :label => 'Bar', :id => 'bar_id'}]) %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= select :foo %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= select( :foo, :include_blank => true ) %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= select( :foo, :multiple => true ) %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= select( :foo, :prompt => "Choose" ) %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= select( :foo, :class => 'class1 class2', :title => 'This is the title' ) %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= select( :foo, :title => "TITLE", :include_blank => true ) %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= text_area( :foo ) %>
3
+ <% end =%>
@@ -0,0 +1,3 @@
1
+ <%= form_for @obj do %>
2
+ <%= text_field :foo, :bar => "7", :label => "LABEL" %>
3
+ <% end =%>
@@ -0,0 +1 @@
1
+ <%= button "Click Me", :type => 'button', :value => 'foo', :label => "LABEL" %>
@@ -0,0 +1 @@
1
+ <%= button "Click Me", :type => 'button', :name => 'foo', :value => 'bar' %>
@@ -0,0 +1 @@
1
+ <%= button :disabled => true %>
@@ -0,0 +1 @@
1
+ <%= check_box(:name => "foo", :checked => "checked") %>
@@ -0,0 +1 @@
1
+ <%= check_box(:boolean => true) %>
@@ -0,0 +1 @@
1
+ <%= check_box(:disabled => true) %>
@@ -0,0 +1 @@
1
+ <%= check_box(:label => "LABEL" ) %>
@@ -0,0 +1 @@
1
+ <%= check_box(:name => "foo", :on => "YES", :off => "NO") %>
@@ -0,0 +1,2 @@
1
+ <%= check_box(:name => "foo", :on => "YES") %>
2
+ <%= check_box(:name => "foo", :off => "NO") %>
@@ -0,0 +1 @@
1
+ <%= check_box(:boolean => true, :value => "woot") %>
@@ -0,0 +1 @@
1
+ <%= check_box :boolean => false, :on => "YES", :off => "NO" %>
@@ -0,0 +1,8 @@
1
+ <%= check_box(:name => "nil", :value => nil) %>
2
+ <%= check_box(:name => "false", :value => false) %>
3
+ <%= check_box(:name => "0", :value => 0) %>
4
+ <%= check_box(:name => "0s", :value => "0") %>
5
+ <%= check_box(:name => "1", :value => 1) %>
6
+ <%= check_box(:name => "1s", :value => "1") %>
7
+ <%= check_box(:name => "true", :value => true) %>
8
+
@@ -0,0 +1,2 @@
1
+ <%= check_box(:name => "foo", :checked => false) %>
2
+ <%= check_box(:name => "foo", :checked => nil) %>
@@ -0,0 +1,10 @@
1
+ <%= form_for @obj, :builder => MyBuilder do %>
2
+ <%= file_field(:foo) %>
3
+ <%= text_field(:foo) %>
4
+ <%= hidden_field(:foo) %>
5
+ <%= password_field(:foo) %>
6
+ <%= radio_button(:foo) %>
7
+ <%= text_area(:foo) %>
8
+ <%= button("Click") %>
9
+ <%= submit("Awesome") %>
10
+ <% end =%>
@@ -0,0 +1 @@
1
+ <%= delete_button('/test/custom_url') %>
@@ -0,0 +1 @@
1
+ <%= delete_button(@obj, nil, :class => 'custom-class') %>
@@ -0,0 +1 @@
1
+ <%= delete_button(@obj, "Delete moi!") %>
@@ -0,0 +1 @@
1
+ <%= delete_button(@obj) %>
@@ -0,0 +1,37 @@
1
+ <div id="container">
2
+ <div id="header-container">
3
+ <img src="/images/merb.jpg">
4
+ <!-- <h1>Mongrel + Erb</h1> -->
5
+ <h2>pocket rocket web framework</h2>
6
+ <hr />
7
+ </div>
8
+
9
+ <div id="left-container">
10
+ <h3>Exception:</h3>
11
+ <p><%= request.exceptions.first.message %></p>
12
+ </div>
13
+
14
+ <div id="main-container">
15
+ <h3>Why am I seeing this page?</h3>
16
+ <p>
17
+ An unexpected "client error" has occurred. That means something in your request
18
+ was not allowed, but the server does not have any more specific information.
19
+ </p>
20
+
21
+ <h3>Where can I find help?</h3>
22
+ <p>If you have any questions or if you can't figure something out, please take a
23
+ look at our <a href="http://merb.devjavu.com/"> project development page</a> or,
24
+ feel free to come chat at irc.freenode.net, channel #merb.</p>
25
+
26
+ <h3>How do I edit this page?</h3>
27
+ <p>You can change what people see when this happens byy editing <tt>app/views/exceptions/not_found.html.erb</tt>.</p>
28
+
29
+ </div>
30
+
31
+ <div id="footer-container">
32
+ <hr />
33
+ <div class="left"></div>
34
+ <div class="right">&copy; 2008 the merb dev team</div>
35
+ <p>&nbsp;</p>
36
+ </div>
37
+ </div>
@@ -0,0 +1,216 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
4
+ <title><%= @exception_name %></title>
5
+ <style type="text/css" media="screen">
6
+ body {
7
+ font-family:arial;
8
+ font-size:11px;
9
+ }
10
+ h1 {
11
+ font-size:48px;
12
+ letter-spacing:-4px;
13
+ margin:0;
14
+ line-height:36px;
15
+ color:#333;
16
+ }
17
+ h1 sup {
18
+ font-size: 0.5em;
19
+ }
20
+ h1 sup.error_500, h1 sup.error_400 {
21
+ color:#990E05;
22
+ }
23
+ h1 sup.error_100, h1 sup.error_200 {
24
+ color:#00BF10;
25
+ }
26
+ h1 sup.error_300 {
27
+ /* pretty sure you cant 'see' status 300
28
+ errors but if you could I think they
29
+ would be blue */
30
+ color:#1B2099;
31
+ }
32
+ h2 {
33
+ font-size:36px;
34
+ letter-spacing:-3px;
35
+ margin:0;
36
+ line-height:28px;
37
+ color:#444;
38
+ }
39
+ a, a:visited {
40
+ color:#00BF10;
41
+ }
42
+ .internalError {
43
+ width:800px;
44
+ margin:50px auto;
45
+ }
46
+ .header {
47
+ border-bottom:10px solid #333;
48
+ margin-bottom:1px;
49
+ background-image: url("data:image/gif;base64,R0lGODlhAwADAIAAAP///8zMzCH5BAAAAAAALAAAAAADAAMAAAIEBHIJBQA7");
50
+ padding:20px;
51
+ }
52
+ table.trace {
53
+ width:100%;
54
+ font-family:courier, monospace;
55
+ letter-spacing:-1px;
56
+ border-collapse: collapse;
57
+ border-spacing:0;
58
+ }
59
+ table.trace tr td{
60
+ padding:0;
61
+ height:26px;
62
+ font-size:13px;
63
+ vertical-align:middle;
64
+ }
65
+ table.trace tr.file{
66
+ border-top:2px solid #fff;
67
+ background-color:#F3F3F3;
68
+ }
69
+ table.trace tr.source {
70
+ background-color:#F8F8F8;
71
+ display:none;
72
+ }
73
+ table.trace .open tr.source {
74
+ display:table-row;
75
+ }
76
+ table.trace tr.file td.expand {
77
+ width:23px;
78
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAXCAIAAABvSEP3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAdVJREFUeNqMVL+TwUAYxaRIOlEhlZHGDAUzzOQ61+AqXMV1lJSU7q/QRqm8KFUcJTNn5qJkaPyoKKVz7y4mF8na5Kt29tt9+/Z97/u81+vVQ4r9frdarS6Xi7ETDIZisRjxMGPfmk4niNPpZE+xLAugbPaZ53nzvtfMBe/3+/3dbuehBrAKhZdUKkVAWa9Xsiybv0CPZDJZLr/qa5/BwgwRjYqOKIvFYjQa/aNommZh0Ww2K5UqzwfoQOPxaLPZ3FAmk0+7lplMpt1u53J5OpBOR0eZEE9wHJfP5zud93g88QhluwWbjW+5VOmKBgKBer3eaDTDYeGBQF8+x7rqIYoiPgixWJazpA6HA+MSxRArkUgMh0M409g8Ho8+9wYxxCqVSq1W26EDHGM2m4HOHQrEc38f/Yn7cLmlIRhBENzcx8cVRZnPZ/YUep2BWkjTIfA+PKVpZAXR5QxsjiqCKvGEqqp443w+0dvy17swqD0HB3S73V5PpkNg1qBqt8kwGCjmPkinM0QJbIoEa7U6UG6ToVgs4V9G2g0ESoP5Aoi7KYX5oCgf8IKbkvn9/mr1LRQKESamzgJy0g0tSZIuB3nuGqRU9Vv9C4sKkUhEkp4soxvxI8AAhWrrtXa3X8EAAAAASUVORK5CYII=);
79
+ background-position:top left;
80
+ background-repeat:no-repeat;
81
+ }
82
+ table.trace .open tr.file td.expand {
83
+ width:19px;
84
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAXZJREFUeNrslK1ywkAUhcMOBomEOiSdqLxEBJX0NaijOsjyHGGmCGyQQYaiiiw4gktkcOmZbpsuuzQ/M5XnqJ2d3S/n3nM3rTzPLUP7/Tt0+pLcGQwG3W53OLyHzPMtjYL7q9UqSRLrD4E1Gj1orCvKYuFHUWTVkOM44/HjDcp8/lL4r6NerzeZPMm1KFw0QkDn83m5fP2lHA4fNQvRtNvtjsfDd0WzmSfb2e/fdTqdOvdh/HLJZLOn0+d2HJ+KRGzbdl23EpFlmed5cp2maRzHQq1lvQ5KMi6EUZBGfup6E1pTfd+vrGW7jbQ2C9hTt9BpqNyIWaAwAy6xg2eBz5iRC/NomiZhGN5sqmnkauo0BUGgVQoBjQ80oCACgNQdZHfTYBkF2mxCtWWAqunWpahxIDUt3QYUxIFQpJHyIWpXjinabKbbwItMHT+NyjchrP8QKaSQQgoppJBCCimkkEIKKaSQQgoppJBCCimkkEIKKaSo+hRgAEFD17X08O2NAAAAAElFTkSuQmCC);
85
+ background-position:top left;
86
+ background-repeat:no-repeat;
87
+ }
88
+ table.trace tr.source td.collapse {
89
+ width:19px;
90
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAVxJREFUeNrs0zFygkAUBmBlUkgJHdABlQwVkVJKKUxBYWbkALTxMJwhltyDFkss03IF8pudIcwaDaDl/6pd2P327b7d+eHwMXs4lNkzggoVKlSoUKFChQoVKlSoUKFChQoVKlSoUKFChQqVEYqm6ft9+qiSJEkYho7jTlcw2fd9NOI4nq4gEdFwXXe1Cqco63VkWVbXRTqLhTpOwQRpF7quR1E0TgGhqvLKUFCyoQqG/rks3O6kZKW/eRFpevOCoGTXVTcMQ5EyxyDEkML1c5RzuZOICIyXqn7JBVez6282MWrx731HOv2qB8Hri2lamNk0DfpVVdV1Peodappmmua8bdvzuc7zfNprzrLMth1FnGh/X8MjCAIQv/cFz/+65PcDh7rbvYv2ZUfdj+PxsyzLgVl0hKwgTqeqKApx2LeOc7t98zyv/1FWOgvx9RPii23bmL9cetJ8Ed8CDAC6aFW8bCzFhwAAAABJRU5ErkJggg==);
91
+ background-position:bottom left;
92
+ background-repeat:no-repeat;
93
+ background-color:#6F706F;
94
+ }
95
+ table.trace tr td.path {
96
+ padding-left:10px;
97
+ }
98
+ table.trace tr td.code {
99
+ padding-left:35px;
100
+ white-space: pre;
101
+ line-height:9px;
102
+ padding-bottom:10px;
103
+ }
104
+ table.trace tr td.code em {
105
+ font-weight:bold;
106
+ color:#00BF10;
107
+ }
108
+ table.trace tr td.code a {
109
+ width: 20px;
110
+ float: left;
111
+ }
112
+ table.trace tr td.code .more {
113
+ color:#666;
114
+ }
115
+ table.trace tr td.line {
116
+ width:30px;
117
+ text-align:right;
118
+ padding-right:4px;
119
+ }
120
+ .footer {
121
+ margin-top:5px;
122
+ font-size:11px;
123
+ color:#444;
124
+ text-align:right;
125
+ }
126
+ </style>
127
+ </head>
128
+ <body>
129
+ <div class="internalError">
130
+
131
+ <div class="header">
132
+ <h1><%= @exception_name %> <sup class="error_<%= @exception.class.status %>"><%= @exception.class.status %></sup></h1>
133
+ <% if show_details = ::Merb::Config[:exception_details] -%>
134
+ <h2><%= @exception.message %></h2>
135
+ <% else -%>
136
+ <h2>Sorry about that...</h2>
137
+ <% end -%>
138
+ <h3>Parameters</h3>
139
+ <ul>
140
+ <% params[:original_params].each do |param, value| %>
141
+ <li><strong><%= param %>:</strong> <%= value.inspect %></li>
142
+ <% end %>
143
+ <%= "<li>None</li>" if params[:original_params].empty? %>
144
+ </ul>
145
+
146
+ <h3>Session</h3>
147
+ <ul>
148
+ <% params[:original_session].each do |param, value| %>
149
+ <li><strong><%= param %>:</strong> <%= value.inspect %></li>
150
+ <% end %>
151
+ <%= "<li>None</li>" if params[:original_session].empty? %>
152
+ </ul>
153
+
154
+ <h3>Cookies</h3>
155
+ <ul>
156
+ <% params[:original_cookies].each do |param, value| %>
157
+ <li><strong><%= param %>:</strong> <%= value.inspect %></li>
158
+ <% end %>
159
+ <%= "<li>None</li>" if params[:original_cookies].empty? %>
160
+ </ul>
161
+ </div>
162
+
163
+ <% if show_details %>
164
+ <table class="trace">
165
+ <% @exception.backtrace.each_with_index do |line, index| %>
166
+ <tbody class="close">
167
+ <tr class="file">
168
+ <td class="expand">
169
+ </td>
170
+ <td class="path">
171
+ <%= (line.match(/^([^:]+)/)[1] rescue 'unknown').sub(/\/((opt|usr)\/local\/lib\/(ruby\/)?(gems\/)?(1.8\/)?(gems\/)?|.+\/app\/)/, '') %>
172
+ <% unless line.match(/\.erb:/) %>
173
+ in "<strong><%= line.match(/:in `(.+)'$/)[1] rescue '?' %></strong>"
174
+ <% else %>
175
+ (<strong>ERB Template</strong>)
176
+ <% end %>
177
+ </td>
178
+ <td class="line">
179
+ <a href="txmt://open?url=file://<%=file = (line.match(/^([^:]+)/)[1] rescue 'unknown')%>&amp;line=<%= lineno = line.match(/:([0-9]+):/)[1] rescue '?' %>"><%=lineno%></a>&nbsp;
180
+ </td>
181
+ </tr>
182
+ <tr class="source">
183
+ <td class="collapse">
184
+ </td>
185
+ <td class="code" colspan="2"><% (__caller_lines__(file, lineno, 5) rescue []).each do |llineno, lcode, lcurrent| %>
186
+ <a href="txmt://open?url=file://<%=file%>&amp;line=<%=llineno%>"><%= llineno %></a><%='<em>' if llineno==lineno.to_i %><%= lcode.size > 90 ? Erubis::XmlHelper.html_escape(lcode[0..90])+'<span class="more">......</span>' : Erubis::XmlHelper.html_escape(lcode) %><%='</em>' if llineno==lineno.to_i %>
187
+ <% end %>
188
+
189
+ </td>
190
+ </tr>
191
+ </tbody>
192
+ <% end %>
193
+ </table>
194
+ <script type="text/javascript" charset="utf-8">
195
+ // swop the open & closed classes
196
+ els = document.getElementsByTagName('td');
197
+ for(i=0; i<els.length; i++){
198
+ if(els[i].className=='expand' || els[i].className=='collapse'){
199
+ els[i].onclick = function(e){
200
+ tbody = this.parentNode.parentNode;
201
+ if(tbody.className=='open'){
202
+ tbody.className='closed';
203
+ }else{
204
+ tbody.className='open';
205
+ }
206
+ }
207
+ }
208
+ }
209
+ </script>
210
+ <% end %>
211
+ <div class="footer">
212
+ lots of love, from <a href="#">merb</a>
213
+ </div>
214
+ </div>
215
+ </body>
216
+ </html>