Module: Rodauth::Rails::Feature::Render
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/rodauth/rails/feature/render.rb
Instance Method Summary collapse
- #button ⇒ Object
-
#render(page) ⇒ Object
Renders templates without layout.
- #turbo_stream ⇒ Object
-
#view(page, title) ⇒ Object
Renders templates with layout.
Instance Method Details
#button ⇒ Object
27 28 29 |
# File 'lib/rodauth/rails/feature/render.rb', line 27 def (*) super.html_safe end |
#render(page) ⇒ Object
Renders templates without layout. First tries to render a user-defined template or partial, otherwise falls back to Rodauth’s template.
21 22 23 24 25 |
# File 'lib/rodauth/rails/feature/render.rb', line 21 def render(page) rails_render(partial: page.tr("-", "_"), layout: false) || rails_render(action: page.tr("-", "_"), layout: false) || super.html_safe end |
#turbo_stream ⇒ Object
32 33 34 |
# File 'lib/rodauth/rails/feature/render.rb', line 32 def turbo_stream rails_controller_instance.send(:turbo_stream) end |
#view(page, title) ⇒ Object
Renders templates with layout. First tries to render a user-defined template, otherwise falls back to Rodauth’s template.
13 14 15 16 17 |
# File 'lib/rodauth/rails/feature/render.rb', line 13 def view(page, title) set_title(title) rails_render(action: page.tr("-", "_"), layout: true) || rails_render(html: super.html_safe, layout: true, formats: :html) end |