templates_blogdir = $(templatesdir)/blog
+templates_blog_modules_DATA = \
+ src/templates/blog/modules/post.html
+
+templates_blog_modulesdir = $(templates_blogdir)/modules
+
templates_modules_DATA = \
src/templates/modules/menu.html
--- /dev/null
+<div class="blog-post">
+ <h5 class="mb-0">{{ post.title }}</h5>
+
+ <p class="small text-muted">
+ {{ _("by") }} <a href="/authors/{{ post.author.uid }}">{{ post.author.name }}</a>,
+ {{ locale.format_date(post.published, shorter=True, relative=False) }}
+ </p>
+
+ {% raw post.text %}
+</div>
{% block main %}
<div class="card">
- <div class="card-body blog-post">
- <h5 class="mb-0">{{ post.title }}</h5>
-
- <p class="small text-muted">
- {{ _("by") }} <a href="/authors/{{ post.author.uid }}">{{ post.author.name }}</a>,
- {{ locale.format_date(post.published, shorter=True, relative=False) }}
- </p>
-
- {% raw post.text %}
+ <div class="card-body">
+ {% module BlogPost(post) %}
</div>
</div>
{% end block %}
"format_month_name" : self.format_month_name,
},
"ui_modules" : {
+ "BlogPost" : blog.PostModule,
+
+ # Old modules
"Advertisement" : AdvertisementModule,
"DonationBox" : DonationBoxModule,
"DonationButton" : DonationButtonModule,
import handlers_base as base
+from . import ui_modules
+
class PostHandler(base.BaseHandler):
def get(self, slug):
entry = self.planet.get_entry_by_slug(slug)
raise tornado.web.HTTPError(404)
self.render("blog/post.html", post=entry)
+
+
+class PostModule(ui_modules.UIModule):
+ def render(self, post):
+ return self.render_string("blog/modules/post.html", post=post)