From b6854c648bfb08d760f4adf860148783a0015dee Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 19 Feb 2005 12:22:13 +0000 Subject: Added Iran and Irak to the countries list used by FormOptions#country_select and FormOptions#country_options_for_select git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@686 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/form_options_helper.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 2c321b8336..ee334dfb66 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -47,7 +47,7 @@ module ActionView # where the elements respond to first and last (such as a two-element array), the "lasts" serve as option values and # the "firsts" as option text. Hashes are turned into this form automatically, so the keys become "firsts" and values # become lasts. If +selected+ is specified, the matching "last" or element will get the selected option-tag. +Selected+ - # may also be an array of values to be selected when using a multiple select. + # may also be an array of values to be selected when using a multiple select. # # Examples (call, result): # options_for_select([["Dollar", "$"], ["Kroner", "DKK"]]) @@ -61,6 +61,8 @@ module ActionView # # options_for_select([ "VISA", "MasterCard", "Discover" ], ["VISA", "Discover"]) # \n\n + # + # NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag. def options_for_select(container, selected = nil) container = container.to_a if Hash === container @@ -88,6 +90,8 @@ module ActionView # Example (call, result). Imagine a loop iterating over each +person+ in @project.people to generate a input tag: # options_from_collection_for_select(@project.people, "id", "name") # + # + # NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag. def options_from_collection_for_select(collection, value_method, text_method, selected_value = nil) options_for_select( collection.inject([]) { |options, object| options << [ object.send(text_method), object.send(value_method) ] }, @@ -126,6 +130,8 @@ module ActionView # def country_id() @id; end # def country_name() @name; end # end + # + # NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag. def option_groups_from_collection_for_select(collection, group_method, group_label_method, option_key_method, option_value_method, selected_key = nil) collection.inject("") do |options_for_select, group| @@ -139,6 +145,8 @@ module ActionView # Returns a string of option tags for pretty much any country in the world. Supply a country name as +selected+ to # have it marked as the selected option tag. You can also supply an array of countries as +priority_countries+, so # that they will be listed above the rest of the (long) list. + # + # NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag. def country_options_for_select(selected = nil, priority_countries = nil) country_options = "" @@ -176,7 +184,7 @@ module ActionView "Georgia", "Germany", "Ghana", "Gibraltar", "Great Britain", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard and Mc Donald Islands", "Honduras", "Hong Kong", "Hungary", "Iceland", - "India", "Indonesia", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", + "India", "Indonesia", "Ireland", "Israel", "Italy", , "Iran", "Irak", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, Republic of", "Korea (South)", "Kuwait", "Kyrgyzstan", "Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia", -- cgit v1.2.3