Sha256: 6c2dfa4bab067f09b924b66f04aadea942e8409afbde6fbb0bed8ca858dcff65
Contents?: true
Size: 976 Bytes
Versions: 26
Compression:
Stored size: 976 Bytes
Contents
module Spree module CurrencyHelper def currency_options(selected_value = nil) selected_value ||= Spree::Store.default.default_currency currencies = ::Money::Currency.table.map do |_code, details| iso = details[:iso_code] [iso, "#{details[:name]} (#{iso})"] end options_from_collection_for_select(currencies, :first, :last, selected_value) end def supported_currency_options return if current_store.nil? current_store.supported_currencies_list.map(&:iso_code).map { |currency| currency_presentation(currency) } end def should_render_currency_dropdown? return false if current_store.nil? current_store.supported_currencies_list.size > 1 end def currency_symbol(currency) ::Money::Currency.find(currency).symbol end def currency_presentation(currency) label = [currency_symbol(currency), currency].compact.join(' ') [label, currency] end end end
Version data entries
26 entries across 26 versions & 1 rubygems