tabletop-companion/app/helpers/application_helper.rb

17 lines
428 B
Ruby
Raw Normal View History

2024-05-26 10:45:10 +00:00
# frozen_string_literal: true
2024-04-13 10:22:40 +00:00
module ApplicationHelper
2024-05-29 07:46:31 +00:00
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
2024-06-18 07:43:39 +00:00
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
2024-04-13 10:22:40 +00:00
end