diff options
-rw-r--r-- | blog/migrations/0006_auto_20200304_0226.py | 18 | ||||
-rw-r--r-- | blog/models.py | 3 | ||||
-rw-r--r-- | blog/templates/blog/blog_index_page.html | 62 | ||||
-rw-r--r-- | home/templates/home/home_page.html | 12 | ||||
-rw-r--r-- | jthanio/templates/search.html | 12 |
5 files changed, 96 insertions, 11 deletions
diff --git a/blog/migrations/0006_auto_20200304_0226.py b/blog/migrations/0006_auto_20200304_0226.py new file mode 100644 index 0000000..5a82a76 --- /dev/null +++ b/blog/migrations/0006_auto_20200304_0226.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.3 on 2020-03-04 02:26 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('blog', '0005_blogpost_categories'), + ] + + operations = [ + migrations.AlterField( + model_name='blogindexpage', + name='intro', + field=models.CharField(max_length=500), + ), + ] diff --git a/blog/models.py b/blog/models.py index 1848e0e..50210e7 100644 --- a/blog/models.py +++ b/blog/models.py @@ -11,7 +11,8 @@ from taggit.models import TaggedItemBase from wagtail.snippets.models import register_snippet class BlogIndexPage(Page): - intro = RichTextField(blank=True) + intro = models.CharField(max_length=500) + def get_context(self, request): # Update context to include only published posts, ordered by reverse-chron diff --git a/blog/templates/blog/blog_index_page.html b/blog/templates/blog/blog_index_page.html index 0e9c56e..043539f 100644 --- a/blog/templates/blog/blog_index_page.html +++ b/blog/templates/blog/blog_index_page.html @@ -5,16 +5,60 @@ {% block body_class %}template-blogindexpage{% endblock %} {% block content %} - <h1>{{ page.title }}</h1> +<div class="container"> - <div class="intro">{{ page.intro|richtext }}</div> + <div class="row"> - {% for post in blogpages %} - {% with post=post.specific %} - <h2><a href="{% pageurl post %}">{{ post.title }}</a></h2> - <p>{{ post.intro }}</p> - {{ post.body|richtext }} - {% endwith %} -{% endfor %} + <!-- Blog Entries Column --> + <div class="col-md-8"> + <h1 class="my-4">{{ page.title }} + <small>{{ page.intro }}</small> + </h1> + <hr> + + {% for post in blogpages %} + {% with post=post.specific %} + + <!-- Blog Post --> + <div class="card mb-4"> + <img class="card-img-top" src="http://placehold.it/750x300" alt="Card image cap"> + <div class="card-body"> + <h2 class="card-title">{{ post.title }}</h2> + <p class="card-text">{{ post.intro }}</p> + <a href="{% pageurl post %}" class="btn btn-primary">Read More</a> + </div> + <div class="card-footer text-muted"> + Posted on {{ post.date }} + </div> + </div> + {% endwith %} + {% endfor %} + + <!-- Pagination --> + <ul class="pagination justify-content-center mb-4"> + <li class="page-item"> + <a class="page-link" href="#">← Older</a> + </li> + <li class="page-item disabled"> + <a class="page-link" href="#">Newer →</a> + </li> + </ul> + + </div> + + <!-- Sidebar Widgets Column --> + <div class="col-md-4"> + + {% include "search.html" %} + + + </div> + + </div> + <!-- /.row --> + + </div> + + </div> {% endblock %}
\ No newline at end of file diff --git a/home/templates/home/home_page.html b/home/templates/home/home_page.html index d1a2f6d..98b77e7 100644 --- a/home/templates/home/home_page.html +++ b/home/templates/home/home_page.html @@ -5,5 +5,15 @@ {% block body_class %}template-homepage{% endblock %} {% block content %} - {{ page.body|richtext }} +<div class="container"> + + <div class="row"> + + <!-- Blog Entries Column --> + <div class="col-md-8"> + + <h1 class="my-4">{{ page.title }} + <small>{{ page.intro }}</small> + </h1> + <hr> {% endblock %} diff --git a/jthanio/templates/search.html b/jthanio/templates/search.html new file mode 100644 index 0000000..8b66d9a --- /dev/null +++ b/jthanio/templates/search.html @@ -0,0 +1,12 @@ + <!-- Search Widget --> + <div class="card my-4"> + <h5 class="card-header">Search</h5> + <div class="card-body"> + <div class="input-group"> + <input type="text" class="form-control" placeholder="Search for..."> + <span class="input-group-btn"> + <button class="btn btn-secondary" type="button">Search</button> + </span> + </div> + </div> + </div>
\ No newline at end of file |