<div class="cs-side-bar col-sm-4 hidden-xs cs-no-padding">

  <div class="panel panel-primary">

    <div class="panel-heading cs-center">
      <h4 class="cs-no-margin">
        <%= link_to 'Categories', categories_path %>
      </h4>
    </div>

    <div class="panel-body cs-no-padding">

      <div class="list-group">

        <% Category.all.each_with_index do |category, index| %>

          <% unless index.zero? %>

            <div class="list-group-separator cs-full-width cs-no-margin"></div>

          <% end %>

          <div class="list-group-item cs-no-padding">

            <div class="row-content cs-full-width cs-category-row">

              <%= link_to category.name, category_path(category), class: "btn btn-default cs-full-width cs-left-align cs-no-margin" %>

            </div>

          </div>

        <% end %>

      </div>

    </div>

    <div class="panel-footer cs-center cs-no-padding">
      <a href="https://github.com/djsegal/julia_observer" target="_blank" class="btn btn-default cs-side-bar-footer-link cs-full-width cs-no-margin">
        <%= fa_icon "github lg" %>
        &nbsp; fork us on github
      </a>
    </div>

  </div>

</div>

<div class="cs-side-bar col-sm-4 hidden-xs cs-no-padding">

  <div class="panel panel-primary">

    <div class="panel-heading cs-center">
      <h4 class="cs-no-margin">
        <%= link_to 'Categories', categories_path %>
      </h4>
    </div>

    <div class="panel-body cs-no-padding">

      <div class="list-group">

        <%
          query_params = {}
          query_params[:sort] = params[:sort] \
            if params[:sort].present?
        %>

        <% Category.all.each_with_index do |category, index| %>

          <% unless index.zero? %>

            <div class="list-group-separator cs-full-width cs-no-margin"></div>

          <% end %>

          <div class="list-group-item cs-no-padding">

            <div class="row-content cs-full-width cs-category-row">

              <%=
                link_to category.name,
                  category_path(category, query_params),
                  class: "btn btn-default cs-full-width cs-left-align cs-no-margin #{ 'active' if current_page?(category_path(category)) }"
              %>

            </div>

          </div>

        <% end %>

      </div>

    </div>

    <div class="panel-footer cs-center cs-no-padding">
      <a href="https://github.com/djsegal/julia_observer" target="_blank" class="btn btn-default cs-side-bar-footer-link cs-full-width cs-no-margin">
        <%= fa_icon "github lg" %>
        &nbsp; fork us on github
      </a>
    </div>

  </div>

</div>

Add sorting and active links to category sidebar
Add sorting and active links to category sidebar