diff --git a/app/assets/images/404.gif b/app/assets/images/404.gif
new file mode 100644
index 0000000..6a2e7c8
Binary files /dev/null and b/app/assets/images/404.gif differ
diff --git a/app/controllers/error_pages_controller.rb b/app/controllers/error_pages_controller.rb
new file mode 100644
index 0000000..c9479c0
--- /dev/null
+++ b/app/controllers/error_pages_controller.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class ErrorPagesController < ApplicationController
+ def not_found; end
+ def unprocessable_content; end
+ def internal_server_error; end
+end
diff --git a/app/javascript/controllers/theme_switcher_controller.js b/app/javascript/controllers/theme_switcher_controller.js
index 1ea384d..d8a879b 100644
--- a/app/javascript/controllers/theme_switcher_controller.js
+++ b/app/javascript/controllers/theme_switcher_controller.js
@@ -6,18 +6,35 @@ export default class extends Controller {
COOKIE_NAME = "modeTheme"
connect() {
- console.log("connect switcher")
+ console.log("connect switcher", this.init())
+ }
+
+ init() {
+ const cookieValue = Cookie.get(this.COOKIE_NAME);
+ const newThemeValue = cookieValue == "dark" ? "dark" : "light";
+
+ Cookie.set("init modeTheme", newThemeValue);
+ window.document.getElementsByTagName("html")[0].setAttribute("data-bs-theme", newThemeValue);
+
+ const icon = this.element.getElementsByTagName("i")[0];
+ if (newThemeValue == "dark") {
+ icon.classList.remove("bi-sun-fill")
+ icon.classList.add("bi-moon-stars-fill")
+ } else {
+ icon.classList.add("bi-sun-fill")
+ icon.classList.remove("bi-moon-stars-fill")
+ }
}
switch() {
const cookieValue = Cookie.get(this.COOKIE_NAME);
const newThemeValue = cookieValue == "dark" ? "light" : "dark";
-
+
Cookie.set("modeTheme", newThemeValue);
window.document.getElementsByTagName("html")[0].setAttribute("data-bs-theme", newThemeValue);
const icon = this.element.getElementsByTagName("i")[0];
- if(newThemeValue == "dark") {
+ if (newThemeValue == "dark") {
icon.classList.remove("bi-sun-fill")
icon.classList.add("bi-moon-stars-fill")
} else {
diff --git a/app/views/error_pages/internal_server_error.html.slim b/app/views/error_pages/internal_server_error.html.slim
new file mode 100644
index 0000000..669ffb3
--- /dev/null
+++ b/app/views/error_pages/internal_server_error.html.slim
@@ -0,0 +1,5 @@
+h1 Es ist ein Fehler aufgetreten
+
+p Das kann leider vorkommen. Bitte versuche es nocheinmal und falls der Fehler weiter auftritt, hoffe dass er bald repariert wird, sorry
+
+p == '¯\_(ツ)_/¯'
\ No newline at end of file
diff --git a/app/views/error_pages/not_found.html.slim b/app/views/error_pages/not_found.html.slim
new file mode 100644
index 0000000..713c6d2
--- /dev/null
+++ b/app/views/error_pages/not_found.html.slim
@@ -0,0 +1,6 @@
+h1 Error 404
+
+p Diese Seite existiert nicht (mehr), sorry.
+
+p
+ img src="data:image/gif;base64,#{Base64.strict_encode64(Rails.application.assets['404.gif'].to_s)}"
\ No newline at end of file
diff --git a/app/views/error_pages/unprocessable_content.html.slim b/app/views/error_pages/unprocessable_content.html.slim
new file mode 100644
index 0000000..46ff905
--- /dev/null
+++ b/app/views/error_pages/unprocessable_content.html.slim
@@ -0,0 +1,3 @@
+h1 Es ist ein Fehler aufgetreten
+
+p Ich konnte deine Anfrage nicht verstehen.
\ No newline at end of file
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
deleted file mode 100644
index b677b2e..0000000
--- a/app/views/layouts/application.html.erb
+++ /dev/null
@@ -1,38 +0,0 @@
-
-" data-controller="set-theme">
-
- a11ydive
-
-
- <%= csrf_meta_tags %>
- <%= csp_meta_tag %>
-
- <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
- <%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
-
-
-
- <%= render partial: "layouts/navigation" %>
-
-
- <%= render partial: "layouts/sidebar" %>
-
">
-
- <%# render partial: "layouts/flash" %>
- <% if false && sidebar? %>
-
-
- Menu
-
- <% end %>
-
-
- <%= yield %>
-
-
-
-
-
-