vidpush/app/helpers/application_helper.rb
2014-04-24 17:13:39 -04:00

88 lines
2.5 KiB
Ruby

module ApplicationHelper
def voiceoverselection_list(options={})
voiceoverselections = []
voiceoverselections << ["1 - Male", 1]
voiceoverselections << ["2 - Female", 2]
voiceoverselections << ["3 - No Preference", 3]
return options.empty? ? voiceoverselections : convert_to_hash(voiceoverselections)[options[:item]]
end
def musicselection_list(options={})
musicselections = []
musicselections << ["0 - No Preference", 0]
musicselections << ["1 - Easy", 1]
musicselections << ["2 - Jazzy", 2]
musicselections << ["3 - High Energy", 3]
musicselections << ["4 - New Age", 4]
musicselections << ["5 - Positive", 5]
musicselections << ["6 - Rock", 6]
return options.empty? ? musicselections : convert_to_hash(musicselections)[options[:item]]
end
def us_states(options={})
states = [
['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'],
['Puerto Rico', 'PR'],
['Rhode Island', 'RI'],
['South Carolina', 'SC'],
['South Dakota', 'SD'],
['Tennessee', 'TN'],
['Texas', 'TX'],
['Utah', 'UT'],
['Vermont', 'VT'],
['Virginia', 'VA'],
['Washington', 'WA'],
['West Virginia', 'WV'],
['Wisconsin', 'WI'],
['Wyoming', 'WY']
]
return options.empty? ? states : convert_to_hash(states)[options[:item]]
end
private
def convert_to_hash(list)
list.map!{|x| x= x[1],x[0]}
return Hash[*list.flatten]
end
end