Show multiple courses
This commit is contained in:
parent
a36284b73e
commit
34c5f771ad
@ -1,5 +1,5 @@
|
|||||||
class AttendanceTrackerController < ApplicationController
|
class AttendanceTrackerController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@course = Course.first
|
@courses = Course.all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
<h1 class="text-3xl font-medium">Attendance Tracker</h1>
|
<h1 class="text-3xl font-medium">Attendance Tracker</h1>
|
||||||
|
|
||||||
<div class="px-4 sm:px-6 lg:px-8">
|
<div class="px-4 sm:px-6 lg:px-8">
|
||||||
|
<% @courses.each do |course| %>
|
||||||
<div class="mt-8 flow-root">
|
<div class="mt-8 flow-root">
|
||||||
<div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
<div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
||||||
<div class="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8">
|
<div class="inline-block py-2 align-middle sm:px-6 lg:px-8">
|
||||||
<div class="overflow-hidden shadow ring-1 ring-black ring-opacity-5 sm:rounded-lg">
|
<div class="overflow-hidden shadow ring-1 ring-black ring-opacity-5 sm:rounded-lg">
|
||||||
<h2 class="text-2xl p-2 px-4"><%= @course.title %></h2>
|
<h2 class="text-2xl p-2 px-4"><%= course.title %></h2>
|
||||||
|
|
||||||
<table class="border-t-2 min-w-full divide-y divide-gray-300">
|
<table class="border-t-2 divide-y divide-gray-300">
|
||||||
<thead class="bg-gray-50">
|
<thead class="bg-gray-50">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Lecture</th>
|
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Lecture</th>
|
||||||
@ -18,7 +19,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody class="divide-y divide-gray-200 bg-white">
|
<tbody class="divide-y divide-gray-200 bg-white">
|
||||||
|
|
||||||
<% @course.lectures.group_by { |lecture| lecture.week_number }.each do |(week_number, lectures)| %>
|
<% course.lectures.group_by { |lecture| lecture.week_number }.each do |(week_number, lectures)| %>
|
||||||
<tr class="border-t border-gray-200">
|
<tr class="border-t border-gray-200">
|
||||||
<th colspan="4" scope="colgroup" class="bg-gray-50 py-2 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Week <%= week_number %></th>
|
<th colspan="4" scope="colgroup" class="bg-gray-50 py-2 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Week <%= week_number %></th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -73,4 +74,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user