Module: Trestle::Turbo::FrameHelper

Defined in:
app/helpers/trestle/turbo/frame_helper.rb

Instance Method Summary collapse

Instance Method Details

#index_turbo_frame(options = {}, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/trestle/turbo/frame_helper.rb', line 4

def index_turbo_frame(options={}, &block)
  defaults = {
    id: "index",
    data: {
      controller: "reloadable",
      turbo_action: "advance"
    }
  }

  ("turbo-frame", defaults.merge(options), &block)
end

#resource_turbo_frame(instance, options = {}, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/trestle/turbo/frame_helper.rb', line 16

def resource_turbo_frame(instance, options={}, &block)
  defaults = {
    id: dom_id(instance),
    target: ("_top" unless modal_request?),
    data: {
      controller: ("deprecated--init" if modal_request? || request.post? || turbo_frame_request?)
    }
  }

  ("turbo-frame", defaults.merge(options), &block)
end