sophiazheng/CS169_Great_Course_Guide

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

Summary

Maintainability
Test Coverage
.container.animated.mainContent
  .row-toggle
    .col.s12
      .card.white
        .text #{@ignore}
        - if @ignore_flag
          %a{:href => "/courses/schedule", :id => "dont ignore"} 
            Don't Ignore Prerequisites
        - else
          %a{:href => "/courses/schedule?ignore=true", :id => "ignore"}
            Ignore Prerequisites 
  .row
    .col.l6.m12
      .card.white.medium
        .card-content.scrollable
          %span.card-title Recommended Fall 2016 Courses
          - if @fall_length == 0
            %br
            It seems you cannot take any classes offered next semester.
            Please go see your advisor.
          %table.centered.highlight
            %thead
              %tr
                %th{"data-field": "name"} Course
                %th{"data-field": "professor"} Professor(s)
                %th{"data-field": "average rating"} Rating
                %th{"data-field": "add to selection"} Taking
          %br
          .chip Courses You're Interested In
          %table.centered.highlight
            %tbody
              - @recommended_EECS_courses[:possible_fall].each do |course|
                %tr
                  %td= link_to(course[0].number, course_path(course[0].id), { class: "tooltipped", data: { position: "right", tooltip: course[0].title}})
                  %td
                    - course[1].each do |professor|
                      - if professor.nil?
                        = "TBA"
                      - elsif professor.name == "TBA"
                        = "TBA"
                      - elsif course[1].index(professor) + 1 == course[1].length
                        = link_to(professor.name, professor_path(professor.id))
                      - else
                        = link_to(professor.name, professor_path(professor.id)) + ", "
                  %td 
                    - course[2].each do |rating|
                      - if course[2].index(rating) + 1 == course[2].length # I'm so sorry
                        = rating.to_s
                      - else
                        = rating.to_s + ", "
                  %td.vertical-align
                    %input{type: "checkbox", class: "filled-in takenBox", id: "add-#{course[0].number}", name: "taking_classes[#{course[0].number}: #{course[0].title}]"}
                    %label{for: "add-#{course[0].number}"}
          %br
          .chip.center-div The Best Alternative Courses
          %table.centered.highlight
            %thead.hide
              %tr
                %th{"data-field": "name"} Course
                %th{"data-field": "professor"} Professor(s)
                %th{"data-field": "average rating"} Rating
                %th{"data-field": "add to selection"} Taking
            %tbody
              - @recommended_EECS_courses[:backup_fall].each do |course|
                %tr
                  %td= link_to(course[0].number, course_path(course[0].id), { class: "tooltipped", data: { position: "right", tooltip: course[0].title}})
                  %td
                    - course[1].each do |professor|
                      - if professor.nil?
                        = "TBA"
                      - elsif professor.name == "TBA"
                        = "TBA"
                      - elsif course[1].index(professor) + 1 == course[1].length
                        = link_to(professor.name, professor_path(professor.id))
                      - else
                        = link_to(professor.name, professor_path(professor.id)) + ", "
                  %td 
                    - course[2].each do |rating|
                      - if course[2].index(rating) + 1 == course[2].length
                        = rating.to_s
                      - else
                        = rating.to_s + ", "
                  %td.vertical-align
                    %input{type: "checkbox", class: "filled-in takenBox", id: "add-#{course[0].number}", name: "taking_classes[#{course[0].number}: #{course[0].title}]"}
                    %label{for: "add-#{course[0].number}"}
                
        .center-align.card-action-small.card-action
          %i.material-icons.small.animated-slow.tada.infinite arrow_drop_down
    .col.l6.m12
      .card.white.medium
        .card-content.scrollable
          %span.card-title Recommended Spring 2017 Courses
          - if @spring_length == 0
            %br
            It seems you cannot take any classes offered next spring.
            Please go see your advisor.
          %table.centered.highlight
            %thead
              %tr
                %th{"data-field": "name"} Course
                %th{"data-field": "professor"} Professor(s)
                %th{"data-field": "average rating"} Rating
          %br
          .chip Courses You're Interested In
          %table.centered.highlight
            %tbody
              - @recommended_EECS_courses[:possible_spring].each do |course|
                %tr{"id": "#{course[0].number}-sp17-row"}
                  %td= link_to(course[0].number, course_path(course[0].id), { class: "tooltipped", data: { position: "right", tooltip: course[0].title}})
                  %td
                    - course[1].each do |professor|
                      - if professor.name == "TBA"
                        = "TBA"
                      - elsif course[1].index(professor) + 1 == course[1].length
                        = link_to(professor.name, professor_path(professor.id))
                      - else
                        = link_to(professor.name, professor_path(professor.id)) + ", "
                  %td 
                    - course[2].each do |rating|
                      - if course[2].index(rating) + 1 == course[2].length
                        = rating.to_s
                      - else
                        = rating.to_s + ", "
          %br
          .chip.center-div The Best Alternative Courses
          %table.centered.highlight
            %thead.hide
              %tr
                %th{"data-field": "name"} Course
                %th{"data-field": "professor"} Professor(s)
                %th{"data-field": "average rating"} Rating
            %tbody
              - @recommended_EECS_courses[:backup_spring].each do |course|
                %tr{"id": "#{course[0].number}-sp17-row"}
                  %td= link_to(course[0].number, course_path(course[0].id), { class: "tooltipped", data: { position: "right", tooltip: course[0].title}})
                  %td
                    - course[1].each do |professor|
                      - if professor.name == "TBA"
                        = "TBA"
                      - elsif course[1].index(professor) + 1 == course[1].length
                        = link_to(professor.name, professor_path(professor.id))
                      - else
                        = link_to(professor.name, professor_path(professor.id)) + ", "
                  %td 
                    - course[2].each do |rating|
                      - if course[2].index(rating) + 1 == course[2].length # I'm so sorry
                        = rating.to_s
                      - else
                        = rating.to_s + ", "
        .center-align.card-action-small.card-action
          %i.material-icons.small.animated-slow.tada.infinite arrow_drop_down

  .row
    .col.s12
      .card.white.medium
        .card-content.scrollable
          %span.card-title Recommended Fall 2016 Non-EECS Courses Taught by Distinguished Professors
          %br
          %span.card-subtitle
            .text{:style => 'display: inline-block'} Distiguished Teaching Award:
            %i.material-icons.center.amber-text{:style => 'display: inline-block; vertical-align: middle'} star
            %br
            .text{:style => 'display: inline-block'} Other Awards:
            %i.material-icons.center.blue-text{:style => 'display: inline-block; vertical-align: middle'} star
          - if @spring_length == 0
            %br
            No classes taught by a distinguished humanities professor the next semester.
            Please see your advisor for more details.
          %table.centered.highlight
            %thead
              %tr
                %th{"data-field": "name"} Course
                %th{"data-field": "title"} Title
                %th{"data-field": "professor"} Professor
                %th{"data-field": "awards_tier"} Awards Tier
            %tbody
              - @recommended_breadth_courses.each do |course|
                %tr
                  %td= course[0]
                  %td= course[1]
                  %td= course[2]
                  - if course[3] == "High"
                    %td{:class => "tier_star", :id => "gold_star"}
                      %i.material-icons.center.amber-text star
                  - else
                    %td{:class => "tier_star", :id => "blue_star"}
                      %i.material-icons.center.blue-text star
= javascript_include_tag '/javascripts/schedule.js'