Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% load i18n %}
{% load gravatar %}
{% load comments_xtd %}

<tbody>
{% for element in comments %}
<tr class="">
<td class="ord">
<span class="avatar icon icon-user" style="top:0;"><img src="{% gravatar_url element.comment.user_email %}" /></span>
<td class="ord" valign="top">
<span class="avatar small" style="top:0;"><img src="{{ element.comment.user_email|xtd_comment_gravatar_url }}" /></span>
</td>
<td class="title" valign="top" data-listing-page-title="">
<h2>
Expand All @@ -32,10 +32,10 @@ <h2>
{% endif %}
</ul>
</td>
<td class="updated" valign="top">
{{ element.comment.submit_date|date:"d M Y H:i" }}
<td class="human-readable-date" title="{{ element.comment.submit_date|date:"d M Y H:i" }}" valign="top">
{{ element.comment.submit_date|timesince }} ago
</td>
<td>
<td class="status" valign="top">
{% if not element.comment.is_public %}
<span class="status-tag">{% trans "Deleted" %}</span>
{% elif element.comment.is_removed %}
Expand Down
5 changes: 4 additions & 1 deletion wagtailcomments_xtd/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from django_comments_xtd.models import XtdComment
from django_comments_xtd import get_model as get_comment_model


XtdComment = get_comment_model()


def cleaned_tree(comments):
Expand Down
11 changes: 9 additions & 2 deletions wagtailcomments_xtd/views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
from django.contrib import messages
from wagtail.wagtailcore.models import Page
from django.shortcuts import redirect, render
from django_comments_xtd.models import XtdComment
from django_comments_xtd import get_model as get_comment_model
from django.utils.translation import ugettext as _
from wagtailcomments_xtd.utils import cleaned_tree
try:
from wagtail.wagtailcore.models import Page
except ImportError:
# Wagtail 2.0+
from wagtail.core.models import Page


XtdComment = get_comment_model()


def pages(request):
Expand Down
19 changes: 15 additions & 4 deletions wagtailcomments_xtd/wagtail_hooks.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
from django.core import urlresolvers
try:
# urlresolvers removed in Django 2.0:
from django.core.urlresolvers import reverse
except ImportError:
# For Django 2.0+
from django.urls import reverse
from wagtailcomments_xtd import urls
from wagtail.wagtailcore import hooks
from django.conf.urls import include, url
from wagtail.wagtailadmin.menu import MenuItem
from django.utils.translation import ugettext_lazy as _

try:
from wagtail.wagtailcore import hooks
from wagtail.wagtailadmin.menu import MenuItem
except ImportError:
# Wagtail 2.0+
from wagtail.core import hooks
from wagtail.admin.menu import MenuItem


@hooks.register('register_admin_urls')
def register_admin_urls():
Expand All @@ -17,7 +28,7 @@ def register_admin_urls():
def register_styleguide_menu_item():
return MenuItem(
_('Comments'),
urlresolvers.reverse('wagtailcomments_xtd_pages'),
reverse('wagtailcomments_xtd_pages'),
classnames='icon icon-fa-comments-o',
order=1000
)