1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 13:19:39 +02:00
Maybe/app/helpers/application_helper.rb
Josh Brown 80f68b657c
Fix translation scope within modals (#404)
* Patch virtual_path within modal helper

Added an example translation within the modal to test.

* Fix modal translation scope

By changing this to a partial that accepts the content via a local var
instead of a layout the virtual path, and therefore translation scope is
not changed.
2024-02-09 08:25:59 -06:00

20 lines
534 B
Ruby

module ApplicationHelper
def title(page_title)
content_for(:title) { page_title }
end
def header_title(page_title)
content_for(:header_title) { page_title }
end
def permitted_accountable_partial(name)
name.underscore
end
# Wrap view with <%= modal do %> ... <% end %> to have it open in a modal
# Make sure to add data-turbo-frame="modal" to the link/button that opens the modal
def modal(&block)
content = capture &block
render partial: "shared/modal", locals: { content: content }
end
end