%h1 Listing courses

%table
  %tr
    %th Title
    %th Description
    %th User
    %th Language
    %th Prerequisites
    %th Starts in
    %th Duration
    %th
    %th
    %th

  - @courses.each do |course|
    %tr
      %td= course.title
      %td= course.description
      %td= course.user.handle
      %td= course.language
      %td= course.prerequisites
      %td= distance_of_time_in_words(Time.now, course.starts_at)
      %td= course.duration.to_s + " h"
      %td= link_to 'Show', course, class: "button"
      %td= link_to 'Edit', edit_course_path(course), class: "button"
      %td= link_to 'Destroy', course, :method => :delete, :data => { :confirm => 'Are you sure?' }, class: "button"

%br

= link_to 'New Course', new_course_path, class: "button"
