From 549b5fd7043995b5f61c3c521474a6b53936a7d7 Mon Sep 17 00:00:00 2001 From: Artyom Date: Fri, 4 Mar 2016 23:10:28 +0300 Subject: [PATCH] Add a footer and a donations page --- src/Main.hs | 61 +++++++++++++++++++++++++++++++++++++++++++++- static/css.css | 7 ++++++ static/loading.svg | 1 + 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 static/loading.svg diff --git a/src/Main.hs b/src/Main.hs index a102503..4605825 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -37,6 +37,7 @@ import qualified Data.Text.Buildable as Format import System.Random -- Web import Lucid hiding (for_) +import Lucid.Base (makeAttribute) import Web.Spock hiding (head, get, text) import qualified Web.Spock as Spock import Network.Wai.Middleware.Static @@ -783,6 +784,9 @@ main = do Spock.get root $ do s <- dbQuery GetGlobalState lucid $ renderRoot s + -- Donation page + Spock.get "donate" $ do + lucid $ renderDonate -- The add/set methods return rendered parts of the structure (added -- categories, changed items, etc) so that the Javascript part could take -- them and inject into the page. We don't want to duplicate rendering on @@ -822,13 +826,68 @@ renderRoot globalState = do -- “commonly used categories” or even a nested catalog renderCategoryList (globalState^.categories) -- TODO: perhaps use infinite scrolling/loading? - -- TODO: add links to source and donation buttons -- TODO: add Piwik/Google Analytics -- TODO: maybe add a button like “give me random category that is unfinished” + div_ [id_ "footer"] $ do + --
+ "made by " >> a_ [href_ "https://artyom.me"] "Artyom" + emptySpan "2em" + a_ [href_ "https://github.com/aelve/guide"] "source" + emptySpan "2em" + a_ [href_ "https://github.com/aelve/guide/issues"] "report an issue" + emptySpan "2em" + a_ [href_ "/donate"] "donate" + sup_ [style_ "font-size:50%"] "I don't have a job" + +-- TODO: include jQuery locally so that it'd be possible to test the site +-- without internet + +renderDonate :: HtmlT IO () +renderDonate = do + includeCSS "/css.css" + renderMarkdownBlock [text| + Okay, the rules: if you donate *anything*, I'll spend some time working + on the site this day (adding content, implementing new features, etc). + + (Of course, I'm planning to be working on the site anyway, donations + or not! However, I jump from project to project way too often (and rarely + manage to finish anything), so donating money is a good way to make sure + that I'd feel obligated to keep working on this one. If I find out that + it doesn't work as a motivation, I'll stop accepting donations.) + + Just in case, 1000 rub. is 14$ (or 12.5€), and you can choose any amount + below 15000 rub. (I'd put a Paypal button, but Paypal doesn't allow + receiving money in Belarus.) + |] + style_ "#iframe-hold {background:url(loading.svg) center center no-repeat;}" + div_ [id_ "iframe-hold"] $ + iframe_ [ + makeAttribute "frameborder" "0", + makeAttribute "allowtransparency" "true", + makeAttribute "scrolling" "no", + width_ "450", + height_ "197", + style_ "display:block;margin:auto;", + src_ "https://money.yandex.ru/embed/shop.xml\ + \?account=410011616040682\ + \&quickpay=shop\ + \&payment-type-choice=on\ + \&mobile-payment-type-choice=on\ + \&writer=seller\ + \&targets=Haskell+guide\ + \&targets-hint=\ + \&default-sum=1000\ + \&button-text=04\ + \&successURL=" ] "" + +-- TODO: all content under CC0 or some other license (which?) -- TODO: allow archiving items if they are in every way worse than the rest, -- or something (but searching should still be possible) +-- TODO: add a list for “interesting libraries, but too lazy to describe, so +-- somebody describe them for me” + helpVersion :: Int helpVersion = 1 diff --git a/static/css.css b/static/css.css index 3b82671..d53480b 100644 --- a/static/css.css +++ b/static/css.css @@ -1,9 +1,16 @@ body { padding: 2em; + padding-bottom: 0; margin: auto; max-width: 800px; font-family: sans-serif; } +#footer { + text-align: center; + padding: 1.5em 0; + margin-top: 2em; + border-top: 1px solid black; } + #search { font-size: 200%; border: 1px solid #d0d0d0; diff --git a/static/loading.svg b/static/loading.svg new file mode 100644 index 0000000..8b985c8 --- /dev/null +++ b/static/loading.svg @@ -0,0 +1 @@ + \ No newline at end of file