From b50e73ef69f82f01a0331a1bef2879be2ccdb07f Mon Sep 17 00:00:00 2001
From: Teal <git@teal.is>
Date: Mon, 27 May 2024 17:06:32 +0200
Subject: [PATCH] grey out past sessions instead

---
 app/assets/stylesheets/application.tailwind.css | 5 ++++-
 app/views/assignments/index.html.erb            | 7 ++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/app/assets/stylesheets/application.tailwind.css b/app/assets/stylesheets/application.tailwind.css
index 982c163..6090ba1 100644
--- a/app/assets/stylesheets/application.tailwind.css
+++ b/app/assets/stylesheets/application.tailwind.css
@@ -68,4 +68,7 @@ select {
   a {
     @apply underline hover:text-blue-600 hover:border-blue-600;
   }
-}
\ No newline at end of file
+}
+.past {
+  @apply opacity-50;
+}
diff --git a/app/views/assignments/index.html.erb b/app/views/assignments/index.html.erb
index 63d8176..456a7b3 100644
--- a/app/views/assignments/index.html.erb
+++ b/app/views/assignments/index.html.erb
@@ -1,12 +1,13 @@
+<% now = Time.now %>
 <div>
-  <% @assignments.future.group_by(&:user).each do |user, assignments| %>
+  <% @assignments.group_by(&:user).each do |user, assignments| %>
     <div class="my-8">
       <h4 class="text-xl my-2"><%= link_to user.name, user_assignments_path(user) %> <span class="font-normal"><%= link_to user_assignments_path(user, format: 'ics') do %><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="ml-2 mb-1 size-4 inline-block stroke-slate-400 fill-slate-400"><path fill-rule="evenodd" d="M5.75 2a.75.75 0 01.75.75V4h7V2.75a.75.75 0 011.5 0V4h.25A2.75 2.75 0 0118 6.75v8.5A2.75 2.75 0 0115.25 18H4.75A2.75 2.75 0 012 15.25v-8.5A2.75 2.75 0 014.75 4H5V2.75A.75.75 0 015.75 2zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75z" clip-rule="evenodd"></path></svg><% end %></span></h4>
         <% assignments.group_by { |a| a.session.starts_at.strftime('%Y-%m-%d') }.each do |date, assignments_on_date| %>
-          <h5 class="text-base mt-2"><%= date %></h5>
+          <h5 class="text-base mt-2 <%= date < now ? "past" : "future" %>"><%= date %></h5>
           <ol class="list-inside">
             <% assignments_on_date.each do |assignment| %>
-              <li>
+              <li class="<%= assignment.session.starts_at < now ? "past" : "future" %>">
                 <%= assignment.session.starts_at.strftime('%H:%M') %> @ <%= assignment.session.stage.name %>:
                 <%= link_to assignment.session.title, assignment.session %>
                 <small><% assignment.session.assignments.map(&:user).reject{ |u| u == user }.each do |other_user| %>
-- 
GitLab