manager: refactor day view to allow for more row details (#21244)
This commit is contained in:
parent
b364bdb1d6
commit
2a5e6a95b2
|
@ -22,15 +22,15 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
{% for period, desk_bookings in view.get_timeperiods %}
|
||||
{% for period, desk_infos in view.get_timetable_infos %}
|
||||
|
||||
{% if forloop.first %}
|
||||
<table class="hourspan-{{ hour_span }}">
|
||||
<thead>
|
||||
<tr>
|
||||
<td></td>
|
||||
{% for desk in view.agenda.desk_set.all %}
|
||||
<th>{{ desk.label }}</th>
|
||||
{% for desk_info in desk_infos %}
|
||||
<th>{{ desk_info.desk.label }}</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -39,9 +39,9 @@
|
|||
|
||||
<tr>
|
||||
<th>{{ period|date:"TIME_FORMAT" }}</th>
|
||||
{% for bookings in desk_bookings %}
|
||||
{% for desk_info in desk_infos %}
|
||||
<td>
|
||||
{% for booking in bookings %}
|
||||
{% for booking in desk_info.bookings %}
|
||||
<div class="booked"
|
||||
style="height: {{ booking.css_height }}%; min-height: {{ booking.css_height }}%; top: {{ booking.css_top }}%;"
|
||||
><span class="start-time">{{booking.event.start_datetime|date:"TIME_FORMAT"}}</span>
|
||||
|
|
|
@ -198,7 +198,7 @@ class AgendaDayView(DayArchiveView):
|
|||
'month': next_day.month,
|
||||
'day': next_day.day})
|
||||
|
||||
def get_timeperiods(self):
|
||||
def get_timetable_infos(self):
|
||||
timeperiods = TimePeriod.objects.filter(
|
||||
desk__agenda=self.agenda,
|
||||
weekday=self.date.weekday(),
|
||||
|
@ -222,7 +222,7 @@ class AgendaDayView(DayArchiveView):
|
|||
while current_date < max_date:
|
||||
# for each timeslot return the timeslot date and a list of per-desk
|
||||
# bookings
|
||||
desks_bookings = [] # list of bookings for each desk
|
||||
infos = [] # various infos, for each desk
|
||||
for desk in desks:
|
||||
bookings = [] # bookings for this desk
|
||||
finish_datetime = current_date + interval
|
||||
|
@ -234,9 +234,12 @@ class AgendaDayView(DayArchiveView):
|
|||
booking.css_height = int(100 * event.meeting_type.duration / 60)
|
||||
bookings.append(booking)
|
||||
|
||||
desks_bookings.append(bookings)
|
||||
infos.append({
|
||||
'bookings': bookings,
|
||||
'desk': desk,
|
||||
})
|
||||
|
||||
yield current_date, desks_bookings
|
||||
yield current_date, infos
|
||||
current_date += interval
|
||||
|
||||
agenda_day_view = AgendaDayView.as_view()
|
||||
|
|
Loading…
Reference in New Issue