예제 #1
0
def _render_multirow_subrow(event_iter, time_map, events):
    # Render period block for this row, and the first event.
    e0 = next(event_iter)
    cells = [
        render_attached_period(e0.begin_time, e0.end_time),
        render_block(e0, time_map, events)
    ]
    cols = Location.get_md_width(e0.location)

    # Keep rendering until we fill a row.
    while cols < 3:
        try:
            e = next(event_iter)
        except StopIteration:
            break
        cells.append(render_block(e, time_map, events))
        cols += Location.get_md_width(e.location)
    return cells
예제 #2
0
def _render_multirow_subrow(event_iter, time_map, events):
    # Render period block for this row, and the first event.
    e0 = next(event_iter)
    cells = [
        render_attached_period(e0.begin_time, e0.end_time),
        render_block(e0, time_map, events)
    ]
    cols = Location.get_md_width(e0.location)

    # Keep rendering until we fill a row.
    while cols < 3:
        try:
            e = next(event_iter)
        except StopIteration:
            break
        cells.append(render_block(e, time_map, events))
        cols += Location.get_md_width(e.location)
    return cells
예제 #3
0
def render_block(
        event, time_map, events, extra_classes=None, *,
        min_height=0, max_height=None):
    location = event.location
    height = time_map[event.end_time] - time_map[event.begin_time]
    if max_height is not None:
        height = min(height, max_height)
    if height == 1 and min_height < 1 and not _has_tall_event(events):
        height = 'small'
    return format_html(
        '<div class="slot-item slot-item--w{w} slot-item--h{h}{classes}">'
        '{location}{event}</div>',
        w=Location.get_md_width(location),
        h=height,
        location=render_block_location(location),
        event=render_event(event),
        classes=(' ' + ' '.join(extra_classes) if extra_classes else ''),
    )
예제 #4
0
def render_block(
        event, time_map, events, extra_classes=None, *,
        min_height=0, max_height=None):
    location = event.location
    height = time_map[event.end_time] - time_map[event.begin_time]
    if max_height is not None:
        height = min(height, max_height)
    if height == 1 and min_height < 1 and not _has_tall_event(events):
        height = 'small'
    return format_html(
        '<div class="slot-item slot-item--w{w} slot-item--h{h}{classes}">'
        '{location}{event}</div>',
        w=Location.get_md_width(location),
        h=height,
        location=render_block_location(location),
        event=render_event(event),
        classes=(' ' + ' '.join(extra_classes) if extra_classes else ''),
    )