You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.0 KiB
Plaintext

<% contentsArray = Array.new %>
<% folders.each do |folder| %>
<% if Dir.exists? folder %>
<% contents = Dir.children("./" + folder).grep(/#{searchquery}/) %>
<% if !contents.empty? %>
<% contents.each do |content| %>
<% begin %>
<% newPage = Page.new(folder + "/" + content) %>
<% rescue %>
<%# Do nothing LOLOL %>
<% puts "bad times at " + content %>
<% else %>
<% contentsArray.push(newPage) %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<% if contentsArray.empty? %>
<%= erb :throwError, locals: {errorcode: "404", error: "No result", errordescriptor: "No pages matching " + searchquery, returntarget: origin} %>
<% end %>
<% contentsArray.sort_by! { |page| page.get_date } %>
<% contentsArray.reverse.each do |content| %>
<div class="section section<%= rand(1..3) %>">
<%= content.render %>
<span class="seemore">
<b>
<span class="seedate"><%= content.get_date %></span>
</b>
<a class="seemorelink" href="/<%= content.get_path %>">Article Page</a>
</span>
</div>
<% end %>