Tuesday, March 21, 2023
HomeRuby On RailsDabbling with Turbo | Drifting Ruby

Dabbling with Turbo | Drifting Ruby


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

<h1>Challenge Desk</h1>

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

    <th colspan=3>Actions</th>
  </thead>
  <tbody>
    <% @initiatives.every do |mission| %>
      <tr>
        <td><%= mission.identify %></td>
        <td><%= mission.energetic %></td>

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

<br>

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

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

  <p>
    <robust>Lively:</robust>
    <%= mission.energetic %>
  </p>

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments