Move static information to HTML template

This commit is contained in:
Valentin Brandl 2019-08-09 17:54:24 +02:00
parent 8b1184c439
commit 9cab2942bf
No known key found for this signature in database
GPG Key ID: 30D341DD34118D7D
3 changed files with 44 additions and 97 deletions

View File

@ -1,14 +1,4 @@
module Data exposing (Provider(..), Url, hostname, pathSeparator, repository, servicename, toUrl)
repository : String
repository =
"https://git.vbrandl.net/vbrandl/gitache"
servicename : String
servicename =
"GitCDN"
module Data exposing (Provider(..), Url, hostname, pathSeparator, toUrl)
hostname : String

View File

@ -8,24 +8,9 @@ module Main exposing
)
import Browser
import Data exposing (Url, hostname, repository, servicename, toUrl)
import Html
exposing
( Html
, a
, article
, h1
, h2
, input
, li
, nav
, p
, section
, small
, text
, ul
)
import Html.Attributes exposing (href, placeholder, readonly, style, value)
import Data exposing (Url, hostname, toUrl)
import Html exposing (Html, div, input)
import Html.Attributes exposing (placeholder, readonly, style, value)
import Html.Events exposing (onInput)
import Parse exposing (parseUrl)
@ -73,78 +58,11 @@ myStyle2 =
view : Model -> Html Msg
view state =
section myStyle
[ header
, body state
, footer
]
header : Html msg
header =
Html.header []
[ h1 myStyle [ text servicename ]
]
footer : Html msg
footer =
Html.footer myStyle
[ nav []
[ ul []
[ li []
[ small []
[ text "Created by "
, a [ href "https://www.vbrandl.net/" ]
[ text "Valentin Brandl" ]
, text "."
]
]
]
]
, nav []
[ ul []
[ li []
[ small []
[ a [ href repository ]
[ text "Repository" ]
]
]
, li []
[ small []
[ a [ href "https://opensource.org/licenses/MIT" ]
[ text "MIT License" ]
]
]
]
]
]
body : Model -> Html Msg
body state =
article myStyle
div myStyle
[ input (myStyle2 [ placeholder "GitHub/GitLab/Bitbucket URL", value state.url, onInput UrlChange ])
[]
, input (myStyle2 [ readonly True, value (displayMUrl state.parsed) ]) []
, h2 myStyle
[ text "Caching" ]
, p myStyle
[ text "Files are cached in the CDN for about one year." ]
, p myStyle
[ text "Redirects for tags and branches are cached for 5 minutes." ]
, h2 myStyle
[ text "Invalidating the Cache" ]
, p myStyle
[ text "To delete a file from the cache, just request the file via HTTP "
, code "DELETE"
]
]
code : String -> Html msg
code msg =
Html.code [] [ text msg ]
main : Program () Model Msg

View File

@ -9,11 +9,50 @@
</head>
<body>
<section>
<header>
<h1>GitCDN</h1>
</header>
<article>
<div id="elm-${SHA1}"></div>
<script src="./scripts/gitcdn-${SHA1}.min.js">
</script>
<script>
var app = Elm.Main.init({ node: document.getElementById("elm-${SHA1}") });
</script>
<h2>Caching</h2>
<p>Files from a specific commit are cached in the CDN for one year.</p>
<p>Redirects for tags and branches are cached for 5 minutes.</p>
<h2>Invalidating the Cache</h2>
<p>To delete a file from the cache, just request the file via HTTP <code>DELETE</code></p>
</article>
<footer>
<nav>
<ul>
<li>
<small>Created by <a href="https://www.vbrandl.net/">Valentin Brandl</a>.</small>
</li>
</ul>
</nav>
<nav>
<ul>
<li>
<small><a href="https://git.vbrandl.net/vbrandl/gitache">Repository</a></small>
</li>
<li>
<small><a href="https://opensource.org/licenses/MIT">MIT License</a></small>
</li>
</ul>
</nav>
</footer>
</section>
</body>
</html>