Skip to content

Commit

Permalink
Add contact email to rendered site.
Browse files Browse the repository at this point in the history
  • Loading branch information
inklesspen committed Mar 12, 2021
1 parent ddfc1e5 commit d65f1f3
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 6 deletions.
1 change: 1 addition & 0 deletions development.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ hashfs.location = %(here)s/mimirdata/hashfs
render.location = %(here)s/output
render.site_title = Elfgames R Us
render.display_timezone = US/Pacific
render.contact_email = [email protected]

auth.accounts = rose:$argon2id$v=19$m=102400,t=2,p=8$M4bQeg9hLEUoZYwxBmAsBQ$bZ3u7RfLMddRvsT5Ys8Qeg
# Use https://docs.python.org/3.9/library/secrets.html#generating-tokens to generate a suitable secret
Expand Down
1 change: 1 addition & 0 deletions production.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ hashfs.location = %(here)s/mimirdata/hashfs
render.location = %(here)s/output
render.site_title = Elfgame Writeups
render.display_timezone = US/Pacific
render.contact_email = [email protected]

# auth.accounts = rose:foobar
# Use https://docs.python.org/3.9/library/secrets.html#generating-tokens to generate a suitable secret
Expand Down
24 changes: 19 additions & 5 deletions src/mimir/render/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def copy_static_files(request):

def render_toc(request):
site_title = request.registry.settings["render.site_title"]
contact_email = request.registry.settings["render.contact_email"]
writeups = (
request.db_session.query(Writeup)
.options(joinedload(Writeup.posts))
Expand All @@ -72,7 +73,11 @@ def render_toc(request):

content = pyramid.renderers.render(
"mimir:render/toc.mako",
{"writeups": writeups, "site_title": site_title},
{
"writeups": writeups,
"site_title": site_title,
"contact_email": contact_email,
},
request=request,
)

Expand Down Expand Up @@ -108,15 +113,22 @@ def render_feed(request, generator, filename, batches):
feed_title = "{} Recent Changes".format(
request.registry.settings["render.site_title"]
)
description = pyramid.renderers.render(
"mimir:render/toc#site_description.mako", {}, request=request
).strip()

feed = generator(
title=feed_title, link=request.route_url("rendered_toc"), language="en", description="These writeups are extracted from the SA Forum's \"FATAL & Friends\" thread. Some of them are obscure RPGs. Some of them are very bad RPGs."
title=feed_title,
link=request.route_url("rendered_toc"),
language="en",
description=description,
)
for batch in batches:
batch_html = pyramid.renderers.render(
"mimir:render/changelog#batch_feed_html.mako",
{"batch": batch},
request=request,
)
).strip()
feed.add_item(
title=format_datetime(batch.created_at, request.display_timezone),
link=request.route_url("rendered_changelist", _anchor=batch.id.base62),
Expand All @@ -131,6 +143,7 @@ def render_feed(request, generator, filename, batches):

def render_changelog(request):
site_title = request.registry.settings["render.site_title"]
contact_email = request.registry.settings["render.contact_email"]
batches = (
request.db_session.query(ChangeLogBatch)
.order_by(ChangeLogBatch.id.desc())
Expand All @@ -139,7 +152,7 @@ def render_changelog(request):
)
content = pyramid.renderers.render(
"mimir:render/changelog.mako",
{"batches": batches, "site_title": site_title},
{"batches": batches, "site_title": site_title, "contact_email": contact_email},
request=request,
)

Expand All @@ -155,9 +168,10 @@ def render_changelog(request):

def render_writeup(request, writeup):
site_title = request.registry.settings["render.site_title"]
contact_email = request.registry.settings["render.contact_email"]
content = pyramid.renderers.render(
"mimir:render/writeup.mako",
{"writeup": writeup, "site_title": site_title},
{"writeup": writeup, "site_title": site_title, "contact_email": contact_email},
request=request,
)

Expand Down
3 changes: 3 additions & 0 deletions src/mimir/render/layout.mako
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<main>
${ next.body() }
</main>
<footer>
Contact ${contact_email} with concerns or issues.
</footer>
## <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js" integrity="sha512-3oappXMVVac3Ge3OndW0WqpGTWx9jjRJA8SXin8RxmPfc8rg87b31FGy14WHG/ZMRISo9pBjezW9y00RYAEONA==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/8.0.0/cash.min.js" integrity="sha512-EDhfzQEETF4We0xjf0WaLReOGNgsUrXpApjCbIb7ruY4DL5wU6iFPyXPXptxdwQShwBvq8iMUQN4C93UVSXD+w==" crossorigin="anonymous"></script>
<%block name="in_footer"/>
Expand Down
6 changes: 6 additions & 0 deletions src/mimir/render/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ main {
padding: 2ch;
margin: auto;
}
footer {
max-width: 70ch;
padding: 2ch;
margin: auto;
margin-top: 1.5rem;
}
header {
margin-bottom: 1.5rem;
}
Expand Down
5 changes: 4 additions & 1 deletion src/mimir/render/toc.mako
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</%block>

<p>
These writeups are extracted from the SA Forum's "FATAL & Friends" thread. Some of them are obscure RPGs. Some of them are very bad RPGs.
${site_description()}
</p>
<p><a href="${request.route_path('rendered_changelist')}">Recent Changes</a> (<a href="${request.route_path('rendered_changelist_rss')}">RSS</a>, <a href="${request.route_path('rendered_changelist_atom')}">Atom</a>, or <a href="${request.route_path('rendered_changelist_json')}">JSON</a> feed)</p>
<table class="table table-hover">
Expand All @@ -44,3 +44,6 @@ These writeups are extracted from the SA Forum's "FATAL & Friends" thread. Some
% endfor
</tbody>
</table>
<%def name="site_description()">
These writeups are extracted from the SA Forum's "FATAL & Friends" thread. Some of them are obscure RPGs. Some of them are very bad RPGs.
</%def>

0 comments on commit d65f1f3

Please sign in to comment.