add folder navigation to docs sidenav

This commit is contained in:
Andrew Brown 2021-06-30 18:47:04 -07:00
parent 1ed249b16c
commit 8abeb228bb

View File

@ -43,10 +43,10 @@
<li>
<%= link_to folder, class: 'waves-effect' do %>
<i class="material-icons left <%= Folder.color %>-text"><%= Folder.icon %></i>
View <%= folder.title %>
<%= folder.title %>
<% end %>
</li>
<% Document.where(folder_id: folder.id).where.not(id: @document.id).each do |document| %>
<% Document.where(folder_id: folder.id).where.not(id: @document.id).order('updated_at DESC').each do |document| %>
<li>
<%= link_to edit_document_path(document), class: 'waves-effect tooltipped', data: { tooltip: "Last edited #{time_ago_in_words document.updated_at} ago", position: 'right' } do %>
<i class="material-icons <%= Document.color %>-text">
@ -61,6 +61,30 @@
</li>
<% end %>
<%
other_folders = current_user.folders.where(context: 'Document').where.not(id: @document.folder_id).order('title ASC')
if other_folders.any?
%>
<li class="bold waves-effect">
<a class="collapsible-header" tabindex="0">
Other folders
<i class="material-icons chevron">chevron_right</i>
</a>
<div class="collapsible-body" style="">
<ul>
<% other_folders.each do |folder| %>
<li>
<%= link_to folder, class: 'waves-effect' do %>
<i class="material-icons <%= Folder.color %>-text"><%= Folder.icon %></i>
<%= folder.title %>
<% end %>
</li>
<% end %>
</ul>
</div>
</li>
<% end %>
<li class="bold waves-effect active">
<a class="collapsible-header" tabindex="0">
Recent documents