.cmd
  = action_icon('add', 'Cadastrar nova disciplina', new_course_url) if admin?

%h4.title= App.title
%h1.title= "Disciplinas #{@period}"

.box
  %ul
    - if logged_in?
      - if params[:period].nil?
        %h3 Disciplinas Matriculadas
        - if @current_user.courses.empty?
          %li.no_itens Nenhuma disciplina matriculada
        - for course in @current_user.courses
          %li{highlight(course.id)}
            .right
              = action_icon('subtract', 'Desmatricular-se', unenroll_course_url(course))
            = link_to h(course.full_name), course_url(course)

    -# cache(courses_path) do 
    - old_grade = 0
    - for course in @courses
      - if course.grade != old_grade
        %h3= (course.grade == 99 ? "Optativas" : "Semestre #{course.grade}")
        - old_grade = course.grade

      %li{highlight(course.id)}
        - if course.period == App.current_period
          .right
            = action_icon('add', 'Matricular-se', enroll_course_url(course))
        = link_to h(course.full_name), course_url(course)

    %h3
      Outros Semestres
    %li= link_to "2008.2", :period => '2008.2'
    %li= link_to "2008.1", :period => '2008.1'
