Sha256: c5ffca5882925fa67521ff7627373b239df0a4fd29ae8bc2d949917f0873ca4b

Contents?: true

Size: 834 Bytes

Versions: 2

Compression:

Stored size: 834 Bytes

Contents

module EuroHelper
  def nbsp
    [160].pack('U*')
  end

  def euros(number_in_euros)
    number_to_currency number_in_euros, unit: "€", separator: ",", delimiter: nbsp, format: "%n#{nbsp}%u"
  end

  def mdi_tag(name = nil, included_classes: '', size: 16, icon: 'highlight_off', **other_named_params)
    if name.match?(/^([\w\-\_]+)( (\d\d)px)?$/) && size == 16 && icon == 'highlight_off'
      results = name.match(/^([\w\-\_]+)( (\d\d)px)?$/)
      icon = results[1]
      size = results[3].to_i if results[3].present?
      included_classes += " " + other_named_params[:class] if other_named_params[:class].present?
    end

    icon = 'edit' if icon == 'stylus'
    icon = 'person_add' if icon == 'account-plus-outline'

    "<i class=\"material-icons md-#{size} #{name} #{included_classes}\">#{icon}</i>".html_safe
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shopapp-0.75.02 app/helpers/euro_helper.rb
shopapp-0.73.02 app/helpers/euro_helper.rb