-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80b81b1
commit bb93f2f
Showing
10 changed files
with
191 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Web.Controller.Prelude | ||
( module Web.Types | ||
, module Application.Helper.Controller | ||
, module IHP.ControllerPrelude | ||
, module Generated.Types | ||
) | ||
where | ||
|
||
import Web.Types | ||
import Application.Helper.Controller | ||
import IHP.ControllerPrelude | ||
import Generated.Types | ||
import Web.Routes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Web.Controller.Static where | ||
import Web.Controller.Prelude | ||
import Web.View.Static.Welcome | ||
|
||
instance Controller StaticController where | ||
action WelcomeAction = render WelcomeView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module Web.FrontController where | ||
|
||
import IHP.RouterPrelude | ||
import Web.Controller.Prelude | ||
import Web.View.Layout (defaultLayout) | ||
|
||
-- Controller Imports | ||
import Web.Controller.Static | ||
|
||
instance FrontController WebApplication where | ||
controllers = | ||
[ startPage WelcomeAction | ||
-- Generator Marker | ||
] | ||
|
||
instance InitControllerContext WebApplication where | ||
initContext = do | ||
setLayout defaultLayout | ||
initAutoRefresh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Web.Routes where | ||
import IHP.RouterPrelude | ||
import Generated.Types | ||
import Web.Types | ||
|
||
-- Generator Marker | ||
instance AutoRoute StaticController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Web.Types where | ||
|
||
import IHP.Prelude | ||
import IHP.ModelSupport | ||
import Generated.Types | ||
|
||
data WebApplication = WebApplication deriving (Eq, Show) | ||
|
||
|
||
data StaticController = WelcomeAction deriving (Eq, Show, Data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
module Web.View.Layout (defaultLayout, Html) where | ||
|
||
import IHP.ViewPrelude | ||
import IHP.Environment | ||
import Generated.Types | ||
import IHP.Controller.RequestContext | ||
import Web.Types | ||
import Web.Routes | ||
import Application.Helper.View | ||
|
||
defaultLayout :: Html -> Html | ||
defaultLayout inner = [hsx| | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
{metaTags} | ||
|
||
{stylesheets} | ||
{scripts} | ||
|
||
<title>{pageTitleOrDefault "App"}</title> | ||
</head> | ||
<body> | ||
<div class="container mt-4"> | ||
{renderFlashMessages} | ||
{inner} | ||
</div> | ||
</body> | ||
</html> | ||
|] | ||
|
||
-- The 'assetPath' function used below appends a `?v=SOME_VERSION` to the static assets in production | ||
-- This is useful to avoid users having old CSS and JS files in their browser cache once a new version is deployed | ||
-- See https://ihp.digitallyinduced.com/Guide/assets.html for more details | ||
|
||
stylesheets :: Html | ||
stylesheets = [hsx| | ||
<link rel="stylesheet" href={assetPath "/vendor/bootstrap-5.2.1/bootstrap.min.css"}/> | ||
<link rel="stylesheet" href={assetPath "/vendor/flatpickr.min.css"}/> | ||
<link rel="stylesheet" href={assetPath "/app.css"}/> | ||
|] | ||
|
||
scripts :: Html | ||
scripts = [hsx| | ||
{when isDevelopment devScripts} | ||
<script src={assetPath "/vendor/jquery-3.6.0.slim.min.js"}></script> | ||
<script src={assetPath "/vendor/timeago.js"}></script> | ||
<script src={assetPath "/vendor/popper-2.11.6.min.js"}></script> | ||
<script src={assetPath "/vendor/bootstrap-5.2.1/bootstrap.min.js"}></script> | ||
<script src={assetPath "/vendor/flatpickr.js"}></script> | ||
<script src={assetPath "/vendor/morphdom-umd.min.js"}></script> | ||
<script src={assetPath "/vendor/turbolinks.js"}></script> | ||
<script src={assetPath "/vendor/turbolinksInstantClick.js"}></script> | ||
<script src={assetPath "/vendor/turbolinksMorphdom.js"}></script> | ||
<script src={assetPath "/helpers.js"}></script> | ||
<script src={assetPath "/ihp-auto-refresh.js"}></script> | ||
<script src={assetPath "/app.js"}></script> | ||
|] | ||
|
||
devScripts :: Html | ||
devScripts = [hsx| | ||
<script id="livereload-script" src={assetPath "/livereload.js"} data-ws={liveReloadWebsocketUrl}></script> | ||
|] | ||
|
||
metaTags :: Html | ||
metaTags = [hsx| | ||
<meta charset="utf-8"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/> | ||
<meta property="og:title" content="App"/> | ||
<meta property="og:type" content="website"/> | ||
<meta property="og:url" content="TODO"/> | ||
<meta property="og:description" content="TODO"/> | ||
{autoRefreshMeta} | ||
|] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Web.View.Prelude | ||
( module IHP.ViewPrelude | ||
, module Web.View.Layout | ||
, module Generated.Types | ||
, module Web.Types | ||
, module Application.Helper.View | ||
) where | ||
|
||
import IHP.ViewPrelude | ||
import Web.View.Layout | ||
import Generated.Types | ||
import Web.Types | ||
import Web.Routes () | ||
import Application.Helper.View |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module Web.View.Static.Welcome where | ||
import Web.View.Prelude | ||
|
||
data WelcomeView = WelcomeView | ||
|
||
instance View WelcomeView where | ||
html WelcomeView = [hsx| | ||
<div style="background-color: #657b83; padding: 2rem; color:hsla(196, 13%, 96%, 1); border-radius: 4px"> | ||
<div style="max-width: 800px; margin-left: auto; margin-right: auto"> | ||
<h1 style="margin-bottom: 2rem; font-size: 2rem; font-weight: 300; border-bottom: 1px solid white; padding-bottom: 0.25rem; border-color: hsla(196, 13%, 60%, 1)"> | ||
IHP | ||
</h1> | ||
|
||
<h2 style="margin-top: 0; margin-bottom: 0rem; font-weight: 900; font-size: 3rem"> | ||
It's working! Hello World! | ||
</h2> | ||
|
||
<p style="margin-top: 1rem; font-size: 1.75rem; font-weight: 600; color:hsla(196, 13%, 80%, 1)"> | ||
Your new application is up and running. | ||
</p> | ||
|
||
<p> | ||
<a | ||
href="https://ihp.digitallyinduced.com/Slack" | ||
style="margin-top: 2rem; background-color: #268bd2; padding: 1rem; border-radius: 3px; color: hsla(205, 69%, 98%, 1); text-decoration: none; font-weight: bold; display: inline-block; box-shadow: 0 4px 6px hsla(205, 69%, 0%, 0.08); transition: box-shadow 0.2s; transition: transform 0.2s;" | ||
target="_blank" | ||
>Join our community on Slack!</a> | ||
</p> | ||
|
||
<a href="https://ihp.digitallyinduced.com/Guide/your-first-project.html" style="margin-top: 2rem; background-color: #268bd2; padding: 1rem; border-radius: 3px; color: hsla(205, 69%, 98%, 1); text-decoration: none; font-weight: bold; display: inline-block; box-shadow: 0 4px 6px hsla(205, 69%, 0%, 0.08); transition: box-shadow 0.2s; transition: transform 0.2s;" target="_blank"> | ||
Learn the Next Steps in the Documentation | ||
</a> | ||
</div> | ||
</div> | ||
|
||
<div style="max-width: 800px; margin-left: auto; margin-right: auto; margin-top: 4rem"> | ||
<img src="/ihp-welcome-icon.svg" alt="/ihp-welcome-icon" style="width:100%;"> | ||
<p style="color: hsla(196, 13%, 50%, 1); margin-top: 4rem"> | ||
You can modify this start page by making changes to "./Web/View/Static/Welcome.hs". | ||
</p> | ||
</div> | ||
|] |
Submodule blog
added at
cb2a54