Some initial UI work
This commit is contained in:
parent
376e80e385
commit
d14903fcb4
1
Gemfile
1
Gemfile
@ -72,3 +72,4 @@ group :test do
|
||||
end
|
||||
|
||||
gem "tailwindcss-rails", "~> 2.0"
|
||||
gem "font-awesome-sass"
|
||||
|
||||
@ -88,6 +88,9 @@ GEM
|
||||
irb (>= 1.5.0)
|
||||
reline (>= 0.3.1)
|
||||
erubi (1.12.0)
|
||||
ffi (1.16.2)
|
||||
font-awesome-sass (6.4.2)
|
||||
sassc (~> 2.0)
|
||||
globalid (1.2.1)
|
||||
activesupport (>= 6.1)
|
||||
i18n (1.14.1)
|
||||
@ -175,6 +178,8 @@ GEM
|
||||
io-console (~> 0.5)
|
||||
rexml (3.2.6)
|
||||
rubyzip (2.3.2)
|
||||
sassc (2.4.0)
|
||||
ffi (~> 1.9)
|
||||
selenium-webdriver (4.10.0)
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
rubyzip (>= 1.2.2, < 3.0)
|
||||
@ -223,6 +228,7 @@ DEPENDENCIES
|
||||
bootsnap
|
||||
capybara
|
||||
debug
|
||||
font-awesome-sass
|
||||
importmap-rails
|
||||
jbuilder
|
||||
pg (~> 1.1)
|
||||
|
||||
@ -11,5 +11,6 @@
|
||||
* It is generally better to create a new file per style scope.
|
||||
*
|
||||
*= require_tree .
|
||||
*= require _font-awesome
|
||||
*= require_self
|
||||
*/
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
class AttendanceTrackerController < ApplicationController
|
||||
def index
|
||||
@course = Course.first
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
class Course < ApplicationRecord
|
||||
has_many :lectures
|
||||
end
|
||||
|
||||
@ -3,9 +3,13 @@ class Lecture < ApplicationRecord
|
||||
|
||||
enum :status, [
|
||||
:future,
|
||||
:live,
|
||||
:attended,
|
||||
:watched,
|
||||
:happening_now,
|
||||
:attended_in_person,
|
||||
:watched_recording,
|
||||
:missed,
|
||||
]
|
||||
|
||||
def week_number
|
||||
((start_time.beginning_of_week - Time.new('2023-10-02')) / 1.week).floor
|
||||
end
|
||||
end
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<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="overflow-hidden shadow ring-1 ring-black ring-opacity-5 sm:rounded-lg">
|
||||
<h2 class="text-2xl p-2 px-4">Continuum Mechanics</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">
|
||||
<thead class="bg-gray-50">
|
||||
@ -18,41 +18,40 @@
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
|
||||
<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-5">Week 1</th>
|
||||
</tr>
|
||||
<% @course.lectures.group_by { |lecture| lecture.week_number }.each do |(week_number, lectures)| %>
|
||||
<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>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">Lindsay Walton</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">Front-end Developer</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">lindsay.walton@example.com</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">Member</td>
|
||||
</tr>
|
||||
|
||||
<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-5">Week 1</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">Lindsay Walton</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">Front-end Developer</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">lindsay.walton@example.com</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">Member</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">Lindsay Walton</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">Front-end Developer</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">lindsay.walton@example.com</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">Member</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">Lindsay Walton</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">Front-end Developer</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">lindsay.walton@example.com</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">Member</td>
|
||||
</tr>
|
||||
|
||||
<!-- More people... -->
|
||||
<% lectures.each do |lecture| %>
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">
|
||||
<%= lecture.title %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
||||
<%= lecture.start_time.to_fs(:dmy) %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
||||
<% if lecture.status == 'future' %>
|
||||
<i class="fa fa-clock"></i>
|
||||
<% elsif lecture.status == 'happening_now' %>
|
||||
<i class="fa fa-hourglass-start"></i>
|
||||
<% elsif lecture.status == 'attended_in_person' %>
|
||||
<i class="fa fa-chalkboard-user"></i>
|
||||
<% elsif lecture.status == 'watched_recording' %>
|
||||
<i class="fa fa-video"></i>
|
||||
<% else %>
|
||||
<% lecture.status %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
||||
<button type="button" class="rounded bg-indigo-600 px-2 py-1 font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">
|
||||
Start
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
2
config/initializers/date_formats.rb
Normal file
2
config/initializers/date_formats.rb
Normal file
@ -0,0 +1,2 @@
|
||||
Time::DATE_FORMATS[:dmy] = "%d/%m/%Y"
|
||||
Date::DATE_FORMATS[:dmy] = "%d/%m/%Y"
|
||||
Loading…
Reference in New Issue
Block a user