From 4bae11bb25a8e3c43118891d17fd8e981ecf8dc6 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Fri, 23 May 2014 10:48:20 -0400 Subject: Refactored code to use PEP8/Pyflake coding styles and cleaned up cruft a bit --- design/templates/archives/writing_date.html | 26 ++++++++++++++++++ design/templates/comments/base.html | 8 ++++++ design/templates/comments/comment.html | 32 ++++++++++++++++++++++ .../comments/comment_notification_email.txt | 20 ++++++++++++++ design/templates/comments/deleted.html | 21 ++++++++++++++ design/templates/comments/flagged.html | 21 ++++++++++++++ design/templates/comments/form.html | 18 ++++++++++++ design/templates/comments/list.html | 14 ++++++++++ design/templates/comments/posted.html | 25 +++++++++++++++++ design/templates/comments/preview.html | 30 ++++++++++++++++++++ 10 files changed, 215 insertions(+) create mode 100644 design/templates/archives/writing_date.html create mode 100644 design/templates/comments/base.html create mode 100644 design/templates/comments/comment.html create mode 100644 design/templates/comments/comment_notification_email.txt create mode 100644 design/templates/comments/deleted.html create mode 100644 design/templates/comments/flagged.html create mode 100644 design/templates/comments/form.html create mode 100644 design/templates/comments/list.html create mode 100644 design/templates/comments/posted.html create mode 100644 design/templates/comments/preview.html (limited to 'design/templates') 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 %} +

How did you get here? You URL chopping maniac you. Right on.

+ +

{% if type == 'year' %}{{date}}, on luxagraf{%else%} Archive: {{date}} {% endif %}

{% if type == 'year' %} + {% else %} + + {% 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 %} +
+ {% block content %}{% endblock %} +
+{% 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 %} +
+ {% if preview %}

{% trans "Preview of your comment" %}

{% endif %} +
+ {% if comment.url %}{%if comment.url == "http://lux.me/"%}{%else%}{% endif %}{% endif %} + {% if comment.name %}{{ comment.name }}{% else %}{% trans "Anonymous" %}{% endif %}{% comment %} + {% endcomment %}{% if comment.url %}{% endif %} + {% if not comment.is_public %}({% trans "moderated" %}){% endif %} + {% if USE_THREADEDCOMMENTS and not preview %}{% trans "reply" %}{% endif %} +
+ + +
{{ comment.comment|linebreaks }}
+
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 }} + +{% endblock %} + +{% block content %} +

{% trans "Thanks for removing the comment" %}

+

+ {% blocktrans %} + Thanks for taking the time to improve the quality of discussion on our site.
+ You will be sent back to the article... + {% endblocktrans %} +

+ +

{% trans "Back to the article" %}

+{% 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 }} + +{% endblock %} + +{% block content %} +

{% trans "Thanks for flagging the comment" %}

+

+ {% blocktrans %} + Thanks for taking the time to improve the quality of discussion on our site.
+ You will be sent back to the article... + {% endblocktrans %} +

+ +

{% trans "Back to the article" %}

+{% 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 %} +

{% trans "Comments are closed." %}

+{% else %} +
{% csrf_token %} + {% if next %}
{% endif %} + + {{ form|crispy }} + +
+ + + {% ajax_comment_tags %} +
+
+{% 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 }} + +{% endblock %} + +{% block content %} +

{% trans "Thanks for posting your comment" %}

+

+ {% blocktrans %} + We have received your comment, and posted it on the web site.
+ You will be sent back to the article... + {% endblocktrans %} +

+ + {# Use identical formatting to normal comment list #} +
+ {% include "comments/comment.html" %} +
+ +

{% trans "Back to the article" %}

+{% 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 %} +
{% csrf_token %} + {% if next %}
{% endif %} + + {% if form.errors %} +

{% blocktrans count form.errors|length as counter %}Please correct the error below{% plural %}Please correct the errors below{% endblocktrans %}

+ {% else %} +

{% trans "Preview of your comment" %}

+ +
{{ comment|linebreaks }}
+ +
+ +
+ +

{% trans "Or make changes" %}:

+ {% endif %} + + {{ form|crispy }} + +
+ + +
+
+{% endblock %} -- cgit v1.2.3-70-g09d2