Skip to content

Commit

Permalink
a table!
Browse files Browse the repository at this point in the history
  • Loading branch information
epugh committed Jul 26, 2023
1 parent e3058d4 commit b75d856
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

class HomeController < ApplicationController
def show
@cases = @current_user.cases
end
end
21 changes: 21 additions & 0 deletions app/views/home/_case.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<tr>
<th scope="row"><%= kase.case_name %></th>
<td><%= kase.queries.count %>/td>
<td>
<% unless kase.last_score.blank? %>
<%= kase.last_score.score %>
<% end %>
</td>
<td>
<% unless kase.last_score.blank? %>
<%= kase.last_score.created_at%>
<% end %>
</td>
<td>
<% unless kase.last_score.blank? %>
<%= kase.last_score.user.name%>
<% end %>
</td>

<td><%= link_to 'View', case_core_path(kase), class: 'btn btn-sm btn-primary', role: 'button' %></td>
</tr>
28 changes: 28 additions & 0 deletions app/views/home/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,31 @@ Inspired by https://dev.to/themesberg/tutorial-how-to-build-a-simple-admin-dashb
showArea: true
});
</script>


<hr/>

<div class="card">
<h5 class="card-header">Cases Summary</h5>
<div class="card-body">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Case Title</th>
<th scope="col"># of Queries</th>
<th scope="col">Last Score</th>
<th scope="col">Last Run On</th>
<th scope="col">Last Run By</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<%= render partial: "case", collection: @cases, as: :kase %>
</tbody>
</table>
</div>
<%= link_to 'View all', cases_path(), class: 'btn btn-block btn-light', role: 'button' %>

</div>
</div>

0 comments on commit b75d856

Please sign in to comment.