Class: RailsDevtools::Routes::RouteDetails::RoutePathInput

Inherits:
Components::ApplicationComponent show all
Defined in:
app/views/rails_devtools/routes/route_details/route_path_input.rb

Instance Method Summary collapse

Methods inherited from Components::ApplicationComponent

#before_template

Constructor Details

#initialize(route:, prefix: "", suffix: "path") ⇒ RoutePathInput

Returns a new instance of RoutePathInput.



6
7
8
9
10
# File 'app/views/rails_devtools/routes/route_details/route_path_input.rb', line 6

def initialize(route:, prefix: "", suffix: "path")
  @route = route
  @prefix = prefix
  @suffix = suffix
end

Instance Method Details

#view_templateObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/views/rails_devtools/routes/route_details/route_path_input.rb', line 12

def view_template
  turbo_frame_tag("route_path_input") do
    div(
      class: "join w-full",
      data_controller: "clipboard",
      data_clipboard_success_content_value: "Copied!"
    ) do
      input(
        value: input_value,
        class: "input input-bordered input-primary input-sm w-full join-item",
        data_clipboard_target: "source"
      )
      button(
        class: "btn btn-primary btn-outline btn-sm join-item",
        data_action: "clipboard#copy",
        data_clipboard_target: "button"
      ) { "Copy" }
    end
  end
end