From a3044438caa594a826e49bb08b745c093bcb51cc Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Sun, 17 Dec 2023 17:34:32 +0000 Subject: Ghetto weekend table colouring --- app/controllers/events_controller.rb | 2 ++ app/views/events/index.html.erb | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 62708a5..d9e390a 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -4,6 +4,8 @@ class EventsController < ApplicationController # GET /events or /events.json def index @events = Event.all.order(date: :asc) + @january_dates = Date.new(2023, 01, 01)..Date.new(2023, 01, 31) + render "index" end # GET /events/1 or /events/1.json diff --git a/app/views/events/index.html.erb b/app/views/events/index.html.erb index 16c656b..f07b5df 100644 --- a/app/views/events/index.html.erb +++ b/app/views/events/index.html.erb @@ -4,17 +4,46 @@ <%= render partial: "events/form", locals: { event: Event.new } %> -<%= link_to "New event", new_event_path %> +<%# <%= link_to "New event", new_event_path %1> %> - +
+ + + + + + + + <% @january_dates.each do |e| %> + <% if e.saturday? %> + + + + + <% elsif e.sunday? %> + + + + + <% else %> + + + + + <% end %> + <% end %> + +
January DateDay
<%= e %><%= e.strftime("%A") %>
<%= e %><%= e.strftime("%A") %>
<%= e %><%= e.strftime("%A") %>
+ + <% @events.each do |e| %> - + <% end %>
Date Name
<%= e.name %> <%= e.date.to_formatted_s(:rfc822) %><%= e.name %>
-- cgit v1.2.3