<%= content_for :full_width_page_content do %>
  <div class="container-fluid">
    <div class="row">
      <h5>
        <% if @parent_folder %>
          <%= link_to @parent_folder do %>
            <i class="material-icons left tooltipped" data-tooltip="Go up a folder: to <%= @parent_folder.title %>">arrow_upward</i>
          <% end %>
        <% else %>
          <%# todo link to base `context`#index page %>
          <%= link_to documents_path do %>
            <i class="material-icons left tooltipped" data-tooltip="Go up a folder: back to Documents">arrow_upward</i>
          <% end %>
        <% end %>
        <%= link_to '#edit-folder-modal', class: 'modal-trigger tooltipped', data: { tooltip: "Click to edit this folder" } do %>
          <i class="material-icons large left <%= Folder.text_color %>"><%= Folder.icon %></i>
        <% end %>
        <%= @folder.title %>

        <% if @child_folders.empty? %>
          <div class="btn-group right" style="margin-top: 1.9em; margin-right: 0.2em">
            <%= link_to '#new-folder-modal', class: "btn right #{Folder.color} lighten-1 white-text modal-trigger" do %>
              <i class="material-icons left">create_new_folder</i>
              New folder
            <% end %>
          </div>
        <% end %>
      </h5>
    </div>

    <%= render partial: 'folders/list', locals: { folders: @child_folders } %>

    <div class="row">
      <h5>Documents <span class="grey-text"><%= @content.count %></span></h5>
      <%= render partial: 'content/components/list_filter_bar', locals: { content_type: Document } if @content.any? %>
      <%=
        render partial: 'content/list/document_table', locals: {
          content_list: @content,
          content_type: Document,
          folders:      @all_folders.pluck(:title, :id),
          tags:         @page_tags.to_a
        }
      %>
    </div>
  </div>
<% end %>

<%= render partial: 'folders/new_modal', locals: { content_type: Document, parent_folder: @folder } %>
<%= render partial: 'folders/edit_modal', locals: { folder: @folder } %>