33 lines
761 B
Ruby
33 lines
761 B
Ruby
module ApplicationHelper
|
|
def icon(name, options = {})
|
|
options[:title] ||= name.underscore.humanize
|
|
options[:aria] = true
|
|
options[:nocomment] = true
|
|
options[:variant] ||= :outline
|
|
# options[:class] = options.fetch(:class, nil)
|
|
options[:class] = "size-5" unless options[:class]
|
|
path = options.fetch(:path, "icons/#{options[:variant]}/#{name}.svg")
|
|
icon = path
|
|
inline_svg_tag(icon, options)
|
|
end
|
|
|
|
def bool_icon(bool)
|
|
case bool
|
|
when true then "check"
|
|
else "x-mark"
|
|
end
|
|
end
|
|
|
|
def operator?
|
|
controller.class.name.split("::").first=="Operator"
|
|
end
|
|
|
|
def admin?
|
|
controller.class.name.split("::").first=="Admin"
|
|
end
|
|
|
|
def profile?
|
|
controller.class.name.split("::").first=="Profile"
|
|
end
|
|
end
|