From 486b68145eb3a15ee443be7840005e6a49cdf837 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Fri, 5 Feb 2016 10:40:26 -0800 Subject: [PATCH] Initial commit --- .gitignore | 2 ++ LICENSE | 19 +++++++++++++++++++ README.md | 4 ++++ public/css/style.css | 18 ++++++++++++++++++ quotesite.nimble | 13 +++++++++++++ src/quotesite.nim | 19 +++++++++++++++++++ templates/layout.mustache | 11 +++++++++++ 7 files changed, 86 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 public/css/style.css create mode 100644 quotesite.nimble create mode 100644 src/quotesite.nim create mode 100644 templates/layout.mustache diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4b9b1f3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +nimcache +quotesite diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2610aec --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2016 Christine Dodrill + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..cbe28bf --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +quotesite +========= + +Archiving my friends insanity for your amusement. diff --git a/public/css/style.css b/public/css/style.css new file mode 100644 index 0000000..671e9df --- /dev/null +++ b/public/css/style.css @@ -0,0 +1,18 @@ +body { font-family: sans-serif; background: #eee; } +a, h1, h2 { color: #377ba8; } +h1, h2 { font-family: 'Georgia', serif; margin: 0; } +h1 { border-bottom: 2px solid #eee; } +h2 { font-size: 1.2em; } + +.page { margin: 2em auto; width: 35em; border: 5px solid #ccc; + padding: 0.8em; background: white; } +.entries { list-style: none; margin: 0; padding: 0; } +.entries li { margin: 0.8em 1.2em; } +.entries li h2 { margin-left: -1em; } +.add-entry { font-size: 0.9em; border-bottom: 1px solid #ccc; } +.add-entry dl { font-weight: bold; } +.metanav { text-align: right; font-size: 0.8em; padding: 0.3em; + margin-bottom: 1em; background: #fafafa; } +.flash { background: #cee5F5; padding: 0.5em; + border: 1px solid #aacbe2; } +.error { background: #f0d6d6; padding: 0.5em; } diff --git a/quotesite.nimble b/quotesite.nimble new file mode 100644 index 0000000..7932bf0 --- /dev/null +++ b/quotesite.nimble @@ -0,0 +1,13 @@ +# Package + +version = "0.1.0" +author = "Christine Dodrill" +description = "A quote site for my friends" +license = "MIT" +srcDir = "src" +bin = @["quotesite"] + +# Dependencies + +requires "nim >= 0.13.0", "jester", "moustachu" + diff --git a/src/quotesite.nim b/src/quotesite.nim new file mode 100644 index 0000000..dc414af --- /dev/null +++ b/src/quotesite.nim @@ -0,0 +1,19 @@ +import asyncdispatch, jester, moustachu, os, strutils + +const + baseTemplate = staticRead "../templates/layout.mustache" + +settings: + port = 5000.Port + bindAddr = "0.0.0.0" + +routes: + get "/": + var ctx = newContext() + + ctx["title"] = "Test" + ctx["body"] = "

Test!

" + + resp render(baseTemplate, ctx) + +runForever() diff --git a/templates/layout.mustache b/templates/layout.mustache new file mode 100644 index 0000000..7d92ea9 --- /dev/null +++ b/templates/layout.mustache @@ -0,0 +1,11 @@ + +Quotes{{# title }} - {{ title }}{{/title}} + +
+

Quotes

+ + {{{ body }}} +