From a36284b73ee4f6e070b28c865f5e3fc89f394068 Mon Sep 17 00:00:00 2001 From: Joshua Coles Date: Fri, 29 Sep 2023 19:01:35 +0100 Subject: [PATCH] Make the UI a little more complete --- app/models/lecture.rb | 8 ++++++ app/views/attendance_tracker/index.html.erb | 29 ++++++++++++++++----- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/app/models/lecture.rb b/app/models/lecture.rb index a525ab9..3b8a22e 100644 --- a/app/models/lecture.rb +++ b/app/models/lecture.rb @@ -12,4 +12,12 @@ class Lecture < ApplicationRecord def week_number ((start_time.beginning_of_week - Time.new('2023-10-02')) / 1.week).floor end + + def live_video_url + nil + end + + def recording_url + "https://google.com" + end end diff --git a/app/views/attendance_tracker/index.html.erb b/app/views/attendance_tracker/index.html.erb index 3387cb0..1719a62 100644 --- a/app/views/attendance_tracker/index.html.erb +++ b/app/views/attendance_tracker/index.html.erb @@ -33,21 +33,36 @@ <% if lecture.status == 'future' %> - + Future <% elsif lecture.status == 'happening_now' %> - + Happening Now <% elsif lecture.status == 'attended_in_person' %> - + <% elsif lecture.status == 'watched_recording' %> - + + <% elsif lecture.status == 'missed' %> + <% else %> <% lecture.status %> <% end %> + - + <% if lecture.status == 'future' %> + <% elsif lecture.status == 'happening_now' && lecture.live_video_url.present? %> + <% link_to "Open live", lecture.live_video_url %> + <% elsif lecture.status == 'attended_in_person' %> + <% link_to "Open recording", lecture.recording_url %> + + <% elsif lecture.status == 'watched_recording' %> + + <% elsif lecture.status == 'missed' %> + + <% else %> + <% lecture.status %> + <% end %> <% end %>