diff options
author | luxagraf <sng@luxagraf.net> | 2014-05-23 10:48:20 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2014-05-23 10:48:20 -0400 |
commit | 4bae11bb25a8e3c43118891d17fd8e981ecf8dc6 (patch) | |
tree | 6c452743157ad9403ec54a7399b10069688d048f /design/templates | |
parent | eebf53322e0d19be42e41d8f355c5d2a744441ae (diff) |
Refactored code to use PEP8/Pyflake coding styles and cleaned up cruft a
bit
Diffstat (limited to 'design/templates')
-rw-r--r-- | design/templates/archives/writing_date.html | 26 | ||||
-rw-r--r-- | design/templates/comments/base.html | 8 | ||||
-rw-r--r-- | design/templates/comments/comment.html | 32 | ||||
-rw-r--r-- | design/templates/comments/comment_notification_email.txt | 20 | ||||
-rw-r--r-- | design/templates/comments/deleted.html | 21 | ||||
-rw-r--r-- | design/templates/comments/flagged.html | 21 | ||||
-rw-r--r-- | design/templates/comments/form.html | 18 | ||||
-rw-r--r-- | design/templates/comments/list.html | 14 | ||||
-rw-r--r-- | design/templates/comments/posted.html | 25 | ||||
-rw-r--r-- | design/templates/comments/preview.html | 30 |
10 files changed, 215 insertions, 0 deletions
diff --git a/design/templates/archives/writing_date.html b/design/templates/archives/writing_date.html new file mode 100644 index 0000000..103d9df --- /dev/null +++ b/design/templates/archives/writing_date.html @@ -0,0 +1,26 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load html5_datetime %} +{% block pagetitle %}{{block.super}}: Archive{% endblock %} +{% block bodyid %}id="archive"{%endblock%} +{% block primary %} +<p>How did you get here? You URL chopping maniac you. Right on.</p> + +<h1>{% if type == 'year' %}{{date}}, on luxagraf{%else%} Archive: {{date}} {% endif %}</h1>{% if type == 'year' %} + <ul class="archive">{% regroup object_list by pub_date.month as entries_by_month %}{% for entries in entries_by_month %} + <li><span>{{ entries.list.0.pub_date|date:"F Y" }}</span> + <ul>{% for post in entries.list %} + <li> + <a href="{{post.get_absolute_url}}" title="{{post.title}}">{{post.title|smartypants|widont|safe }}</a> + <time datetime="{{post.pub_date|html5_datetime}}">{{post.pub_date|date:"M d, Y"}}</time> + </li> {% endfor %} + </ul> + </li>{% endfor %} + </ul>{% else %} + <ul class="archive">{% for post in object_list %} + <li><a href="{{post.get_absolute_url}}" title="{{post.title}}">{{post.title|smartypants|widont|safe }}</a> + <time datetime="{{post.pub_date|html5_datetime}}">{{post.pub_date|date:"M d, Y"}}</time> + </li> {% endfor %} + </ul> + {% endif %} +{% endblock%} diff --git a/design/templates/comments/base.html b/design/templates/comments/base.html new file mode 100644 index 0000000..d4382ce --- /dev/null +++ b/design/templates/comments/base.html @@ -0,0 +1,8 @@ +{% extends 'base.html' %} +{% block headtitle %}{% block title %}{% trans "Responses for page" %}{% endblock %}{% endblock %} + +{% block main %} + <div id="comments-wrapper"> + {% block content %}{% endblock %} + </div> +{% endblock %} diff --git a/design/templates/comments/comment.html b/design/templates/comments/comment.html new file mode 100644 index 0000000..475775d --- /dev/null +++ b/design/templates/comments/comment.html @@ -0,0 +1,32 @@ +{% comment %} + Something that django.contrib.comments does not provide: + An individual template for a single comment, to easily be reused. + + This include is also used by the Ajax comments view. + The div id should be "c{id}", because the comment.get_absolute_url() points to it. + + NOTE: to override the displayed date format, don't replace this template. + Instead, define DATETIME_FORMAT in a locale file. Requires setting: + + FORMAT_MODULE_PATH = 'settings.locale' + + Then create 'settings/locale/XY/formats.py' with: + + DATETIME_FORMAT = '...' + + This should give you consistent dates across all views. +{% endcomment %} +{% load i18n %} + <div {% if preview %} id="comment-preview"{% else %} id="comment{{ comment.id }}"{% endif %} class="p-comment h-cite u-in-reply-to comment--item {% if comment.url == "http://lux.me/" %}comment--me{%endif%}"> + {% if preview %}<h3>{% trans "Preview of your comment" %}</h3>{% endif %} + <h6 class="p-author h-card comment--author"> + {% if comment.url %}{%if comment.url == "http://lux.me/"%}<a href="/">{%else%}<a href="{{ comment.url }}" rel="nofollow">{% endif %}{% endif %} + {% if comment.name %}{{ comment.name }}{% else %}{% trans "Anonymous" %}{% endif %}{% comment %} + {% endcomment %}{% if comment.url %}</a>{% endif %} + {% if not comment.is_public %}<span class="comment-moderated-flag">({% trans "moderated" %})</span>{% endif %} + {% if USE_THREADEDCOMMENTS and not preview %}<a href="#c{{ comment.id }}" data-comment-id="{{ comment.id }}" class="comment-reply-link">{% trans "reply" %}</a>{% endif %} + </h6> + <a class="comment--datelink" href="#comment{{comment.id}}"><time datetime="{{comment.submit_date|date:'c'}}" class="dt-updated">{% blocktrans with submit_date=comment.submit_date %}{{ submit_date }}{% endblocktrans %}</time></a> + + <div class="e-content comment--content">{{ comment.comment|linebreaks }}</div> + </div> diff --git a/design/templates/comments/comment_notification_email.txt b/design/templates/comments/comment_notification_email.txt new file mode 100644 index 0000000..9dfb821 --- /dev/null +++ b/design/templates/comments/comment_notification_email.txt @@ -0,0 +1,20 @@ +{% load url from future %}{% autoescape off %}{% comment %} +{% endcomment %}A new comment has been posted on your site "{{ site }}, to the page entitled "{{ content_object }}". +Link to the page: http://{{ site.domain }}{{ content_object.get_absolute_url }} + +IP-address: 95.97.240.121{% if comment.title %} +Title: {{ comment.title }}{% endif %} +Name: {{ comment.user_name|default:comment.user }} +Email: {{ comment.user_email }} +Homepage: {{ comment.user_url }} +Moderated: {{ comment.is_public|yesno:'no,yes' }} + +Comment: +{{ comment.comment }} + +---- +You have the following options available: + View comment -- http://{{ site.domain }}{{ comment.get_absolute_url }} + Flag comment -- http://{{ site.domain }}{% url 'comments-flag' comment.pk %} + Delete comment -- http://{{ site.domain }}{% url 'comments-delete' comment.pk %} +{% endautoescape %}
\ No newline at end of file diff --git a/design/templates/comments/deleted.html b/design/templates/comments/deleted.html new file mode 100644 index 0000000..c62a1ff --- /dev/null +++ b/design/templates/comments/deleted.html @@ -0,0 +1,21 @@ +{% extends "comments/base.html" %} +{% load i18n %} + +{% block title %}{% trans "Thanks for removing" %}.{% endblock %} + +{% block extrahead %} + {{ block.super }} + <meta http-equiv="Refresh" content="5; url={{ comment.content_object.get_absolute_url }}#c{{ comment.id }}" /> +{% endblock %} + +{% block content %} + <h2>{% trans "Thanks for removing the comment" %}</h2> + <p> + {% blocktrans %} + Thanks for taking the time to improve the quality of discussion on our site.<br/> + You will be sent back to the article... + {% endblocktrans %} + </p> + + <p><a href="{{ comment.content_object.get_absolute_url }}#c{{ comment.id }}">{% trans "Back to the article" %}</a></p> +{% endblock %} diff --git a/design/templates/comments/flagged.html b/design/templates/comments/flagged.html new file mode 100644 index 0000000..bebc151 --- /dev/null +++ b/design/templates/comments/flagged.html @@ -0,0 +1,21 @@ +{% extends "comments/base.html" %} +{% load i18n %} + +{% block title %}{% trans "Thanks for flagging" %}.{% endblock %} + +{% block extrahead %} + {{ block.super }} + <meta http-equiv="Refresh" content="5; url={{ comment.content_object.get_absolute_url }}#c{{ comment.id }}" /> +{% endblock %} + +{% block content %} + <h2>{% trans "Thanks for flagging the comment" %}</h2> + <p> + {% blocktrans %} + Thanks for taking the time to improve the quality of discussion on our site.<br/> + You will be sent back to the article... + {% endblocktrans %} + </p> + + <p><a href="{{ comment.content_object.get_absolute_url }}#c{{ comment.id }}">{% trans "Back to the article" %}</a></p> +{% endblock %} diff --git a/design/templates/comments/form.html b/design/templates/comments/form.html new file mode 100644 index 0000000..f8bb18d --- /dev/null +++ b/design/templates/comments/form.html @@ -0,0 +1,18 @@ +{% load comments i18n crispy_forms_tags fluent_comments_tags %}{% load url from future %} + +{% if not form.target_object|comments_are_open %} + <p>{% trans "Comments are closed." %}</p> +{% else %} + <form action="{% comment_form_target %}" method="post" class="js-comments-form comments-form form-horizontal" + data-ajax-action="{% url 'comments-post-comment-ajax' %}">{% csrf_token %} + {% if next %}<div><input type="hidden" name="next" value="{{ next }}" /></div>{% endif %} + + {{ form|crispy }} + + <div class="form-actions"> + <input type="submit" name="post" class="btn btn-primary" value="{% trans "Post" %}" /> + <input type="submit" name="preview" class="btn" value="{% trans "Preview" %}" /> + {% ajax_comment_tags %} + </div> + </form> +{% endif %}
\ No newline at end of file diff --git a/design/templates/comments/list.html b/design/templates/comments/list.html new file mode 100644 index 0000000..c105279 --- /dev/null +++ b/design/templates/comments/list.html @@ -0,0 +1,14 @@ +{% comment %} + + Since we support both flat comments, and threadedcomments, + the 'fluent_comments_list' templatetag loads the proper template. + + It either loads: + - fluent_comments/templatetags/flat_html.html + - fluent_comments/templatetags/threaded_list.html + + Both reuse comments/comment.html eventually. + To style comments, consider overwriting that template. + +{% endcomment %} +{% load fluent_comments_tags %}{% fluent_comments_list %} diff --git a/design/templates/comments/posted.html b/design/templates/comments/posted.html new file mode 100644 index 0000000..e13288d --- /dev/null +++ b/design/templates/comments/posted.html @@ -0,0 +1,25 @@ +{% extends "comments/base.html" %}{% load i18n %} + +{% block title %}{% trans "Thanks for commenting" %}{% endblock %} + +{% block extrahead %} +{{ block.super }} + <meta http-equiv="Refresh" content="5; url={{ comment.content_object.get_absolute_url }}#c{{ comment.id }}" /> +{% endblock %} + +{% block content %} + <h2>{% trans "Thanks for posting your comment" %}</h2> + <p> + {% blocktrans %} + We have received your comment, and posted it on the web site.<br/> + You will be sent back to the article... + {% endblocktrans %} + </p> + + {# Use identical formatting to normal comment list #} + <div id="comments"> + {% include "comments/comment.html" %} + </div> + + <p><a href="{{ comment.content_object.get_absolute_url }}#c{{ comment.id }}">{% trans "Back to the article" %}</a></p> +{% endblock %} diff --git a/design/templates/comments/preview.html b/design/templates/comments/preview.html new file mode 100644 index 0000000..663b5ca --- /dev/null +++ b/design/templates/comments/preview.html @@ -0,0 +1,30 @@ +{% extends "comments/base.html" %}{% load i18n crispy_forms_tags comments %} + +{% block title %}{% trans "Preview your comment" %}{% endblock %} + +{% block content %} + <form action="{% comment_form_target %}" method="post" class="form-horizontal">{% csrf_token %} + {% if next %}<div><input type="hidden" name="next" value="{{ next }}" /></div>{% endif %} + + {% if form.errors %} + <h2>{% blocktrans count form.errors|length as counter %}Please correct the error below{% plural %}Please correct the errors below{% endblocktrans %}</h2> + {% else %} + <h2>{% trans "Preview of your comment" %}</h2> + + <blockquote class="comment-preview">{{ comment|linebreaks }}</blockquote> + + <div class="form-actions"> + <input type="submit" name="submit" class="btn btn-primary" value="{% trans "Post your comment" %}" id="submit" /> + </div> + + <p>{% trans "Or make changes" %}:</p> + {% endif %} + + {{ form|crispy }} + + <div class="form-actions"> + <input type="submit" name="post" class="btn btn-primary" value="{% trans "Post" %}" /> + <input type="submit" name="preview" class="btn" value="{% trans "Preview" %}" /> + </div> + </form> +{% endblock %} |