sophiazheng/CS169_Great_Course_Guide

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

Summary

Maintainability
Test Coverage
.container.animated.mainContent
  .row
    .col.s12.l3
      .card.white#filters
        .card-content#test
          %span.card-title Filters
          = hidden_field_tag :authenticity_token, form_authenticity_token
          %br
          .row
            .col.s6.l12
              .switch
                %label
                  - if @filter_settings["cs"] == "true"
                    %input#cs{type: "checkbox", checked: "true"}
                  - else
                    %input#cs{type: "checkbox"}
                  %span.lever
                  CS
              %br
            .col.s6.l12
              .switch
                %label
                  - if @filter_settings["ee"] == "true"
                    %input#ee{type: "checkbox", checked: "true"}
                  - else
                    %input#ee{type: "checkbox"}
                  %span.lever
                  EE
          %hr#filterDivider
          .row
            .col.s6.l12
              .switch
                %label
                  - if @filter_settings["lower"] == "true"
                    %input#lower{type: "checkbox", checked: "true"}
                  - else
                    %input#lower{type: "checkbox"}
                  %span.lever
                  Lower Divs
              %br
            .col.s6.l12
              .switch
                %label
                  - if @filter_settings["upper"] == "true"
                    %input#upper{type: "checkbox", checked: "true"}
                  - else
                    %input#upper{type: "checkbox"}
                  %span.lever
                  Upper Divs
              %br
            .col.s6.l12
              .switch
                %label
                  - if @filter_settings["grad"] == "true"
                    %input#grad{type: "checkbox", checked: "true"}
                  - else
                    %input#grad{type: "checkbox"}
                  %span.lever
                  Graduate
    .col.s12.l9#selections
      .card.white
        .card-content
          %span.card-title All Courses
          %table.centered
            %thead
              %tr
                %th{"data-field": "name"} Course
                %th{"data-field": "title"} Title
                %th{"data-field": "units"} Units
            %tbody
              - @all_courses.each do |course|
                %tr{class: @filter_map[course[:number]] + " course_row"}
                  %td= link_to course[:number], course_path(course[:id])
                  %td= course[:title]
                  %td
                    -if course[:units] == 0 or course[:units] == nil
                      = "TBA"
                    -elsif course[:units] == 1
                      = course[:units].to_s + " Unit"
                    -else
                      = course[:units].to_s + " Units"
        .card-action
          %a{href: "/user"} Back
= javascript_include_tag '/javascripts/filter.js'
= javascript_include_tag '/javascripts/saveFilter.js'