blob: 3cf055b3e111a84c74bc3e7d6c9ee51987dd0784 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
module SMSFuHelper
# Returns a collection of carriers to be used in your own select tag
# e.g., <%= f.select :mobile_carrier, carrier_collection %>
def carrier_collection
SMSFu.carriers.sort.collect{ |carrier| [carrier[1]["name"], carrier[0]] }
end
# Returns a formatted select box filled with carriers
# e.g., <%= carrier_select %>
# - name => name of the method in which you want to store the carrier name
# - phrase => default selected blank option in select box
def carrier_select(name = :mobile_carrier, phrase = "Select a Carrier")
select_tag name, options_for_select([phrase,nil]+carrier_collection, phrase)
end
def carrier_select_default(name = :mobile_carrier, default = nil)
select_tag name, options_for_select([nil]+carrier_collection, default)
end
end
|