<div id="workspace-events"
     tal:define="
       ws view/workspace;
       ws_view nocall:ws/@@view;
       events view/events;
       can_add view/can_add;
     "
     i18n:domain="ploneintranet"
>
  <div class="pat-toolbar sticky"
       id="-functions"
  >
    <div class="toolbar-functions-area">
      <div class="quick-functions toolbar-section">
        <a class="create pat-modal icon"
           href="${ws/absolute_url}/add_event#document-content"
           title="Create new event"
           data-pat-modal="class: panel medium panel-create-event"
           tal:condition="can_add"
           i18n:attributes="title"
           i18n:translate=""
        >Create event</a>
        <a class="pat-tooltip more-menu-trigger icon more"
           href="${here/absolute_url}/workspace-calendar-more-menu#calendar-more-menu"
           data-pat-tooltip="source: ajax; position-list: tl"
        >Options</a>
        <a class="pat-toggle icon resize-full"
           title="expand/reduce sidebar"
           data-pat-toggle="selector: #application-body; value: sidebar-normal sidebar-large"
           i18n:attributes="title"
           i18n:translate=""
        >Expand sidebar</a>
      </div>
    </div>
  </div>
  <div class="content">
    <p class="action-buttons">
      <a class="call-to-action icon-grid pat-inject pat-switch"
         href="${ws/absolute_url}/@@workspace-calendar#document-body"
         data-pat-inject="source: #document-body::element; target:#document-body::element;"
         data-pat-switch="selector: #application-body; remove: focus-*; add: focus-document"
         i18n:translate=""
      >Workspace calendar</a>
    </p>
    <div id="event-list-upcoming"
         tal:condition="events/upcoming"
    >
      <a class="pat-inject infinite-scrolling-trigger"
         href="${here/absolute_url}/@@sidebar.content.events?event_category=upcoming"
         data-pat-inject="source: #event-list-upcoming; target: #event-list-upcoming; trigger: autoload-visible;"
         i18n:translate=""
      >Loading&hellip;</a>
    </div>

    <div id="older-events"
         tal:condition="events/older"
    >
      <h3 class="sidebar-separation-title"
          i18n:translate=""
      >Older events</h3>
      <ul class="event-list"
          id="event-list-older"
      >
        <a class="pat-inject infinite-scrolling-trigger"
           href="${here/absolute_url}/@@sidebar.content.events?event_category=older"
           data-pat-inject="source: #event-list-older; target: #event-list-older; trigger: autoload-visible;"
           i18n:translate=""
        >Loading&hellip;</a>
      </ul>
    </div>

    <p class="message notice"
       tal:condition="python: not (events['upcoming'] or events['older'])"
       i18n:translate="label_no_events_available"
    >
      No events available
    </p>
  </div>
</div>
