diff options
Diffstat (limited to 'weblog/templates')
-rw-r--r-- | weblog/templates/weblog/index.html | 78 | ||||
-rw-r--r-- | weblog/templates/weblog/post.html | 67 | ||||
-rw-r--r-- | weblog/templates/weblog/sidebar_archive.html | 13 | ||||
-rw-r--r-- | weblog/templates/weblog/sidebar_categories.html | 11 | ||||
-rw-r--r-- | weblog/templates/weblog/weblog.html | 42 | ||||
-rw-r--r-- | weblog/templates/weblog_base.html | 28 | ||||
-rw-r--r-- | weblog/templates/weblog_base_old.html | 35 |
7 files changed, 274 insertions, 0 deletions
diff --git a/weblog/templates/weblog/index.html b/weblog/templates/weblog/index.html new file mode 100644 index 0000000..c46da38 --- /dev/null +++ b/weblog/templates/weblog/index.html @@ -0,0 +1,78 @@ +{% extends 'weblog/weblog.html' %}
+{% load i18n %}
+{% block title_block %}
+{% if category %}
+{% if category == 'misc' %}
+{% trans 'Uncategorized' context 'Posts without category' %}
+{% else %}
+{{ category.name }}
+{% endif %}
+{% else %}
+{{ blog_title }}
+{% endif %}
+{% endblock %}
+{% block blog_content_block %}
+{% if category %}
+{% if category == 'misc' %}
+<h1>{% trans 'Uncategorized posts' context 'Uncategorized page title' %}</h1>
+{% else %}
+<h1>{% blocktrans with category_name=category.name context 'Posts in category' %}Posts in {{ category_name }}{% endblocktrans %}</h1>
+{% endif %}
+{% else %}
+<h1>{{ blog_title }}</h1>
+{% endif %}
+ {% if posts %}
+ {% for post in posts %}
+ <div class="container-fluid blogpost">
+ <h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
+ <p class="publish-info">{% blocktrans with publish_date=post.publish_date %}Published on {{ publish_date }}{% endblocktrans %}{% if post.author %}{% blocktrans with author=post.author context 'Written by (Author)' %}, by {{ author }}{% endblocktrans %}{% endif %}</p>
+ <hr>
+ {% if post.preview_image %}<img class="img-responsive preview-img" src="{{ post.preview_image.url }}">{% endif %}
+ {{ post.preview_text|safe }}
+ <hr>
+ <div class="text-right">
+ <a href="{{ post.url }}">{% trans 'Read more...' %}</a>
+ </div>
+ </div>
+ {% endfor %}
+ {% if last_page > 1 %}
+ <ul class="pagination">
+ {% if current_page != 1 %}
+ <li title="{% trans 'First' context 'Page' %}"><a href="{% if category %}{% if category == 'misc' %}{% url 'weblog:CategoryIndex' category_slug='misc' %}{% else %}{% url 'weblog:CategoryIndex' category_slug=category.slug %}{% endif %}{% else %}{% url 'weblog:Index' %}{% endif %}">«</a></li>
+ <li title="{% trans 'Previous' context 'Page' %}"><a href="{% if category %}{% if category == 'misc' %}{% url 'weblog:CategoryIndex' category_slug='misc' %}?page={{ current_page|add:'-1' }}{% else %}{% url 'weblog:CategoryIndex' category_slug=category.slug %}?page={{ current_page|add:'-1' }}{% endif %}{% else %}{% url 'weblog:Index' %}?page={{ current_page|add:'-1' }}{% endif %}">←</a></li>
+ {% if current_page == last_page and current_page|add:'-4' >= 1 %}
+ <li><a href="{% if category %}{% if category == 'misc' %}{% url 'weblog:CategoryIndex' category_slug='misc' %}?page={{ current_page|add:'-4' }}{% else %}{% url 'weblog:CategoryIndex' category_slug=category.slug %}?page={{ current_page|add:'-4' }}{% endif %}{% else %}{% url 'weblog:Index' %}?page={{ current_page|add:'-4' }}{% endif %}">{{ current_page|add:'-4' }}</a></li>
+ {% endif %}
+ {% if current_page|add:'1' >= last_page and current_page|add:'-3' >= 1 %}
+ <li><a href="{% if category %}{% if category == 'misc' %}{% url 'weblog:CategoryIndex' category_slug='misc' %}?page={{ current_page|add:'-3' }}{% else %}{% url 'weblog:CategoryIndex' category_slug=category.slug %}?page={{ current_page|add:'-3' }}{% endif %}{% else %}{% url 'weblog:Index' %}?page={{ current_page|add:'-3' }}{% endif %}">{{ current_page|add:'-3' }}</a></li>
+ {% endif %}
+ {% if current_page|add:'-2' >= 1 %}
+ <li><a href="{% if category %}{% if category == 'misc' %}{% url 'weblog:CategoryIndex' category_slug='misc' %}?page={{ current_page|add:'-2' }}{% else %}{% url 'weblog:CategoryIndex' category_slug=category.slug %}?page={{ current_page|add:'-2' }}{% endif %}{% else %}{% url 'weblog:Index' %}?page={{ current_page|add:'-2' }}{% endif %}">{{ current_page|add:'-2' }}</a></li>
+ {% endif %}
+ {% if current_page|add:'-1' >= 1 %}
+ <li><a href="{% if category %}{% if category == 'misc' %}{% url 'weblog:CategoryIndex' category_slug='misc' %}?page={{ current_page|add:'-1' }}{% else %}{% url 'weblog:CategoryIndex' category_slug=category.slug %}?page={{ current_page|add:'-1' }}{% endif %}{% else %}{% url 'weblog:Index' %}?page={{ current_page|add:'-1' }}{% endif %}">{{ current_page|add:'-1' }}</a></li>
+ {% endif %}
+ {% endif %}
+ <li class="active"><a href="#">{{ current_page }}</a></li>
+ {% if current_page != last_page %}
+ {% if current_page|add:'1' <= last_page %}
+ <li><a href="{% if category %}{% if category == 'misc' %}{% url 'weblog:CategoryIndex' category_slug='misc' %}?page={{ current_page|add:'1' }}{% else %}{% url 'weblog:CategoryIndex' category_slug=category.slug %}?page={{ current_page|add:'1' }}{% endif %}{% else %}{% url 'weblog:Index' %}?page={{ current_page|add:'1' }}{% endif %}">{{ current_page|add:'1' }}</a></li>
+ {% endif %}
+ {% if current_page|add:'2' <= last_page %}
+ <li><a href="{% if category %}{% if category == 'misc' %}{% url 'weblog:CategoryIndex' category_slug='misc' %}?page={{ current_page|add:'2' }}{% else %}{% url 'weblog:CategoryIndex' category_slug=category.slug %}?page={{ current_page|add:'2' }}{% endif %}{% else %}{% url 'weblog:Index' %}?page={{ current_page|add:'2' }}{% endif %}">{{ current_page|add:'2' }}</a></li>
+ {% endif %}
+ {% if current_page|add:'-1' <= 1 and current_page|add:'3' <= last_page %}
+ <li><a href="{% if category %}{% if category == 'misc' %}{% url 'weblog:CategoryIndex' category_slug='misc' %}?page={{ current_page|add:'3' }}{% else %}{% url 'weblog:CategoryIndex' category_slug=category.slug %}?page={{ current_page|add:'3' }}{% endif %}{% else %}{% url 'weblog:Index' %}?page={{ current_page|add:'3' }}{% endif %}">{{ current_page|add:'3' }}</a></li>
+ {% endif %}
+ {% if current_page == 1 and current_page|add:'4' <= last_page %}
+ <li><a href="{% if category %}{% if category == 'misc' %}{% url 'weblog:CategoryIndex' category_slug='misc' %}?page={{ current_page|add:'4' }}{% else %}{% url 'weblog:CategoryIndex' category_slug=category.slug %}?page={{ current_page|add:'4' }}{% endif %}{% else %}{% url 'weblog:Index' %}?page={{ current_page|add:'4' }}{% endif %}">{{ current_page|add:'4' }}</a></li>
+ {% endif %}
+ <li title="{% trans 'Next' context 'Page' %}"><a href="{% if category %}{% if category == 'misc' %}{% url 'weblog:CategoryIndex' category_slug='misc' %}?page={{ current_page|add:'1' }}{% else %}{% url 'weblog:CategoryIndex' category_slug=category.slug %}?page={{ current_page|add:'1' }}{% endif %}{% else %}{% url 'weblog:Index' %}?page={{ current_page|add:'1' }}{% endif %}">→</a></li>
+ <li title="{% trans 'Last' context 'Page' %}"><a href="{% if category %}{% if category == 'misc' %}{% url 'weblog:CategoryIndex' category_slug='misc' %}?page={{ last_page }}{% else %}{% url 'weblog:CategoryIndex' category_slug=category.slug %}?page={{ last_page }}{% endif %}{% else %}{% url 'weblog:Index' %}?page={{ last_page }}{% endif %}">»</a></li>
+ {% endif %}
+ </ul>
+ {% endif %}
+ {% else %}
+ <div class="text-center"><h2>{% trans 'Nothing has been posted yet.' %}</h2></div>
+ {% endif %}
+{% endblock %}
\ No newline at end of file diff --git a/weblog/templates/weblog/post.html b/weblog/templates/weblog/post.html new file mode 100644 index 0000000..364e17c --- /dev/null +++ b/weblog/templates/weblog/post.html @@ -0,0 +1,67 @@ +{% extends 'weblog/weblog.html' %} +{% load i18n %} +{% block title_block %}{% if post_translation %}{{ post_translation.title }}{% else %}{{ post.title }}{% endif %}{% endblock %} +{% block blog_content_block %} +<div class="container-fluid blogpost"> + <h2>{% if post_translation %}{{ post_translation.title }}{% else %}{{ post.title }}{% endif %}</h2> + <p class="publish-info">{% blocktrans with publish_date=post.publish_date %}Published on {{ publish_date }}{% endblocktrans %}{% if post_author %}{% blocktrans with author=post_author context 'Written by (Author)' %}, by {{ author }}{% endblocktrans %}{% endif %}</p> + <hr> + {% if post_translation %} + {{ post_translation.content|safe }} + {% else %} + {{ post.content|safe }} + {% endif %} + {% if post_categories %} + <hr> + <p>{% trans 'Categories' context 'Post categories' %}: + {% for post_category in post_categories %} + <a class="label label-info" href="{% url 'weblog:CategoryIndex' category_slug=post_category.slug %}">{{ post_category.name }}</a> + {% endfor %} + </p>{% endif %} + {% if enable_comments %} + <hr id="#comment-section"> + {% if user.is_authenticated or allow_anon_comments %} + <h3>{% trans 'Leave a comment' %}</h3> + <form id="comment_form" method="POST" action="{{ post.get_absolute_url }}#comment-section"> + {% csrf_token %} + <div class="form-group"> + {{ comment_form }} + </div> + <div class="form-group text-right"> + <button class="btn btn-primary" type="submit" value="Submit">{% trans 'Submit comment' %}</button> + </div> + </form> + {% else %} + <h4>{% trans 'To leave a comment you need to sign in' %}</h4> + {% endif %} + {% if comments %} + {% if comment_submission %} + {% if comment_submission_error %} + <div class="alert alert-danger alert-dismissable"> + <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> + {{ comment_submission_error }} + </div> + {% else %} + <div class="alert alert-success alert-dismissable"> + <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> + {% trans 'Comment submited successfully' %} + </div> + {% endif %} + {% endif %} + {% for comment in comments %} + <div class="media"> + <div class="media-body"> + <h4 class="media-heading">{% if comment.author %}{{ comment.author.get_username }}{% else %}{% trans 'Anonymous' context 'Unauthenticated comment poster' %}{% endif %}</h4> + <p>{{ comment.content }}</p> + </div> + </div> + {% endfor %} + {% else %} + <div class="text-center"> + <br> + <h3>{% trans 'Nobody has left a comment on this post yet' %}</h3> + </div> + {% endif %} + {% endif %} +</div> +{% endblock %}
\ No newline at end of file diff --git a/weblog/templates/weblog/sidebar_archive.html b/weblog/templates/weblog/sidebar_archive.html new file mode 100644 index 0000000..5953bfe --- /dev/null +++ b/weblog/templates/weblog/sidebar_archive.html @@ -0,0 +1,13 @@ +{% load i18n %} +<h3>{% trans 'Archive' context 'Blog archive' %}</h3> +<ul class='archive-list'> +{% for a_year in archive %} +<li><a class="node-toggle" node-target="{{ a_year.0 }}-list" node-state="closed" href="javascript:void(0)" onclick="toggleNode(this);">+</a> <a href="{% url 'weblog:ArchiveIndex' year=a_year.0 %}">{{ a_year.0 }}</a> + <ul id="{{ a_year.0 }}-list" class='archive-child-list'> + {% for a_month in a_year.1 %} + <li><a href="{% url 'weblog:ArchiveIndex' year=a_year.0 month=a_month.0 %}">{{ a_month.1 }}</a></li> + {% endfor %} + </ul> +</li> +{% endfor %} +</ul>
\ No newline at end of file diff --git a/weblog/templates/weblog/sidebar_categories.html b/weblog/templates/weblog/sidebar_categories.html new file mode 100644 index 0000000..7e7fa5c --- /dev/null +++ b/weblog/templates/weblog/sidebar_categories.html @@ -0,0 +1,11 @@ +{% load i18n %} +{% if categories %} +<h3>{% trans 'Categories' context 'Post categories' %}</h3> +<div class="list-group weblog-categories"> + {% for category in categories %} + <a href="{% url 'weblog:CategoryIndex' category_slug=category.slug %}" class="list-group-item{% if category.slug == selected_cat_slug %} active{% endif %}"> + {{ category.name }} + </a> + {% endfor %} +</div> +{% endif %}
\ No newline at end of file diff --git a/weblog/templates/weblog/weblog.html b/weblog/templates/weblog/weblog.html new file mode 100644 index 0000000..9980b54 --- /dev/null +++ b/weblog/templates/weblog/weblog.html @@ -0,0 +1,42 @@ +{% extends base_template %} +{% load i18n %} +{% load weblog_extras %} +{% block title_block %}{% endblock %} +{% block blog_block %} +<ol class="breadcrumb"> + {% if breadcrumbs %} + <li><a href="{% url 'weblog:Index' %}">{{ blog_title }}</a></li> + {% for crumb in breadcrumbs %} + {% if forloop.last %} + <li class="active">{{ crumb.name }}</li> + {% else %}<li><a href="{{ crumb.url }}">{{ crumb.name }}</a></li>{% endif %} + {% endfor %} + {% else %} + <li class="active"><a href="{% url 'weblog:Index' %}">{{ blog_title }}</a></li> + {% endif %} +</ol> +<div class="row"> + <div class="{% if show_sidebar %}col-sm-9{% else %}container-fluid{% endif %}"> + {% block blog_content_block %} + {% endblock %} + </div> + {% if show_sidebar %} + <div class="col-sm-3 weblog-sidebar"> + {% if show_categories %} + {% if category %} + {% if category == 'misc' %} + {% get_sidebar_categories category %} + {% else %} + {% get_sidebar_categories category.slug %} + {% endif %} + {% else %} + {% get_sidebar_categories %} + {% endif %} + {% endif %} + {% if show_archive %} + {% get_sidebar_archive %} + {% endif %} + </div> + {% endif %} +</div> +{% endblock %}
\ No newline at end of file diff --git a/weblog/templates/weblog_base.html b/weblog/templates/weblog_base.html new file mode 100644 index 0000000..536e736 --- /dev/null +++ b/weblog/templates/weblog_base.html @@ -0,0 +1,28 @@ +<!DOCTYPE html>
+{% load static %}
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Simple blog - {% block title_block %} Home {% endblock %}</title>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
+ <link rel="stylesheet" href="{% static '/weblog/css/weblog.css' %}">
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" defer></script>
+ <script src="{% static '/weblog/js/weblog.js' %}" defer></script>
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" defer></script>
+ </head>
+ <body>
+ <nav class="navbar navbar-inverse">
+ <div class="container nav-container">
+ <div class="navbar-header">
+ <a class="navbar-brand" href="{% url 'weblog:Index' %}">{{ blog_title }}</a>
+ </div>
+ </div>
+ </nav>
+ <div class="container">
+ {% block content_block %}
+ {% block blog_block %}
+ {% endblock %}
+ {% endblock %}
+ </div>
+ </body>
+</html>
\ No newline at end of file diff --git a/weblog/templates/weblog_base_old.html b/weblog/templates/weblog_base_old.html new file mode 100644 index 0000000..a4dbd30 --- /dev/null +++ b/weblog/templates/weblog_base_old.html @@ -0,0 +1,35 @@ +<!DOCTYPE html>
+{% load static %}
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Simple blog - {% block title_block %} Home {% endblock %}</title>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
+ <link rel="stylesheet" href="{% static '/weblog/css/weblog.css' %}">
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" defer></script>
+ <script src="{% static '/weblog/js/weblog.js' %}" defer></script>
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" defer></script>
+ </head>
+ <body>
+ <nav class="navbar navbar-inverse">
+ <div class="container nav-container">
+ <div class="navbar-header">
+ <a class="navbar-brand" href="{% url 'weblog:Index' %}">{{ blog_title }}</a>
+ </div>
+ <div class="collapse navbar-collapse">
+ <ul class="nav navbar-nav navbar-right">
+ <li><a href="{% url 'weblog:ChangeLanguage' language='en' %}?next={{ request.path }}">EN</a></li>
+ <li><a href="{% url 'weblog:ChangeLanguage' language='es' %}?next={{ request.path }}">ES</a></li>
+ <li><a href="{% url 'weblog:ChangeLanguage' language='ru' %}?next={{ request.path }}">RU</a></li>
+ </ul>
+ </div>
+ </div>
+ </nav>
+ <div class="container">
+ {% block content_block %}
+ {% block blog_block %}
+ {% endblock %}
+ {% endblock %}
+ </div>
+ </body>
+</html>
\ No newline at end of file |