Skip to content

Commit

Permalink
Removed comment code, switched to disqus
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed Sep 19, 2008
1 parent 0322eee commit 0faeb42
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 114 deletions.
11 changes: 0 additions & 11 deletions code/blogfeeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"""

from django.contrib.syndication.feeds import Feed
from django.contrib.comments.feeds import LatestFreeCommentsFeed
from rockstar.apps.blog.models import Post, Tag

class Full(Feed):
Expand Down Expand Up @@ -49,13 +48,3 @@ class Unreleased(Full):

def items(self):
return Post.objects.order_by('-post_date', '-id')[:10]

class Comments(LatestFreeCommentsFeed):
title = "RockStarProgrammer Recent Comments"
description = "Recent comments at RockStarProgrammer"

def item_author_name(self, item):
return item.person_name

def item_pubdate(self, item):
return item.submit_date
1 change: 0 additions & 1 deletion code/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
'django.contrib.admin',
'django.contrib.flatpages',
'django.contrib.redirects',
'django.contrib.comments',
'django.contrib.sitemaps',
'django.contrib.markup',
'rockstar.apps.blog',
Expand Down
5 changes: 1 addition & 4 deletions code/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
feeds = {
'full': blogfeeds.Full,
'summary': blogfeeds.Summary,
'fullunreleased': blogfeeds.Unreleased,
'comments': blogfeeds.Comments,
'fullunreleased': blogfeeds.Unreleased
}

class SpecificPage(Sitemap):
Expand Down Expand Up @@ -49,8 +48,6 @@ def items(self):
(r'^rss/(?P<url>.*)/$', 'django.contrib.syndication.views.feed',
{'feed_dict': feeds}),

(r'^comments/', include('django.contrib.comments.urls.comments')),

(r'^all/', 'django.views.generic.date_based.archive_index',
{'template_name': 'index.html',
'queryset': Post.objects.all(), 'date_field': 'post_date'}),
Expand Down
5 changes: 1 addition & 4 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
title="RockStarProgrammer Blog" href="/rss/full/"/>
<link rel="alternate" type="application/rss+xml"
title="RockStarProgrammer Blog (summarized)" href="/rss/summary/"/>
<link rel="alternate" type="application/rss+xml"
title="Comments" href="/rss/comments/"/>
<script type="text/javascript"
src="http://public.west.spy.net/ufo.js"></script>
<meta name="verify-v1"
Expand Down Expand Up @@ -46,8 +44,6 @@ <h1>Feeds</h1>
src="/media/img/rss-icon.png"/></a></li>
<li><a href="/rss/summary/">summary <img
alt="rss" src="/media/img/rss-icon.png"/></a></li>
<li><a href="/rss/comments/">comments <img
alt="rss" src="/media/img/rss-icon.png"/></a></li>
<li><a href="pcast://www.rockstarprogrammer.org/rss/full/"><img
alt="podcast" title="podcast" src="/media/img/podcast.png"/></a></li>
</ul>
Expand Down Expand Up @@ -84,5 +80,6 @@ <h1>Feeds</h1>
_uacct = "UA-679821-2";
urchinTracker();
</script>
{% block bottom %}{% endblock %}
</body>
</html>
33 changes: 0 additions & 33 deletions templates/comments/free_preview.html

This file was deleted.

11 changes: 0 additions & 11 deletions templates/comments/posted.html

This file was deleted.

25 changes: 18 additions & 7 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

{% block extendedtitle %}Recent Posts{% endblock %}

{% load comments %}

{% block altnav %}
<h1>Table of Contents</h1>
<ul>
Expand All @@ -28,8 +26,6 @@ <h1>Archive</h1>

{% for post in latest %}

{% get_free_comment_count for blog.post post.id as comment_count %}

<a name="post{{post.id}}"></a>
<div class="blogentry {% if not post.released %}unreleased{% endif %}">
<div class="date">{{post.post_date}}</div>
Expand All @@ -53,11 +49,26 @@ <h2>Enclosure</h2>
</div>
{% endif %}
<p class="postmeta">
<a href="/post/{{post.post_date|date:"Y/M/d"|lower}}/{{post.slug}}/#comments">
{{ comment_count }} comment{{ comment_count|pluralize }}
</a>
<a href="/post/{{post.post_date|date:"Y/M/d"|lower}}/{{post.slug}}/#disqus_thread">Comments</a>
</p>
</div>
{% endfor %}

{% endblock %}

{% block bottom %}
<script type="text/javascript">
//<![CDATA[
(function() {
var links = document.getElementsByTagName('a');
var query = '?';
for(var i = 0; i < links.length; i++) {
if(links[i].href.indexOf('#disqus_thread') >= 0) {
query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
}
}
document.write('<script type="text/javascript" src="http://disqus.com/forums/rsp/get_num_replies.js' + query + '"></' + 'script>');
})();
//]]>
</script>
{% endblock %}
48 changes: 5 additions & 43 deletions templates/post.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
{% extends "base-extended.html" %}
{% block extendedtitle %}{{object.title|safe}}{% endblock %}

{% load comments %}

{% block extrastyle %}
<style type="text/css">
.comment {
}
.commenttext {
font-size: smaller;
padding-left: 2em;
border-bottom: solid 1px;
}
</style>
{% endblock %}

{% block content %}
<div class="blogentry {% if not object.released %}unreleased{% endif %}">
<div class="date">{{object.post_date}}</div>
Expand All @@ -40,34 +26,10 @@ <h2>Enclosure</h2>
{% endif %}
</div>

{% get_free_comment_list for blog.post object.id as comment_list %}

<div id="commentContainer">

<h2><a name="comments">Comments</a></h2>

{% for comment in comment_list %}
<div class="comment" id="c{{ comment.id }}">
<h3><a name="c{{ comment.id }}">{{ comment.person_name }}, at
{{ comment.submit_date|date:"F j, Y" }} {{ comment.submit_date|date:"P" }},
said:</a></h3>
<div class="commenttext">
{{ comment.comment|escape|urlizetrunc:"40"|linebreaks }}
</div>
</div>
{% endfor %}

{% if object.comments_allowed %}
<h2>Post a Comment</h2>
<div id="commentform">
{% free_comment_form for blog.post object.id %}
</div>
{% else %}
<div class="nocomments">
New comments are not being accepted for this post.
</div>
{% endif %}

</div>
<div id="disqus_thread"></div><script type="text/javascript"
src="http://disqus.com/forums/rsp/embed.js"></script><noscript><a
href="http://rsp.disqus.com/?url=ref">View the discussion
thread.</a></noscript><a href="http://disqus.com" class="dsq-brlink">blog
comments powered by <span class="logo-disqus">Disqus</span></a>

{% endblock %}

0 comments on commit 0faeb42

Please sign in to comment.