- provide :title, t('controllers.courses.index.title')

.row
  .col-xs-12.col-sm-6
    %h1= t('controllers.courses.index.title')
  .col-xs-12.col-sm-6
    .pull-right
      .btn-group.toolbar
        = link_to fa_icon('times'), root_path(params.except(:by_category)), class: 'btn btn-default'

        - CourseCategory.all.each do |category|
          - classes = 'btn ' + ((params[:by_category].to_i == category.id) ? 'btn-primary' : 'btn-default')
          = link_to category.name, root_path(params.merge(by_category: category.id)), class: classes

- if @courses.empty?
  .strong
    %p= t('controllers.courses.index.empty')
- else
  - @courses.each_slice(3) do |slice|
    .row
      - slice.each do |course|
        - course = course.decorate

        .col-xs-12.col-sm-6.col-md-4
          .strong
            %h3= link_to course.name, course
            = course.short_description_html

.text-center
  = will_paginate @courses, renderer: BootstrapPagination::Rails

- provide :title, t('controllers.courses.index.title')

.row
  .col-xs-12.col-sm-6
    %h1= t('controllers.courses.index.title')

  - if CourseCategory.any?
    .col-xs-12.col-sm-6
      .pull-right
        .btn-group.toolbar
          = link_to fa_icon('times'), root_path(params.except(:by_category)), class: 'btn btn-default'

          - CourseCategory.all.each do |category|
            - classes = 'btn ' + ((params[:by_category].to_i == category.id) ? 'btn-primary' : 'btn-default')
            = link_to category.name, root_path(params.merge(by_category: category.id)), class: classes

- if @courses.empty?
  .strong
    %p= t('controllers.courses.index.empty')
- else
  - @courses.each_slice(3) do |slice|
    .row
      - slice.each do |course|
        - course = course.decorate

        .col-xs-12.col-sm-6.col-md-4
          .strong
            %h3= link_to course.name, course
            = course.short_description_html

.text-center
  = will_paginate @courses, renderer: BootstrapPagination::Rails

Hide course category filter if there are no categories
Hide course category filter if there are no categories
