post_preview()
This commit is contained in:
20
templates/components/post_preview.html
Normal file
20
templates/components/post_preview.html
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{% macro render_post(post, expanded=False) %} {% if expanded %}
|
||||||
|
|
||||||
|
<div class="blog-content">{{ post.content | safe }}</div>
|
||||||
|
|
||||||
|
<hr class="post-divider post-divider-expanded" />
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
<div class="blog-preview">{{ post.content | striptags | truncate(200) }}</div>
|
||||||
|
|
||||||
|
<a
|
||||||
|
class="btn btn-default btn-custom"
|
||||||
|
href="{{ url_for('post_detail', post_id=post.id) }}"
|
||||||
|
>
|
||||||
|
Read More
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<hr class="post-divider post-divider-preview" />
|
||||||
|
|
||||||
|
{% endif %} {% endmacro %}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
{% extends "base.html" %} {% block title %}{{blog_title.title}}{% endblock %} {%
|
{% from "components/post_preview.html" import render_post %} {% extends
|
||||||
block content %}
|
"base.html" %} {% block title %}{{blog_title.title}}{% endblock %} {% block
|
||||||
|
content %}
|
||||||
<!--timeline as a component which will be filled with callable function
|
<!--timeline as a component which will be filled with callable function
|
||||||
### double curly brace timeline("career") this is a part of html string
|
### double curly brace timeline("career") this is a part of html string
|
||||||
### nested render-->
|
### nested render-->
|
||||||
@@ -18,22 +19,7 @@ block content %}
|
|||||||
<p>
|
<p>
|
||||||
<span class="glyphicon glyphicon-time"></span> Posted on {{ post.date }}
|
<span class="glyphicon glyphicon-time"></span> Posted on {{ post.date }}
|
||||||
</p>
|
</p>
|
||||||
<!-- stytle customed, expanded and unextanded posts have different margin-->
|
{{ render_post(post, post.displayall) }} {% endfor %}
|
||||||
{% if post.displayall %}
|
|
||||||
<div>{{ post.content | safe }}</div>
|
|
||||||
<hr class="post-divider post-divider-expanded" />
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
<div>{{ post.content | striptags | truncate(200) }}</div>
|
|
||||||
<!--div>{{ post.content[:200] | safe }}...</div-->
|
|
||||||
<a
|
|
||||||
class="btn btn-default btn-custom"
|
|
||||||
href="{{ url_for('post_detail', post_id=post.id) }}"
|
|
||||||
>Read More</a
|
|
||||||
>
|
|
||||||
<hr class="post-divider post-divider-preview" />
|
|
||||||
|
|
||||||
{% endif %} {% endfor %}
|
|
||||||
<ul class="pager">
|
<ul class="pager">
|
||||||
{% if prev_url %}
|
{% if prev_url %}
|
||||||
<li class="previous"><a href="{{ prev_url }}">← Newer</a></li>
|
<li class="previous"><a href="{{ prev_url }}">← Newer</a></li>
|
||||||
|
|||||||
Reference in New Issue
Block a user