From 9d1d88c66da5b15d026fd07c58463d3bdd62dd87 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 10 Oct 2024 22:35:39 +0200 Subject: More alignment fixes. Use floating point division to calculate start coordinate and height of events. Integer division truncated the values to they got a bit off. A few other minor adjustments was made. --- index.html.erb | 2 +- ramaskrik-program.rb | 6 +++--- styles.css | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/index.html.erb b/index.html.erb index 62f31d2..2949dc8 100644 --- a/index.html.erb +++ b/index.html.erb @@ -36,7 +36,7 @@

Kl.

<% (start_time..end_time).step(3600 / 4) do |time| %> -
+
<%= Time.at(time).strftime('%H:%M') %>
<% end %> diff --git a/ramaskrik-program.rb b/ramaskrik-program.rb index cd22839..f2b308b 100755 --- a/ramaskrik-program.rb +++ b/ramaskrik-program.rb @@ -33,8 +33,8 @@ class EventDecorator < SimpleDelegator attr_reader :height def calc_offsets(time_offset) - @offset = 5 + (start_time - time_offset).to_i / 50 - @height = 5 + duration / 50; + @offset = 5 + (start_time - time_offset).to_f / 50 + @height = 5 + duration.to_f / 50; start_time + duration end end @@ -52,7 +52,7 @@ class SortedEventList .sort{ |a,b| a.start_time - b.start_time } .map{ |e| EventDecorator.new(e) } - @start_time = @events.first.start_time - (@events.first.start_time.min * 60) + @start_time = @events.first.start_time # - (@events.first.start_time.min * 60) @events.group_by{|e| e.venue}.each do |venue, events| time_offset = start_time diff --git a/styles.css b/styles.css index dd6071d..561983a 100644 --- a/styles.css +++ b/styles.css @@ -43,6 +43,7 @@ a:hover { } .timestamp { position: absolute; + font-family: Helvetica, Arial, "Sans Serif"; font-size: 10px; } .event-item { -- cgit v1.2.3