Sha256: 44a812c1a31b800844ba190ad5ae9bcfe6b3a833b44c7f42b5c6f1343929073a

Contents?: true

Size: 668 Bytes

Versions: 43

Compression:

Stored size: 668 Bytes

Contents

require 'countries'
require 'express_templates/components/forms/select'

module ExpressTemplates
  module Components
    module Forms
      class CountrySelect < Select

        def select_options
          country_options = ISO3166::Country.all.map {|country| [country.name.titleize, country.alpha2]}
          us = country_options.delete(['United States', 'US'])
          country_options.unshift us
          helpers.options_for_select(country_options, selected_value)
        end

        def select_helper_options
          add_select2_class( input_attributes.merge(include_blank: false, prompt: "-- Please Select --" ) )
        end

      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
express_admin-1.6.9 app/components/express_admin/country_select.rb
express_admin-1.6.8 app/components/express_admin/country_select.rb
express_admin-1.6.7 app/components/express_admin/country_select.rb