tabletop-companion/app/helpers/application_helper.rb

17 lines
442 B
Ruby
Raw Permalink 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
2024-06-21 08:09:19 +00:00
def icon_link_to(icon_name, path, data: {}, class: "")
2024-06-18 07:43:39 +00:00
icon = content_tag(:i, nil, class: "nf nf-#{icon_name}").html_safe
2024-06-21 08:09:19 +00:00
link_to icon, path, data:, class:
2024-06-18 07:43:39 +00:00
end
2024-04-13 10:22:40 +00:00
end