active_scaffold_vho 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (279) hide show
  1. data/.autotest +27 -0
  2. data/.document +5 -0
  3. data/CHANGELOG +179 -0
  4. data/Gemfile +13 -0
  5. data/Gemfile.lock +20 -0
  6. data/MIT-LICENSE +20 -0
  7. data/README +63 -0
  8. data/Rakefile +53 -0
  9. data/frontends/default/images/add.gif +0 -0
  10. data/frontends/default/images/arrow_down.gif +0 -0
  11. data/frontends/default/images/arrow_up.gif +0 -0
  12. data/frontends/default/images/close.gif +0 -0
  13. data/frontends/default/images/config.png +0 -0
  14. data/frontends/default/images/cross.png +0 -0
  15. data/frontends/default/images/gears.png +0 -0
  16. data/frontends/default/images/indicator-small.gif +0 -0
  17. data/frontends/default/images/indicator.gif +0 -0
  18. data/frontends/default/images/magnifier.png +0 -0
  19. data/frontends/default/javascripts/jquery/active_scaffold.js +957 -0
  20. data/frontends/default/javascripts/jquery/jquery.editinplace.js +743 -0
  21. data/frontends/default/javascripts/prototype/active_scaffold.js +957 -0
  22. data/frontends/default/javascripts/prototype/dhtml_history.js +867 -0
  23. data/frontends/default/javascripts/prototype/form_enhancements.js +117 -0
  24. data/frontends/default/javascripts/prototype/rico_corner.js +370 -0
  25. data/frontends/default/stylesheets/stylesheet-ie.css +35 -0
  26. data/frontends/default/stylesheets/stylesheet.css +964 -0
  27. data/frontends/default/views/_action_group.html.erb +20 -0
  28. data/frontends/default/views/_add_existing_form.html.erb +30 -0
  29. data/frontends/default/views/_base_form.html.erb +45 -0
  30. data/frontends/default/views/_create_form.html.erb +8 -0
  31. data/frontends/default/views/_create_form_on_list.html.erb +6 -0
  32. data/frontends/default/views/_field_search.html.erb +32 -0
  33. data/frontends/default/views/_form.html.erb +24 -0
  34. data/frontends/default/views/_form_association.html.erb +14 -0
  35. data/frontends/default/views/_form_association_footer.html.erb +40 -0
  36. data/frontends/default/views/_form_attribute.html.erb +15 -0
  37. data/frontends/default/views/_form_hidden_attribute.html.erb +2 -0
  38. data/frontends/default/views/_form_messages.html.erb +5 -0
  39. data/frontends/default/views/_horizontal_subform.html.erb +19 -0
  40. data/frontends/default/views/_horizontal_subform_header.html.erb +10 -0
  41. data/frontends/default/views/_horizontal_subform_record.html.erb +37 -0
  42. data/frontends/default/views/_human_conditions.html.erb +1 -0
  43. data/frontends/default/views/_list.html.erb +18 -0
  44. data/frontends/default/views/_list_actions.html.erb +15 -0
  45. data/frontends/default/views/_list_calculations.html.erb +16 -0
  46. data/frontends/default/views/_list_column_headings.html.erb +12 -0
  47. data/frontends/default/views/_list_header.html.erb +10 -0
  48. data/frontends/default/views/_list_inline_adapter.html.erb +10 -0
  49. data/frontends/default/views/_list_messages.html.erb +32 -0
  50. data/frontends/default/views/_list_pagination.html.erb +11 -0
  51. data/frontends/default/views/_list_pagination_links.html.erb +9 -0
  52. data/frontends/default/views/_list_record.html.erb +14 -0
  53. data/frontends/default/views/_list_record_columns.html.erb +8 -0
  54. data/frontends/default/views/_list_with_header.html.erb +32 -0
  55. data/frontends/default/views/_messages.html.erb +10 -0
  56. data/frontends/default/views/_render_field.js.rjs +13 -0
  57. data/frontends/default/views/_row.html.erb +12 -0
  58. data/frontends/default/views/_search.html.erb +34 -0
  59. data/frontends/default/views/_search_attribute.html.erb +10 -0
  60. data/frontends/default/views/_show.html.erb +8 -0
  61. data/frontends/default/views/_show_columns.html.erb +15 -0
  62. data/frontends/default/views/_update_actions.html.erb +9 -0
  63. data/frontends/default/views/_update_form.html.erb +6 -0
  64. data/frontends/default/views/_vertical_subform.html.erb +12 -0
  65. data/frontends/default/views/_vertical_subform_record.html.erb +38 -0
  66. data/frontends/default/views/action_confirmation.html.erb +13 -0
  67. data/frontends/default/views/add_existing.js.rjs +17 -0
  68. data/frontends/default/views/add_existing_form.html.erb +5 -0
  69. data/frontends/default/views/create.html.erb +5 -0
  70. data/frontends/default/views/delete.html.erb +13 -0
  71. data/frontends/default/views/destroy.js.rjs +11 -0
  72. data/frontends/default/views/edit_associated.js.rjs +11 -0
  73. data/frontends/default/views/field_search.html.erb +5 -0
  74. data/frontends/default/views/form_messages.js.rjs +1 -0
  75. data/frontends/default/views/list.html.erb +1 -0
  76. data/frontends/default/views/list.js.rjs +1 -0
  77. data/frontends/default/views/on_action_update.js.rjs +8 -0
  78. data/frontends/default/views/on_create.js.rjs +41 -0
  79. data/frontends/default/views/on_update.js.rjs +28 -0
  80. data/frontends/default/views/search.html.erb +5 -0
  81. data/frontends/default/views/show.html.erb +5 -0
  82. data/frontends/default/views/update.html.erb +8 -0
  83. data/frontends/default/views/update_column.js.rjs +13 -0
  84. data/frontends/default/views/update_row.js.rjs +1 -0
  85. data/init.rb +9 -0
  86. data/lib/active_record_permissions.rb +134 -0
  87. data/lib/active_scaffold/actions/common_search.rb +22 -0
  88. data/lib/active_scaffold/actions/core.rb +170 -0
  89. data/lib/active_scaffold/actions/create.rb +145 -0
  90. data/lib/active_scaffold/actions/delete.rb +75 -0
  91. data/lib/active_scaffold/actions/field_search.rb +82 -0
  92. data/lib/active_scaffold/actions/list.rb +184 -0
  93. data/lib/active_scaffold/actions/mark.rb +50 -0
  94. data/lib/active_scaffold/actions/nested.rb +250 -0
  95. data/lib/active_scaffold/actions/search.rb +47 -0
  96. data/lib/active_scaffold/actions/show.rb +61 -0
  97. data/lib/active_scaffold/actions/subform.rb +17 -0
  98. data/lib/active_scaffold/actions/update.rb +141 -0
  99. data/lib/active_scaffold/attribute_params.rb +207 -0
  100. data/lib/active_scaffold/bridges/ancestry/bridge.rb +5 -0
  101. data/lib/active_scaffold/bridges/ancestry/lib/ancestry_bridge.rb +39 -0
  102. data/lib/active_scaffold/bridges/bridge.rb +52 -0
  103. data/lib/active_scaffold/bridges/calendar_date_select/bridge.rb +16 -0
  104. data/lib/active_scaffold/bridges/calendar_date_select/lib/as_cds_bridge.rb +79 -0
  105. data/lib/active_scaffold/bridges/carrierwave/bridge.rb +7 -0
  106. data/lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge.rb +38 -0
  107. data/lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb +26 -0
  108. data/lib/active_scaffold/bridges/carrierwave/lib/form_ui.rb +35 -0
  109. data/lib/active_scaffold/bridges/carrierwave/lib/list_ui.rb +17 -0
  110. data/lib/active_scaffold/bridges/date_picker/bridge.rb +22 -0
  111. data/lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb +225 -0
  112. data/lib/active_scaffold/bridges/date_picker/public/javascripts/date_picker_bridge.js +22 -0
  113. data/lib/active_scaffold/bridges/file_column/bridge.rb +11 -0
  114. data/lib/active_scaffold/bridges/file_column/lib/as_file_column_bridge.rb +46 -0
  115. data/lib/active_scaffold/bridges/file_column/lib/file_column_helpers.rb +59 -0
  116. data/lib/active_scaffold/bridges/file_column/lib/form_ui.rb +37 -0
  117. data/lib/active_scaffold/bridges/file_column/lib/list_ui.rb +26 -0
  118. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +43 -0
  119. data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +9 -0
  120. data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +15 -0
  121. data/lib/active_scaffold/bridges/paperclip/bridge.rb +10 -0
  122. data/lib/active_scaffold/bridges/paperclip/lib/form_ui.rb +27 -0
  123. data/lib/active_scaffold/bridges/paperclip/lib/list_ui.rb +16 -0
  124. data/lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge.rb +38 -0
  125. data/lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb +26 -0
  126. data/lib/active_scaffold/bridges/semantic_attributes/bridge.rb +5 -0
  127. data/lib/active_scaffold/bridges/semantic_attributes/lib/semantic_attributes_bridge.rb +20 -0
  128. data/lib/active_scaffold/bridges/shared/date_bridge.rb +187 -0
  129. data/lib/active_scaffold/bridges/tiny_mce/bridge.rb +5 -0
  130. data/lib/active_scaffold/bridges/tiny_mce/lib/tiny_mce_bridge.rb +45 -0
  131. data/lib/active_scaffold/bridges/validation_reflection/bridge.rb +8 -0
  132. data/lib/active_scaffold/bridges/validation_reflection/lib/validation_reflection_bridge.rb +21 -0
  133. data/lib/active_scaffold/config/base.rb +62 -0
  134. data/lib/active_scaffold/config/core.rb +220 -0
  135. data/lib/active_scaffold/config/create.rb +51 -0
  136. data/lib/active_scaffold/config/delete.rb +34 -0
  137. data/lib/active_scaffold/config/field_search.rb +75 -0
  138. data/lib/active_scaffold/config/form.rb +47 -0
  139. data/lib/active_scaffold/config/list.rb +174 -0
  140. data/lib/active_scaffold/config/mark.rb +22 -0
  141. data/lib/active_scaffold/config/nested.rb +44 -0
  142. data/lib/active_scaffold/config/search.rb +69 -0
  143. data/lib/active_scaffold/config/show.rb +35 -0
  144. data/lib/active_scaffold/config/subform.rb +35 -0
  145. data/lib/active_scaffold/config/update.rb +46 -0
  146. data/lib/active_scaffold/configurable.rb +29 -0
  147. data/lib/active_scaffold/constraints.rb +184 -0
  148. data/lib/active_scaffold/data_structures/action_columns.rb +133 -0
  149. data/lib/active_scaffold/data_structures/action_link.rb +171 -0
  150. data/lib/active_scaffold/data_structures/action_links.rb +175 -0
  151. data/lib/active_scaffold/data_structures/actions.rb +45 -0
  152. data/lib/active_scaffold/data_structures/column.rb +351 -0
  153. data/lib/active_scaffold/data_structures/columns.rb +75 -0
  154. data/lib/active_scaffold/data_structures/error_message.rb +24 -0
  155. data/lib/active_scaffold/data_structures/nested_info.rb +123 -0
  156. data/lib/active_scaffold/data_structures/set.rb +62 -0
  157. data/lib/active_scaffold/data_structures/sorting.rb +168 -0
  158. data/lib/active_scaffold/finder.rb +333 -0
  159. data/lib/active_scaffold/helpers/association_helpers.rb +40 -0
  160. data/lib/active_scaffold/helpers/controller_helpers.rb +82 -0
  161. data/lib/active_scaffold/helpers/country_helpers.rb +352 -0
  162. data/lib/active_scaffold/helpers/form_column_helpers.rb +347 -0
  163. data/lib/active_scaffold/helpers/human_condition_helpers.rb +59 -0
  164. data/lib/active_scaffold/helpers/id_helpers.rb +127 -0
  165. data/lib/active_scaffold/helpers/list_column_helpers.rb +361 -0
  166. data/lib/active_scaffold/helpers/pagination_helpers.rb +55 -0
  167. data/lib/active_scaffold/helpers/search_column_helpers.rb +243 -0
  168. data/lib/active_scaffold/helpers/show_column_helpers.rb +46 -0
  169. data/lib/active_scaffold/helpers/view_helpers.rb +356 -0
  170. data/lib/active_scaffold/locale/de.rb +120 -0
  171. data/lib/active_scaffold/locale/en.rb +119 -0
  172. data/lib/active_scaffold/locale/es.yml +115 -0
  173. data/lib/active_scaffold/locale/fr.rb +116 -0
  174. data/lib/active_scaffold/locale/hu.yml +63 -0
  175. data/lib/active_scaffold/locale/ja.yml +64 -0
  176. data/lib/active_scaffold/locale/ru.yml +119 -0
  177. data/lib/active_scaffold/marked_model.rb +38 -0
  178. data/lib/active_scaffold/version.rb +9 -0
  179. data/lib/active_scaffold.rb +345 -0
  180. data/lib/active_scaffold_assets.rb +45 -0
  181. data/lib/dhtml_confirm.rb +54 -0
  182. data/lib/environment.rb +14 -0
  183. data/lib/extensions/action_controller_rendering.rb +20 -0
  184. data/lib/extensions/action_view_rendering.rb +113 -0
  185. data/lib/extensions/action_view_resolver.rb +7 -0
  186. data/lib/extensions/active_association_reflection.rb +13 -0
  187. data/lib/extensions/active_record_offset.rb +12 -0
  188. data/lib/extensions/array.rb +7 -0
  189. data/lib/extensions/localize.rb +10 -0
  190. data/lib/extensions/name_option_for_datetime.rb +12 -0
  191. data/lib/extensions/nil_id_in_url_params.rb +7 -0
  192. data/lib/extensions/paginator_extensions.rb +26 -0
  193. data/lib/extensions/reverse_associations.rb +62 -0
  194. data/lib/extensions/routing_mapper.rb +34 -0
  195. data/lib/extensions/to_label.rb +8 -0
  196. data/lib/extensions/unsaved_associated.rb +61 -0
  197. data/lib/extensions/unsaved_record.rb +20 -0
  198. data/lib/extensions/usa_state.rb +46 -0
  199. data/lib/generators/active_scaffold/USAGE +29 -0
  200. data/lib/generators/active_scaffold/active_scaffold_generator.rb +20 -0
  201. data/lib/generators/active_scaffold_controller/USAGE +19 -0
  202. data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +28 -0
  203. data/lib/generators/active_scaffold_controller/templates/controller.rb +4 -0
  204. data/lib/generators/active_scaffold_setup/USAGE +10 -0
  205. data/lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb +53 -0
  206. data/lib/paginator.rb +136 -0
  207. data/lib/responds_to_parent.rb +70 -0
  208. data/public/blank.html +33 -0
  209. data/shoulda_macros/macros.rb +136 -0
  210. data/test/bridges/bridge_test.rb +47 -0
  211. data/test/config/base_test.rb +15 -0
  212. data/test/config/create_test.rb +55 -0
  213. data/test/config/list_test.rb +74 -0
  214. data/test/config/show_test.rb +43 -0
  215. data/test/config/update_test.rb +17 -0
  216. data/test/const_mocker.rb +36 -0
  217. data/test/data_structures/action_columns_test.rb +113 -0
  218. data/test/data_structures/action_link_test.rb +78 -0
  219. data/test/data_structures/action_links_test.rb +78 -0
  220. data/test/data_structures/actions_test.rb +25 -0
  221. data/test/data_structures/association_column_test.rb +42 -0
  222. data/test/data_structures/column_test.rb +185 -0
  223. data/test/data_structures/columns_test.rb +69 -0
  224. data/test/data_structures/error_message_test.rb +28 -0
  225. data/test/data_structures/set_test.rb +86 -0
  226. data/test/data_structures/sorting_test.rb +126 -0
  227. data/test/data_structures/standard_column_test.rb +24 -0
  228. data/test/data_structures/virtual_column_test.rb +23 -0
  229. data/test/extensions/active_record_test.rb +45 -0
  230. data/test/extensions/array_test.rb +12 -0
  231. data/test/helpers/form_column_helpers_test.rb +31 -0
  232. data/test/helpers/list_column_helpers_test.rb +31 -0
  233. data/test/helpers/pagination_helpers_test.rb +55 -0
  234. data/test/misc/active_record_permissions_test.rb +154 -0
  235. data/test/misc/attribute_params_test.rb +110 -0
  236. data/test/misc/configurable_test.rb +96 -0
  237. data/test/misc/constraints_test.rb +193 -0
  238. data/test/misc/finder_test.rb +93 -0
  239. data/test/misc/lang_test.rb +12 -0
  240. data/test/mock_app/.gitignore +2 -0
  241. data/test/mock_app/app/controllers/application_controller.rb +10 -0
  242. data/test/mock_app/app/helpers/application_helper.rb +3 -0
  243. data/test/mock_app/config/boot.rb +110 -0
  244. data/test/mock_app/config/database.yml +16 -0
  245. data/test/mock_app/config/environment.rb +43 -0
  246. data/test/mock_app/config/environments/development.rb +17 -0
  247. data/test/mock_app/config/environments/production.rb +28 -0
  248. data/test/mock_app/config/environments/test.rb +28 -0
  249. data/test/mock_app/config/initializers/backtrace_silencers.rb +7 -0
  250. data/test/mock_app/config/initializers/inflections.rb +10 -0
  251. data/test/mock_app/config/initializers/mime_types.rb +5 -0
  252. data/test/mock_app/config/initializers/new_rails_defaults.rb +19 -0
  253. data/test/mock_app/config/initializers/session_store.rb +15 -0
  254. data/test/mock_app/config/locales/en.yml +5 -0
  255. data/test/mock_app/config/routes.rb +43 -0
  256. data/test/mock_app/db/test.sqlite3 +1 -0
  257. data/test/mock_app/public/blank.html +33 -0
  258. data/test/mock_app/public/images/active_scaffold/DO_NOT_EDIT +2 -0
  259. data/test/mock_app/public/images/active_scaffold/default/add.gif +0 -0
  260. data/test/mock_app/public/images/active_scaffold/default/arrow_down.gif +0 -0
  261. data/test/mock_app/public/images/active_scaffold/default/arrow_up.gif +0 -0
  262. data/test/mock_app/public/images/active_scaffold/default/close.gif +0 -0
  263. data/test/mock_app/public/images/active_scaffold/default/cross.png +0 -0
  264. data/test/mock_app/public/images/active_scaffold/default/indicator-small.gif +0 -0
  265. data/test/mock_app/public/images/active_scaffold/default/indicator.gif +0 -0
  266. data/test/mock_app/public/images/active_scaffold/default/magnifier.png +0 -0
  267. data/test/mock_app/public/javascripts/active_scaffold/DO_NOT_EDIT +2 -0
  268. data/test/mock_app/public/javascripts/active_scaffold/default/active_scaffold.js +532 -0
  269. data/test/mock_app/public/javascripts/active_scaffold/default/dhtml_history.js +867 -0
  270. data/test/mock_app/public/javascripts/active_scaffold/default/form_enhancements.js +117 -0
  271. data/test/mock_app/public/javascripts/active_scaffold/default/rico_corner.js +370 -0
  272. data/test/mock_app/public/stylesheets/active_scaffold/DO_NOT_EDIT +2 -0
  273. data/test/mock_app/public/stylesheets/active_scaffold/default/stylesheet-ie.css +35 -0
  274. data/test/mock_app/public/stylesheets/active_scaffold/default/stylesheet.css +839 -0
  275. data/test/model_stub.rb +55 -0
  276. data/test/run_all.rb +8 -0
  277. data/test/test_helper.rb +39 -0
  278. data/uninstall.rb +13 -0
  279. metadata +492 -0
@@ -0,0 +1,352 @@
1
+ module ActiveScaffold
2
+ module Helpers
3
+ module CountryHelpers
4
+ # Return select and option tags for the given object and method, using country_options_for_select to generate the list of option tags.
5
+ def country_select(object, method, priority_countries = nil, options = {}, html_options = {})
6
+ ActionView::Helpers::InstanceTag.new(object, method, self, options.delete(:object)).to_country_select_tag(priority_countries, options, html_options)
7
+ end
8
+
9
+ def usa_state_select(object, method, priority_states = nil, options = {}, html_options = {})
10
+ ActionView::Helpers::InstanceTag.new(object, method, self, options.delete(:object)).to_usa_state_select_tag(priority_states, options, html_options)
11
+ end
12
+
13
+ # Returns a string of option tags for pretty much any country in the world. Supply a country name as +selected+ to
14
+ # have it marked as the selected option tag. You can also supply an array of countries as +priority_countries+, so
15
+ # that they will be listed above the rest of the (long) list.
16
+ #
17
+ # NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag.
18
+ def country_options_for_select(selected = nil, priority_countries = nil)
19
+ if priority_countries
20
+ country_options = options_for_select(priority_countries.collect {|country| [I18n.t("countries.#{country}", :default => country.to_s.titleize), country.to_s]} + [['-------------', '']], :selected => selected, :disabled => '')
21
+ else
22
+ country_options = ""
23
+ end
24
+
25
+ return country_options + options_for_select(COUNTRIES.collect {|country| [I18n.t("countries.#{country}", :default => country.to_s.titleize), country.to_s]}, :selected => selected)
26
+ end
27
+
28
+ # Returns a string of option tags for the states in the United States. Supply a state name as +selected to
29
+ # have it marked as the selected option tag. Included also is the option to set a couple of +priority_states+
30
+ # in case you want to highligh a local area
31
+ # NOTE: Only the option tags are returned from this method, wrap it in a <select>
32
+ def usa_state_options_for_select(selected = nil, priority_states = nil)
33
+ if priority_states
34
+ state_options = options_for_select(priority_states + [['-------------', '']], :selected => selected, :disabled => '')
35
+ else
36
+ state_options = ""
37
+ end
38
+
39
+ if priority_states && priority_states.include?(selected)
40
+ state_options += options_for_select(USASTATES - priority_states, :selected => selected)
41
+ else
42
+ state_options += options_for_select(USASTATES, :selected => selected)
43
+ end
44
+
45
+ return state_options
46
+ end
47
+ # All the countries included in the country_options output.
48
+ COUNTRIES = [
49
+ :afghanistan,
50
+ :aland_islands,
51
+ :albania,
52
+ :algeria,
53
+ :american_samoa,
54
+ :andorra,
55
+ :angola,
56
+ :anguilla,
57
+ :antarctica,
58
+ :antigua_and_barbuda,
59
+ :argentina,
60
+ :armenia,
61
+ :aruba,
62
+ :australia,
63
+ :austria,
64
+ :azerbaijan,
65
+ :bahamas,
66
+ :bahrain,
67
+ :bangladesh,
68
+ :barbados,
69
+ :belarus,
70
+ :belgium,
71
+ :belize,
72
+ :benin,
73
+ :bermuda,
74
+ :bhutan,
75
+ :bolivia,
76
+ :bosnia_and_herzegowina,
77
+ :botswana,
78
+ :bouvet_island,
79
+ :brazil,
80
+ :british_indian_ocean_territory,
81
+ :brunei_darussalam,
82
+ :bulgaria,
83
+ :burkina_faso,
84
+ :burundi,
85
+ :cambodia,
86
+ :cameroon,
87
+ :canada,
88
+ :cape_verde,
89
+ :cayman_islands,
90
+ :central_african_republic,
91
+ :chad,
92
+ :chile,
93
+ :china,
94
+ :christmas_island,
95
+ :cocos_keeling_islands,
96
+ :colombia,
97
+ :comoros,
98
+ :congo,
99
+ :congo_the_democratic_republic_of_the,
100
+ :cook_islands,
101
+ :costa_rica,
102
+ :cote_divoire,
103
+ :croatia,
104
+ :cuba,
105
+ :cyprus,
106
+ :czech_republic,
107
+ :denmark,
108
+ :djibouti,
109
+ :dominica,
110
+ :dominican_republic,
111
+ :ecuador,
112
+ :egypt,
113
+ :el_salvador,
114
+ :equatorial_guinea,
115
+ :eritrea,
116
+ :estonia,
117
+ :ethiopia,
118
+ :falkland_islands_malvinas,
119
+ :faroe_islands,
120
+ :fiji,
121
+ :finland,
122
+ :france,
123
+ :french_guiana,
124
+ :french_polynesia,
125
+ :french_southern_territories,
126
+ :gabon,
127
+ :gambia,
128
+ :georgia,
129
+ :germany,
130
+ :ghana,
131
+ :gibraltar,
132
+ :greece,
133
+ :greenland,
134
+ :grenada,
135
+ :guadeloupe,
136
+ :guam,
137
+ :guatemala,
138
+ :guernsey,
139
+ :guinea,
140
+ :guinea_bissau,
141
+ :guyana,
142
+ :haiti,
143
+ :heard_and_mcdonald_islands,
144
+ :holy_see_vatican_city_state,
145
+ :honduras,
146
+ :hong_kong,
147
+ :hungary,
148
+ :iceland,
149
+ :india,
150
+ :indonesia,
151
+ :iran_islamic_republic_of,
152
+ :iraq,
153
+ :ireland,
154
+ :isle_of_man,
155
+ :israel,
156
+ :italy,
157
+ :jamaica,
158
+ :japan,
159
+ :jersey,
160
+ :jordan,
161
+ :kazakhstan,
162
+ :kenya,
163
+ :kiribati,
164
+ :korea_democratic_peoples_republic_of,
165
+ :korea_republic_of,
166
+ :kuwait,
167
+ :kyrgyzstan,
168
+ :lao_peoples_democratic_republic,
169
+ :latvia,
170
+ :lebanon,
171
+ :lesotho,
172
+ :liberia,
173
+ :libyan_arab_jamahiriya,
174
+ :liechtenstein,
175
+ :lithuania,
176
+ :luxembourg,
177
+ :macao,
178
+ :macedonia_the_former_yugoslav_republic_of,
179
+ :madagascar,
180
+ :malawi,
181
+ :malaysia,
182
+ :maldives,
183
+ :mali,
184
+ :malta,
185
+ :marshall_islands,
186
+ :martinique,
187
+ :mauritania,
188
+ :mauritius,
189
+ :mayotte,
190
+ :mexico,
191
+ :micronesia_federated_states_of,
192
+ :moldova_republic_of,
193
+ :monaco,
194
+ :mongolia,
195
+ :montenegro,
196
+ :montserrat,
197
+ :morocco,
198
+ :mozambique,
199
+ :myanmar,
200
+ :namibia,
201
+ :nauru,
202
+ :nepal,
203
+ :netherlands,
204
+ :netherlands_antilles,
205
+ :new_caledonia,
206
+ :new_zealand,
207
+ :nicaragua,
208
+ :niger,
209
+ :nigeria,
210
+ :niue,
211
+ :norfolk_island,
212
+ :northern_mariana_islands,
213
+ :norway,
214
+ :oman,
215
+ :pakistan,
216
+ :palau,
217
+ :palestinian_territory_occupied,
218
+ :panama,
219
+ :papua_new_guinea,
220
+ :paraguay,
221
+ :peru,
222
+ :philippines,
223
+ :pitcairn,
224
+ :poland,
225
+ :portugal,
226
+ :puerto_rico,
227
+ :qatar,
228
+ :reunion,
229
+ :romania,
230
+ :russian_federation,
231
+ :rwanda,
232
+ :saint_barthelemy,
233
+ :saint_helena,
234
+ :saint_kitts_and_nevis,
235
+ :saint_lucia,
236
+ :saint_pierre_and_miquelon,
237
+ :saint_vincent_and_the_grenadines,
238
+ :samoa,
239
+ :san_marino,
240
+ :sao_tome_and_principe,
241
+ :saudi_arabia,
242
+ :senegal,
243
+ :serbia,
244
+ :seychelles,
245
+ :sierra_leone,
246
+ :singapore,
247
+ :slovakia,
248
+ :slovenia,
249
+ :solomon_islands,
250
+ :somalia,
251
+ :south_africa,
252
+ :south_georgia_and_the_south_sandwich_islands,
253
+ :spain,
254
+ :sri_lanka,
255
+ :sudan,
256
+ :suriname,
257
+ :svalbard_and_jan_mayen,
258
+ :swaziland,
259
+ :sweden,
260
+ :switzerland,
261
+ :syrian_arab_republic,
262
+ :taiwan_province_of_china,
263
+ :tajikistan,
264
+ :tanzania_united_republic_of,
265
+ :thailand,
266
+ :timor_leste,
267
+ :togo,
268
+ :tokelau,
269
+ :tonga,
270
+ :trinidad_and_tobago,
271
+ :tunisia,
272
+ :turkey,
273
+ :turkmenistan,
274
+ :turks_and_caicos_islands,
275
+ :tuvalu,
276
+ :uganda,
277
+ :ukraine,
278
+ :united_arab_emirates,
279
+ :united_kingdom,
280
+ :united_states,
281
+ :united_states_minor_outlying_islands,
282
+ :uruguay,
283
+ :uzbekistan,
284
+ :vanuatu,
285
+ :venezuela,
286
+ :viet_nam,
287
+ :virgin_islands_british,
288
+ :virgin_islands_us,
289
+ :wallis_and_futuna,
290
+ :western_sahara,
291
+ :yemen,
292
+ :zambia,
293
+ :zimbabwe] unless const_defined?("COUNTRIES")
294
+
295
+
296
+ USASTATES = [["Alabama", "AL"], ["Alaska", "AK"], ["Arizona", "AZ"], ["Arkansas", "AR"], ["California", "CA"], ["Colorado", "CO"], ["Connecticut", "CT"], ["Delaware", "DE"], ["District of Columbia", "DC"], ["Florida", "FL"], ["Georgia", "GA"], ["Hawaii", "HI"], ["Idaho", "ID"], ["Illinois", "IL"], ["Indiana", "IN"], ["Iowa", "IA"], ["Kansas", "KS"], ["Kentucky", "KY"], ["Louisiana", "LA"], ["Maine", "ME"], ["Maryland", "MD"], ["Massachusetts", "MA"], ["Michigan", "MI"], ["Minnesota", "MN"], ["Mississippi", "MS"], ["Missouri", "MO"], ["Montana", "MT"], ["Nebraska", "NE"], ["Nevada", "NV"], ["New Hampshire", "NH"], ["New Jersey", "NJ"], ["New Mexico", "NM"], ["New York", "NY"], ["North Carolina", "NC"], ["North Dakota", "ND"], ["Ohio", "OH"], ["Oklahoma", "OK"], ["Oregon", "OR"], ["Pennsylvania", "PA"], ["Rhode Island", "RI"], ["South Carolina", "SC"], ["South Dakota", "SD"], ["Tennessee", "TN"], ["Texas", "TX"], ["Utah", "UT"], ["Vermont", "VT"], ["Virginia", "VA"], ["Washington", "WA"], ["Wisconsin", "WI"], ["West Virginia", "WV"], ["Wyoming", "WY"]] unless const_defined?("USASTATES")
297
+
298
+ class ActionView::Helpers::InstanceTag #:nodoc:
299
+ include CountryHelpers
300
+
301
+ def to_country_select_tag(priority_countries, options, html_options)
302
+ html_options = html_options.stringify_keys
303
+ add_default_name_and_id(html_options)
304
+ value = value(object)
305
+ selected_value = options.has_key?(:selected) ? options[:selected] : value
306
+ content_tag("select",
307
+ add_options(
308
+ country_options_for_select(selected_value, priority_countries),
309
+ options, selected_value
310
+ ), html_options
311
+ )
312
+ end
313
+
314
+ def to_usa_state_select_tag(priority_states, options, html_options)
315
+ html_options = html_options.stringify_keys
316
+ add_default_name_and_id(html_options)
317
+ value = value(object)
318
+ selected_value = options.has_key?(:selected) ? options[:selected] : value
319
+ content_tag("select", add_options(usa_state_options_for_select(selected_value, priority_states), options, selected_value), html_options)
320
+ end
321
+ end
322
+ end
323
+
324
+ module FormColumnHelpers
325
+ def active_scaffold_input_country(column, options)
326
+ select_options = {:prompt => as_(:_select_)}
327
+ select_options.merge!(options)
328
+ options.reverse_merge!(column.options).except!(:prompt, :priority)
329
+ options[:name] += '[]' if options[:multiple]
330
+ country_select(:record, column.name, column.options[:priority] || [:united_states], select_options, options)
331
+ end
332
+
333
+ def active_scaffold_input_usa_state(column, options)
334
+ select_options = {:prompt => as_(:_select_)}
335
+ select_options.merge!(options)
336
+ options.reverse_merge!(column.options).except!(:prompt, :priority)
337
+ options[:name] += '[]' if options[:multiple]
338
+ usa_state_select(:record, column.name, column.options[:priority], select_options, options)
339
+ end
340
+ end
341
+
342
+ module SearchColumnHelpers
343
+ def active_scaffold_search_country(column, options)
344
+ active_scaffold_input_country(column, options.merge!(:selected => options.delete(:value)))
345
+ end
346
+
347
+ def active_scaffold_search_usa_state(column, options)
348
+ active_scaffold_input_usa_state(column, options.merge!(:selected => options.delete(:value)))
349
+ end
350
+ end
351
+ end
352
+ end