% if folder == "all" %>
<% doAllFolder = true %>
<% title = "Archive" %>
<% else %>
<% doAllFolder = false %>
<% title = "Archive - " + folder.capitalize %>
<% end %>
<%= title %>
<%= erb :headerBoilerplate %>
<%= erb :asidemenu %>
<%= erb :archiveTopBar, locals: {folder: folder} %>
<%= erb :searchbar, locals: {folder: folder} %>
<% if folder == "all" %>
<% foldersOfInterest = ["media", "technology", "news"] %>
<% foldersOfInterest.each do |multiFolder| %>
<% if Dir.exist?("./" + multiFolder) %>
<% if !Dir.children("./" + multiFolder).grep(/erb/).grep(/#{searchquery}/).empty? || !Dir.children("./" + multiFolder).grep(/md/).grep(/#{searchquery}/).empty? %>
<%= erb :archiveFolderIndex, locals: {folder: multiFolder, searchquery: searchquery} %>
<% end %>
<% end %>
<% end %>
<% elsif Dir.exist?("./" + folder) %>
<% if !Dir.children("./" + folder).grep(/erb/).grep(/#{searchquery}/).empty? || !Dir.children("./" + folder).grep(/md/).grep(/#{searchquery}/).empty? %>
<%= erb :archiveFolderIndex, locals: {folder: folder, searchquery: searchquery} %>
<% else %>
<%= erb :noFile %>
<% end %>
<% else %>
<%= erb :noFolder %>
<% end %>
<%# searchquery %>
<%= erb :bottom %>