From a599b332880918acafc85b6d42ed46253694c24b Mon Sep 17 00:00:00 2001 From: Bruno Ribeiro Date: Sun, 20 Oct 2019 10:49:48 -0400 Subject: [PATCH] ISSUE #1 :: added a friendlier 404 page --- app/controllers/home_controller.rb | 2 +- app/views/errors/not_found.slim | 11 +++++++++++ config/routes.rb | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 app/views/errors/not_found.slim diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 4131492..a0ff5ec 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -26,7 +26,7 @@ def url redirect_to @link.url end else - redirect_to "https://suncoast.io" + redirect_to '/not_found' end end end diff --git a/app/views/errors/not_found.slim b/app/views/errors/not_found.slim new file mode 100644 index 0000000..9c0942d --- /dev/null +++ b/app/views/errors/not_found.slim @@ -0,0 +1,11 @@ +section.section style="background-image: linear-gradient(rgba(133,87,126,.75),rgba(128,206,210,.75))" + div.has-text-centered style="font-size: 1.5rem" + p Sorry about that, but we can't find the page you were looking for. + p style="padding-top: 0.5rem" + 'Click on the Suncoast Developers Guild Icon to go back home. + a href="/" + = image_tag "icon.svg", size: '50x50' + div.has-text-centered style="padding-top: 1.5rem" + a href="https://suncoast.io" + = image_tag "banner.svg", size: '200x80' + p The Academy at Suncoast Developers Guild is an immersive code school. What that means is, in about three months (with the guidance and support of seasoned industry experts) you will gain the skills needed to become a junior developer. Over the course of the curriculum, you will learn the basics of web development and also how to be job-ready for the modern market. This immersive style of education is often called a "bootcamp" because of the fast pace of learning and the full-time commitment. \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 676a2d1..adb1450 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,6 +9,7 @@ get "sign_in", to: redirect("/auth/#{Rails.env.production? ? :google_oauth2 : :developer}") get "sign_out", to: "sessions#destroy" get "auth/failure", to: redirect("/") + get "not_found", to: "errors#not_found" match "auth/:provider/callback", to: "sessions#create", via: %i[get post] match "/:slug", to: "home#url", via: %i[get post], as: "short" root to: "home#index"