Module: Rodauth::Rails::Feature::Render

Extended by:
ActiveSupport::Concern
Defined in:
lib/rodauth/rails/feature/render.rb

Instance Method Summary collapse

Instance Method Details

#buttonObject



28
29
30
# File 'lib/rodauth/rails/feature/render.rb', line 28

def button(*)
  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.



22
23
24
25
26
# File 'lib/rodauth/rails/feature/render.rb', line 22

def render(page)
  rails_render(partial: page.tr("-", "_"), layout: false) ||
    rails_render(action: page.tr("-", "_"), layout: false) ||
    super.html_safe
end

#turbo_streamObject



33
34
35
# File 'lib/rodauth/rails/feature/render.rb', line 33

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
18
# File 'lib/rodauth/rails/feature/render.rb', line 13

def view(page, title)
  set_title(title)
  rails_controller_instance.content_type = Mime[:html].to_s
  rails_render(action: page.tr("-", "_"), layout: true) ||
    rails_render(html: super.html_safe, layout: true, formats: :html)
end