0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 04:12:53 +01:00
discourse-custom-wizard/lib/custom_wizard/flags.rb
2019-12-05 17:48:32 +11:00

31 Zeilen
748 B
Ruby

class CustomWizard::Flag
def initialize(id, name)
@id = id
@name = name
end
def id
@id
end
def name
@name
end
end
class CustomWizard::Flags
def self.list
raw_flags = YAML.safe_load(File.read(File.join(Rails.root, 'plugins', 'discourse-custom-wizard', 'config', 'national_flags.yml')))
flagscollection = []
raw_flags.map do |name, pic|
# This is super hacky. Adding the trailing space actually stops search breaking in the dropdown! (and doesn't compromise the view!)
# Feeding just name, name will break search
flagscollection << CustomWizard::Flag.new(name, "#{name} ")
end
flagscollection
end
end