Thursday, December 5, 2024
HomeRuby On RailsDabbling with Turbo | Drifting Ruby

Dabbling with Turbo | Drifting Ruby


# ~/.railsrc
--skip-jbuilder
--javascript esbuild
--css bootstrap
-m ~/driftingruby/template.rb
# tasks/index.html.erb
<h1>Challenge Checklist</h1>
<% @tasks.every do |challenge| %>
  <%= turbo_frame_tag dom_id(challenge), src: project_path(challenge) %>
<% finish %>

<h1>Challenge Desk</h1>

<desk class="desk">
  <thead>
    <th>Identify</th>
    <th>Lively</th>

    <th colspan=3>Actions</th>
  </thead>
  <tbody>
    <% @tasks.every do |challenge| %>
      <tr>
        <td><%= challenge.identify %></td>
        <td><%= challenge.lively %></td>

        <td><%= link_to "Present", project_path(challenge) %></td>
        <td><%= link_to "Edit", edit_project_path(challenge) %></td>
        <td>
          <%= link_to "Delete", project_path(challenge),
            "data-turbo-method": :delete,
            "data-turbo-confirm": "Are you positive?" %>
        </td>
      </tr>
    <% finish %>
  </tbody>
</desk>

<br>

<%= link_to "New challenge", new_project_path %>
# tasks/_project.html.erb
<%= turbo_frame_tag dom_id(challenge) do %>
  <%= turbo_stream_from challenge %>

  <p>
    <robust>Identify:</robust>
    <%= challenge.identify %>
  </p>

  <p>
    <robust>Lively:</robust>
    <%= challenge.lively %>
  </p>

  <div>
    <%= link_to "Edit", edit_project_path(challenge), goal: "_top" %> |
    <%= link_to "Destroy", project_path(challenge),
            "data-turbo-method": :delete,
            "data-turbo-confirm": "Are you positive?" %> |
    <%= link_to "Again to tasks", projects_path, goal: "_top" %>
  </div>
<% finish %>
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments