<% current_committee = nil if local_assigns[:current_committee].nil? %>
<% current_page = nil if local_assigns[:current_page].nil? %>

<div class="sidebar box left">
  <section>
    <h2><%= t("about_section") %></h2>
    <% @pages.each do |page| %>
      <% if current_page == page %>
        <p><%= page.title %></p>
      <% else %>
        <%= link_to page.title, path_to_page(page) %>
      <% end %>
      <hr>
    <% end %>
  </section>

  <section>
    <h2><%= t("committees_assoiciations") %> </h2>
    <% @committees.each do |committee| %>
      <% if committee == current_committee %>
        <p><%= committee.name %></p>
      <% else %>
        <%= link_to committee.name, committee %>
      <% end %>
      <hr>
    <% end %>
  </section>
</div>

<% current_committee = nil if local_assigns[:current_committee].nil? %>
<% current_page = nil if local_assigns[:current_page].nil? %>

<div class="sidebar box left">
  <section>
    <h2><%= t("about_section") %></h2>
    <% @pages.where(parent_id: nil).each do |page| %>
      <% if current_page == parent_page %>
        <p><%= parent_page.title %></p>
      <% else %>
        <%= link_to parent_page.title, path_to_page(parent_page) %>
      <% end %>
      <% @pages.where(parent_id: parent_page.id).each do |child_page| %>
        <hr class="child">
        <% if current_page == child_page %>
          <p class="child"><%= child_page.title %></p>
        <% else %>
          <%= link_to child_page.title, path_to_page(child_page), class: "child"%>
        <% end %>
      <% end %>
      <hr>
    <% end %>
  </section>

  <section>
    <h2><%= t("committees_assoiciations") %> </h2>
    <% @committees.each do |committee| %>
      <% if committee == current_committee %>
        <p><%= committee.name %></p>
      <% else %>
        <%= link_to committee.name, committee %>
      <% end %>
      <hr>
    <% end %>
  </section>
</div>

Make the hierarchy of pages apprent in the sidebar
Make the hierarchy of pages apprent in the sidebar

Currently only supports two levels. Unsure if more levels are needed and how to do that in an elegant way.
