tabletop-companion/app/helpers/application_helper.rb

17 lines
442 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: {}, class: "")
icon = content_tag(:i, nil, class: "nf nf-#{icon_name}").html_safe
link_to icon, path, data:, class:
end
end