<%= t('page.listing', model: t('activerecord.models.event')) -%>

<%= notice %>

<%- if @library -%>

<%= link_to @library.display_name.localize, @library -%>

<%- else -%>

<%= t('event.all_libraries') -%>

<%- end -%> <% if params[:mode] == 'calendar' %> <%= render 'calendar' %> <% else %> <%= form_for :events, url: events_path, html: {method: 'get'} do -%>

<%= label_tag :search_form_top, t('page.search_term') -%>: <%= search_field_tag 'query', h(@query), {id: 'search_form_top', class: 'search_form', placeholder: t('page.search_term')} -%> <%= submit_tag t('page.search') -%>

<%- end -%>

<%- case params[:mode] when 'upcoming' -%> <%= link_to t('event.all'), url_for(params.permit.merge(mode: nil, only_path: true)) -%> <%= t('event.upcoming') -%> <%= link_to t('event.past'), url_for(params.permit.merge(mode: 'past', only_path: true)) -%> <%- when 'past' -%> <%= link_to t('event.all'), url_for(params.permit.merge(mode: nil, only_path: true)) -%> <%= link_to t('event.upcoming'), url_for(params.permit.merge(mode: 'upcoming', only_path: true)) -%> <%= t('event.past') -%> <%- else -%> <%= t('event.all') -%> <%= link_to t('event.upcoming'), url_for(params.permit.merge(mode: 'upcoming', only_path: true)) -%> <%= link_to t('event.past'), url_for(params.permit.merge(mode: 'past', only_path: true)) -%> <%- end -%>

<%- @events.each_with_index do |event, i| -%> "> <%- end -%>
<%= t('activerecord.models.library') -%> <%= t('activerecord.attributes.event.name') -%>
<%= link_to event.library.display_name.localize, event.library -%>
<%= event.event_category.display_name.localize -%>
<%= link_to event.display_name.localize, event -%>
<%= l(event.start_at, format: :short) -%> - <%= l(event.end_at, format: :short) -%>
<%- if policy(event).update? -%> <%= link_to t('page.edit'), edit_event_path(event) -%> <% end %> <%- if policy(event).destroy? -%> <%= link_to t('page.destroy'), event, data: {confirm: t('page.are_you_sure')}, method: :delete -%> <%- end -%>
<%= paginate(@events) -%> <% end %>