  <div class="ui relax divided selection list">

    <% lectures.each do |lecture| %>

    <div class="item">
      <div class="ui horizontal label"><%= l lecture.start_date, format: :short %></div>
      <%= lecture.title -%>

      <div class="ui right floated tiny buttons">
        <%- if can? :read, lecture -%>
          <%= link_to 'Zobacz', lecture, class: "ui teal button" %>
        <%- end -%>

        <%- if can? :edit, lecture -%>
          <%= link_to 'Edytuj', edit_lecture_path(lecture), class: "ui positive button" %>
        <%- end -%>

        <%- if can? :destroy, lecture -%>
          <%= link_to 'Usuń', lecture, class: "ui negative button", method: :delete, data: {confirm: "You sure?"} %>
        <%- end -%>
      </div>

    </div>

    <% end %>

  </div>
  <div class="ui relax divided selection list">

    <% lectures.sort_by{ |e| e[:start_date] }.each do |lecture| %>

    <div class="item">
      <div class="ui horizontal label"><%= l lecture.start_date, format: :short %></div>
      <%= lecture.title -%>

      <div class="ui right floated tiny buttons">
        <%- if can? :read, lecture -%>
          <%= link_to 'Zobacz', lecture, class: "ui teal button" %>
        <%- end -%>

        <%- if can? :edit, lecture -%>
          <%= link_to 'Edytuj', edit_lecture_path(lecture), class: "ui positive button" %>
        <%- end -%>

        <%- if can? :destroy, lecture -%>
          <%= link_to 'Usuń', lecture, class: "ui negative button", method: :delete, data: {confirm: "You sure?"} %>
        <%- end -%>
      </div>

    </div>

    <% end %>

  </div>
Sort related events by start date
Sort related events by start date
