sophiazheng/CS169_Great_Course_Guide

View on GitHub
app/views/courses/show.html.haml

Summary

Maintainability
Test Coverage
.container.animated.mainContent
  .row
    .col.s12
      .card.white
        .card-content
          %span.card-title
            - if @course.units == 0 or @course.units == nil
              ="#{@course.number}: #{@course.title} (Units info TBA"
            - if @course.units == 1
              ="#{@course.number}: #{@course.title} (" + @course.units.to_s + " Unit)"
            - else
              ="#{@course.number}: #{@course.title} (" + @course.units.to_s + " Units)"
          %br
          .chip Required Prerequisites
          %table.centered
            %thead
              %tr
                %th{"data-field": "name"} Course
                %th{"data-field": "title"} Title
                %th{"data-field": "taken"} Taken
            %tbody
              - @remaining_prereqs.each do |prereq|
                %tr
                  %td= link_to prereq[:number], course_path(prereq[:id])
                  %td= prereq[:title]
                  %td No
              - @finished_prereqs.each do |prereq|
                %tr
                  %td= link_to prereq[:number], course_path(prereq[:id])
                  %td= prereq[:title]
                  %td Yes
        .card-action
          %a{href: "/user"} Home
  .row
    .col.s12
      .card.white
        .card-content
          %span.card-title="Professors Who Have Taught #{@course.number}"
          %table.centered
            %thead
              %tr
                %th{"data-field": "name"} Professor
                %th{"data-field": "title"} Average Rating (Out of 7)
            %tbody
              - @professors.each do |professor|
                %tr
                  %td= link_to professor.name, professor_path(professor.id)
                  %td= professor.rating
        .card-action
          %a{href: "/user"} Home