Skip to content

Commit

Permalink
Add link to show + edit + order by name (nanego#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
B-Rass authored Sep 21, 2023
1 parent f863cfd commit eb73e2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/servers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ServersController < ApplicationController
before_action :set_server, only: [:show, :edit, :update, :destroy]

def index
@servers = Server.includes(:frame, :room, :islet, bay: :frames, modele: :category)
@servers = Server.includes(:frame, :room, :islet, bay: :frames, modele: :category).order(:name)
end

def grid
Expand Down
4 changes: 3 additions & 1 deletion app/views/servers/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@
<th>Salle</th>
<th>Ilot</th>
<th>Baie</th>
<th></th>
</tr>
</thead>

<tbody>
<%= content_tag_for(:tr, @servers) do |server| %>
<td><%= server.name %></td>
<td><%= link_to server.name, server_path(server) %></td>
<td><%= server.modele.try(:category) %></td>
<td><%= server.room %></td>
<td><%= server.islet %></td>
<td><%= server.bay %></td>
<td><%= link_to 'Modifier', edit_server_path(server), class: 'btn btn-primary' %></td>
<% end %>
</tbody>
</table>
Expand Down

0 comments on commit eb73e2c

Please sign in to comment.