change timeline to tables for responsiveness
This commit is contained in:
parent
7c5df992ed
commit
0db45d5834
@ -30,7 +30,7 @@ module TimelineHelper
|
|||||||
data = {}
|
data = {}
|
||||||
week = 0
|
week = 0
|
||||||
while( week < @weeks ) do
|
while( week < @weeks ) do
|
||||||
data[ week ] = 0
|
data[ week ] = -1
|
||||||
start_week = Date.today.at_beginning_of_month + week.weeks
|
start_week = Date.today.at_beginning_of_month + week.weeks
|
||||||
end_week = Date.today.at_beginning_of_month + (week + 1).weeks
|
end_week = Date.today.at_beginning_of_month + (week + 1).weeks
|
||||||
@members.each do |mem|
|
@members.each do |mem|
|
||||||
|
@ -1,20 +1,30 @@
|
|||||||
.flex.flex-col.mx-10
|
.mx-10
|
||||||
.flex
|
%table.table-fixed.w-full
|
||||||
- (5..25).each do |week|
|
%tr
|
||||||
.mx-2.mb-2{class: week == @weeks ? "bg-orange-100" : "bg-white"}
|
- ((@weeks - 5)..(@weeks + 5)).each do |week|
|
||||||
|
%td.mx-2.mb-2{colspan: 4 , class: week == @weeks ? "bg-orange-100" : "bg-white"}
|
||||||
=link_to week.to_s , timeline_path( weeks: week)
|
=link_to week.to_s , timeline_path( weeks: week)
|
||||||
.flex
|
%tr
|
||||||
|
- (0...@weeks*7).each do |week|
|
||||||
|
%td{width: 100.0 / (@weeks * 7) }
|
||||||
|
%tr
|
||||||
- (0...@weeks).each do |week|
|
- (0...@weeks).each do |week|
|
||||||
%div{class: bg_for(week) , style: "width: #{week_pixels}px;"}
|
%td{colspan: 7 , class: bg_for(week + 2) }
|
||||||
= (Date.today.at_beginning_of_month + week.weeks).day.to_s + "."
|
= small_date(Date.today.at_beginning_of_month + week.weeks)
|
||||||
= (Date.today.at_beginning_of_month + week.weeks).month
|
%tr
|
||||||
.flex
|
|
||||||
- weekly.each do |week , amount|
|
- weekly.each do |week , amount|
|
||||||
%div{class: bg_for(week) , style: "width: #{week_pixels}px;"}= amount
|
%td{colspan: 7, class: bg_for(week + 2) , style: "width: #{week_pixels}px;"}= amount
|
||||||
|
|
||||||
- @members.each_with_index do |member , index|
|
- @members.each_with_index do |member , index|
|
||||||
.flex
|
%tr{class: bg_for(index)}
|
||||||
.bg-white{style: "width: #{day_pixels*started_days(member)}px;"}
|
- if( (days = started_days(member)) > 0)
|
||||||
.flex.pt-1.inline.justify-between{class: bg_for(index) ,style: "width: #{day_pixels*stay_days(member)}px;"}
|
%td.bg-white{colspan: started_days(member)}
|
||||||
%div= small_date(member.arriving) + " " + member.name
|
- if( (days = stay_days(member)) < 14)
|
||||||
%div= small_date(member.leaving)
|
%td{colspan: days}
|
||||||
.name
|
= small_date(member.arriving)
|
||||||
|
= member.name
|
||||||
|
= small_date(member.leaving)
|
||||||
|
-else
|
||||||
|
%td.py-1{colspan: 4,}= small_date(member.arriving)
|
||||||
|
%td{colspan: days - 8}= member.name
|
||||||
|
%td{colspan: 4}= small_date(member.leaving)
|
||||||
|
Loading…
Reference in New Issue
Block a user