10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/helpers/euro_helper.rb', line 10
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?
end
included_classes += " " + other_named_params[:class] if other_named_params[:class].present?
other_actions = other_named_params.except(:class).keys.map { |key| "#{key}=\"#{other_named_params[key]}\"" }.join(' ')
icon = 'edit' if icon == 'stylus'
icon = 'person_add' if icon == 'account-plus-outline'
icon = 'earth' if icon == 'language'
"<i class=\"material-icons md-#{size} #{name} #{included_classes}\" #{other_actions}>#{icon}</i>".html_safe
end
|