diff --git a/Gemfile b/Gemfile index adde6bd..5ea418d 100644 --- a/Gemfile +++ b/Gemfile @@ -72,3 +72,4 @@ group :test do end gem "tailwindcss-rails", "~> 2.0" +gem "font-awesome-sass" diff --git a/Gemfile.lock b/Gemfile.lock index c9a543c..59a2e27 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 288b9ab..ed8c1b0 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -11,5 +11,6 @@ * It is generally better to create a new file per style scope. * *= require_tree . + *= require _font-awesome *= require_self */ diff --git a/app/controllers/attendance_tracker_controller.rb b/app/controllers/attendance_tracker_controller.rb index 10cd500..252fbec 100644 --- a/app/controllers/attendance_tracker_controller.rb +++ b/app/controllers/attendance_tracker_controller.rb @@ -1,4 +1,5 @@ class AttendanceTrackerController < ApplicationController def index + @course = Course.first end end diff --git a/app/models/course.rb b/app/models/course.rb index 25e8ed7..53f605b 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -1,2 +1,3 @@ class Course < ApplicationRecord + has_many :lectures end diff --git a/app/models/lecture.rb b/app/models/lecture.rb index 89d9b3f..a525ab9 100644 --- a/app/models/lecture.rb +++ b/app/models/lecture.rb @@ -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 diff --git a/app/views/attendance_tracker/index.html.erb b/app/views/attendance_tracker/index.html.erb index 52f7f5c..3387cb0 100644 --- a/app/views/attendance_tracker/index.html.erb +++ b/app/views/attendance_tracker/index.html.erb @@ -5,7 +5,7 @@
| Week 1 | -|||
|---|---|---|---|
| Week <%= week_number %> | +|||
| Lindsay Walton | -Front-end Developer | -lindsay.walton@example.com | -Member | -
| Week 1 | -|||
| Lindsay Walton | -Front-end Developer | -lindsay.walton@example.com | -Member | -
| Lindsay Walton | -Front-end Developer | -lindsay.walton@example.com | -Member | -
| Lindsay Walton | -Front-end Developer | -lindsay.walton@example.com | -Member | -
| + <%= lecture.title %> + | ++ <%= lecture.start_time.to_fs(:dmy) %> + | ++ <% if lecture.status == 'future' %> + + <% elsif lecture.status == 'happening_now' %> + + <% elsif lecture.status == 'attended_in_person' %> + + <% elsif lecture.status == 'watched_recording' %> + + <% else %> + <% lecture.status %> + <% end %> + | ++ + | +