tabletop-companion/app/helpers/application_helper.rb

17 lines
428 B
Ruby

# frozen_string_literal: true
module ApplicationHelper
def display_form_errors(object, attr)
return unless object.errors.include?(attr)
content_tag(:div, class: "invalid-feedback") do
object.errors.full_messages_for(attr).join(". ")
end
end
def icon_link_to(icon_name, path, data: {})
icon = content_tag(:i, nil, class: "nf nf-#{icon_name}").html_safe
link_to icon, path, data: data
end
end