Skip to content
Permalink
Browse files

Add custom 404 error page

Implement a custom 404 error page.
Fix a small bug in the DataSetUtils class.
  • Loading branch information...
ggarciajr committed Apr 25, 2016
1 parent d175e8d commit 6e84a439b8a44fe3f0a7efb96172014859b330f2
Showing with 20,179 additions and 9 deletions.
  1. +10 −3 Foundation.hs
  2. +1 −1 Handler/Free.hs
  3. +2 −2 js/utils/dataset.js
  4. +4 −0 messages/en.msg
  5. +4 −0 messages/pt-BR.msg
  6. +32 −0 scss/app.scss
  7. +1 −0 scss/main.scss
  8. +23 −0 static/css/style.css
  9. +20,034 −0 static/js/Index.js
  10. +41 −2 static/js/bundle.js
  11. +27 −0 templates/404.hamlet
  12. +0 −1 test/Handler/HomeSpec.hs
@@ -10,6 +10,9 @@ import Yesod.Default.Util (addStaticContentExternal)
import Yesod.Core.Types (Logger)
import qualified Yesod.Core.Unsafe as Unsafe

-- Add I18N support
mkMessage "App" "messages" "en"

-- | The foundation datatype for your application. This can be a good place to
-- keep settings and values requiring initialization before your application
-- starts running, such as database connections. Every handler will have
@@ -46,6 +49,13 @@ type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget)
instance Yesod App where
-- Controls the base of generated URLs. For more information on modifying,
-- see: https://github.com/yesodweb/yesod/wiki/Overriding-approot
errorHandler NotFound = fmap toTypedContent $ do
master <- getYesod
defaultLayout $ do
setTitleI MsgTitle
$(widgetFile "404")
errorHandler other = defaultErrorHandler other

approot = ApprootMaster $ appRoot . appSettings

-- Store session data on the client in encrypted cookies,
@@ -168,6 +178,3 @@ unsafeHandler = Unsafe.fakeHandlerGetLogger appLogger
-- https://github.com/yesodweb/yesod/wiki/Sending-email
-- https://github.com/yesodweb/yesod/wiki/Serve-static-files-from-a-separate-domain
-- https://github.com/yesodweb/yesod/wiki/i18n-messages-in-the-scaffolding

-- Add I18N support
mkMessage "App" "messages" "en"
@@ -6,7 +6,7 @@ import Import

getFreeR :: Handler Html
getFreeR = do
master <- getYesod
--master <- getYesod

defaultLayout $ do
setTitleI MsgTitle
@@ -1,5 +1,5 @@
/* Class to transform data-* attributes from HTML tags */
/* and transform them into an appropriate format to be fed */
/* and transform them into an appropriate format to feed */
/* React components. */
class DataSetUtils {
/* dataset attributes become camel case strings - i.e: */
@@ -29,7 +29,7 @@ class DataSetUtils {
/* ds = { bar: "a", baz: "b" } */
static dataSetReducer(dataset, prefix) {
return (acc, k) => {
const key = normalizeKey(prefix, k);
const key = this.normalizeKey(prefix, k);
acc[key] = dataset[k];
return acc;
}
@@ -40,3 +40,7 @@ MoreInfoDonationsButton20: Donate 20.00
MoreInfoDonationsButton30: Donate 30.00
MoreInfoDonationsButton40: Donate 40.00
MoreInfoDonationsButton50: Donate 50.00

404Title: Page Not Found
404SubTitle: There is nothing to see here.
404Message: Please use the navigation bar above to find what you're looking for.
@@ -40,3 +40,7 @@ MoreInfoDonationsButton20: Doe 20.00
MoreInfoDonationsButton30: Doe 30.00
MoreInfoDonationsButton40: Doe 40.00
MoreInfoDonationsButton50: Doe 50.00

404Title: Página Não Encontrada
404SubTitle: Não há nada para ser visto aqui.
404Message: Por favor use o menu acima para encontrar o que você está procurando.
@@ -0,0 +1,32 @@
//
// -- APP STYLES --
// General styles that are applied to everything but the landing page.
//
.app-container {
left: 0;
position: relative;
top: 100px;
// The following styles are required for the "scroll-over" effect
width: 100%;
z-index: 1;
}

.footer-fixed {
background: #000;
bottom: 0;
position: fixed;
width: 100%;
}

.error-box {
margin: 40px;

h2 {
font-size: 3em;
}

h3,
p { margin: 0; }

i { color: red; }
}
@@ -3,6 +3,7 @@
@import 'buttons';
@import 'menu';
@import 'landing';
@import 'app';

/* This is the class used for the footer */
.footer {
@@ -2104,6 +2104,29 @@ label {
.splash-head {
font-size: 300%; } }

.app-container {
left: 0;
position: relative;
top: 100px;
width: 100%;
z-index: 1; }

.footer-fixed {
background: #000;
bottom: 0;
position: fixed;
width: 100%; }

.error-box {
margin: 40px; }
.error-box h2 {
font-size: 3em; }
.error-box h3,
.error-box p {
margin: 0; }
.error-box i {
color: red; }

/* This is the class used for the footer */
.footer {
background: #111; }
Oops, something went wrong.

0 comments on commit 6e84a43

Please sign in to comment.
You can’t perform that action at this time.