Add in throwerror

main
Astoria 2 years ago
parent 483c8c32e9
commit cb7c531373

@ -4,7 +4,7 @@ require 'erb'
require 'date'
class Page
String @path
@path
@date
def initialize(path, date)
@path = path

@ -1,9 +0,0 @@
<div class="section section<%= rand(1..3) %>">
<%= ERB.new(File.read(file)).result(binding) %>
<span class="seemore">
<b>
<span class="seedate"><%= date %></span>
</b>
<a class="seemorelink" href="/<%= file %>">Article Page</a>
</span>
</div>

@ -1,5 +1,9 @@
<div class="section section<%= rand(1..3) %>">
<%= markdown(File.read(file)) %>
<% if file.end_with?(".md") %>
<%= markdown(File.read(file)) %>
<% elsif file.end_with?(".erb") %>
<%= ERB.new(File.read(file)).result(binding) %>
<% end %>
<span class="seemore">
<span class="seemore">
<b>

@ -15,10 +15,10 @@
<%= erb :topbar %>
<% folder = request.path_info[1..-1] %>
<% if !Dir.exists?(folder) %>
<%= erb :noFolder, locals: {folder: folder} %>
<%= erb :throwError, locals: {errorcode: "404", error: "Folder not found", errordescriptor: "No folder called " + folder.capitalize, returntarget: "home"} %>
<% else %>
<% if Dir.children("./" + folder).empty? %>
<%= erb :noFile, locals: {file: folder } %>
<%= erb :throwError, locals: {errorcode: "404", error: "File not found", errordescriptor: "No files in " + folder.capitalize, returntarget: "home"} %>
<% else %>
<%= erb :index, locals: {folders: [folder], searchquery: ""} %>
<%= erb :search, locals: {folder: folder} %>

@ -17,12 +17,16 @@
<% 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.getdate } %>
<% contentsArray.reverse.each do |content| %>
<% if content.getpath.end_with?(".erb") %>
<%= erb :blogpageERB, locals: {file: "./" + content.getpath, date: content.getdate.strftime("%Y.%m.%d")} %>
<%= erb :blogwindow, locals: {file: "./" + content.getpath, date: content.getdate.strftime("%Y.%m.%d")} %>
<% elsif content.getpath.end_with?(".md") %>
<%= erb :blogpageMD, locals: {file: "./" + content.getpath, date: content.getdate.strftime("%Y.%m.%d")} %>
<%= erb :blogwindow, locals: {file: "./" + content.getpath, date: content.getdate.strftime("%Y.%m.%d")} %>
<% end %>
<% end %>

@ -21,15 +21,15 @@
<%= erb :searchTopBar, locals: {folder: folder} %>
<%= erb :searchbar, locals: {folder: folder} %>
<% if folder == "all" %>
<%= erb :index, locals: {folders: ["media", "technology", "news"], searchquery: searchquery} %>
<%= erb :index, locals: {folders: ["all", "media", "technology", "news"], searchquery: searchquery, origin: "search/" + "all"} %>
<% else %>
<% if !Dir.exists?(folder) %>
<%= erb :noFolder, locals: {folder: folder} %>
<%= erb :throwError, locals: {errorcode: "404", error: "Folder not found", errordescriptor: "No folder called " + folder.capitalize, returntarget: "search"} %>
<% else %>
<% if Dir.children("./" + folder).empty? %>
<%= erb :noFile, locals: {file: folder } %>
<%= erb :throwError, locals: {errorcode: "404", error: "File not found", errordescriptor: "No files in " + folder.capitalize, returntarget: "search"} %>
<% else %>
<%= erb :index, locals: {folders: [folder], searchquery: searchquery} %>
<%= erb :index, locals: {folders: [folder], searchquery: searchquery, origin: "search/" + folder} %>
<% end %>
<% end %>
<% end %>

@ -0,0 +1,8 @@
<div class="article center largefont">
<a href="/<%= returntarget %>">
<%= errorcode %> - <%= error %>. Press left mouse button to continue.
<br>
<br>
Guru Meditation: <%= errordescriptor %>
</a>
</div>
Loading…
Cancel
Save