aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2023-12-17 17:34:32 +0000
committerMatthew Lemon <y@yulqen.org>2023-12-17 17:34:32 +0000
commita3044438caa594a826e49bb08b745c093bcb51cc (patch)
treed8f6ed15fa730807e3c2c5c119d1184892fcdc4c
parent86916794341f20b26b9a321f1e15f9521f94a618 (diff)
Ghetto weekend table colouring
-rw-r--r--app/controllers/events_controller.rb2
-rw-r--r--app/views/events/index.html.erb35
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> %>
-<table class="table table-success table-striped table-bordered mt-2">
+<table class="table table-success table-striped table-bordered mt-5">
+ <thead>
+ <tr>
+ <th>January Date</th>
+ <th>Day</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @january_dates.each do |e| %>
+ <% if e.saturday? %>
+ <tr>
+ <td style="color: gray"><%= e %></td>
+ <td style="color: gray"><%= e.strftime("%A") %></td>
+ </tr>
+ <% elsif e.sunday? %>
+ <tr>
+ <td style="color: gray"><%= e %></td>
+ <td style="color: gray"><%= e.strftime("%A") %></td>
+ </tr>
+ <% else %>
+ <tr>
+ <td><%= e %></td>
+ <td><%= e.strftime("%A") %></td>
+ </tr>
+ <% end %>
+ <% end %>
+ </tbody>
+</table>
+
+<table class="table table-success table-striped table-bordered mt-5">
<tr>
<th>Date</th>
<th>Name</th>
</tr>
<% @events.each do |e| %>
<tr>
- <td><%= e.name %></td>
<td><%= e.date.to_formatted_s(:rfc822) %></td>
+ <td><%= e.name %></td>
</tr>
<% end %>
</table>