[cmsiki-svn] SF.net SVN: cmsiki: [14] trunk/cmsiki
Status: Pre-Alpha
Brought to you by:
cnu
From: <cn...@us...> - 2007-03-27 19:01:18
|
Revision: 14 http://cmsiki.svn.sourceforge.net/cmsiki/?rev=14&view=rev Author: cnu Date: 2007-03-27 12:00:54 -0700 (Tue, 27 Mar 2007) Log Message: ----------- Added comments to stories Modified Paths: -------------- trunk/cmsiki/settings.py trunk/cmsiki/templates/base.html trunk/cmsiki/templates/story/story_archive.html trunk/cmsiki/templates/story/story_archive_day.html trunk/cmsiki/templates/story/story_archive_month.html trunk/cmsiki/templates/story/story_detail.html trunk/cmsiki/urls.py Added Paths: ----------- trunk/cmsiki/templates/comments/ trunk/cmsiki/templates/comments/free_preview.html trunk/cmsiki/templates/comments/freeform.html trunk/cmsiki/templates/comments/posted.html Modified: trunk/cmsiki/settings.py =================================================================== --- trunk/cmsiki/settings.py 2007-03-27 16:50:59 UTC (rev 13) +++ trunk/cmsiki/settings.py 2007-03-27 19:00:54 UTC (rev 14) @@ -69,7 +69,14 @@ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', - #'django.contrib.sites', + 'django.contrib.sites', 'django.contrib.admin', + 'django.contrib.comments', 'cmsiki.apps.story', ) + +# Comments: to get the URL of the current page a template variable +## from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS +## TEMPLATE_CONTEXT_PROCESSORS += ( +## 'django.core.context_processors.request', +## ) Modified: trunk/cmsiki/templates/base.html =================================================================== --- trunk/cmsiki/templates/base.html 2007-03-27 16:50:59 UTC (rev 13) +++ trunk/cmsiki/templates/base.html 2007-03-27 19:00:54 UTC (rev 14) @@ -143,6 +143,8 @@ »</a> </p> </div> + {% block comments %} + {% endblock %} </div> {% endblock %} </div><!-- End content --> Added: trunk/cmsiki/templates/comments/free_preview.html =================================================================== --- trunk/cmsiki/templates/comments/free_preview.html (rev 0) +++ trunk/cmsiki/templates/comments/free_preview.html 2007-03-27 19:00:54 UTC (rev 14) @@ -0,0 +1,45 @@ +{% extends "base.html" %} +{% block post %} +<div class="post"> + <h3>Preview your comment</h3> + + <form action="../postfree/" method="post"> + {% if comment_form.has_errors %} + <p><strong style="color: red;">Please correct the following errors.</strong></p> + {% else %} + <div class="comment"> + {{ comment.comment|escape|urlizetrunc:"40"|linebreaks }} + <p class="date small">Posted by <strong>{{ comment.person_name }}</strong></p> + </div> + + <p><input type="submit" name="post" value="Post public comment" /></p> + + <h3>Or edit it again</h3> + {% endif %} + + {% if comment_form.person_name.errors %} + {{ comment_form.person_name.html_error_list }} + {% endif %} + + <p><label for="id_person_name">Your name:</label> {{ comment_form.person_name }}</p> + + {% if comment_form.comment.errors %} + {{ comment_form.comment.html_error_list }} + {% endif %} + + <p> + <label for="id_comment">Comment:</label> + <br /> + {{ comment_form.comment }} + </p> + + <input type="hidden" name="options" value="{{ options }}" /> + <input type="hidden" name="target" value="{{ target }}" /> + <input type="hidden" name="gonzo" value="{{ hash }}" /> + + <p> + <input type="submit" name="preview" value="Preview revised comment" /> + </p> + </form> +</div> +{% endblock %} Added: trunk/cmsiki/templates/comments/freeform.html =================================================================== --- trunk/cmsiki/templates/comments/freeform.html (rev 0) +++ trunk/cmsiki/templates/comments/freeform.html 2007-03-27 19:00:54 UTC (rev 14) @@ -0,0 +1,11 @@ +{% if display_form %} + <form action="/comments/postfree/" method="post"> + <p>Your name: <input type="text" id="id_person_name" name="person_name" /></p> + <p>Comment:<br /><textarea name="comment" id="id_comment" rows="10" cols="60"></textarea></p> + <input type="hidden" name="options" value="{{ options }}" /> + <input type="hidden" name="target" value="{{ target }}" /> + <input type="hidden" name="gonzo" value="{{ hash }}" /> + <p><input type="submit" name="post" value="Preview comment" /></p> + </form> +{% endif %} + Added: trunk/cmsiki/templates/comments/posted.html =================================================================== --- trunk/cmsiki/templates/comments/posted.html (rev 0) +++ trunk/cmsiki/templates/comments/posted.html 2007-03-27 19:00:54 UTC (rev 14) @@ -0,0 +1,14 @@ +{% extends "base.html" %} +{% block post %} +<div class="post"> + <h1>Comment posted successfully</h1> + + <p>Thanks for contributing.</p> + + {% if object %} + <ul> + <li><a href="{{ object.get_absolute_url }}">View your comment</a></li> + </ul> + {% endif %} +</div> +{% endblock %} Modified: trunk/cmsiki/templates/story/story_archive.html =================================================================== --- trunk/cmsiki/templates/story/story_archive.html 2007-03-27 16:50:59 UTC (rev 13) +++ trunk/cmsiki/templates/story/story_archive.html 2007-03-27 19:00:54 UTC (rev 14) @@ -1,16 +1,21 @@ {% extends "base.html" %} +{% load comments.comments %} {% block title %}Home{% endblock %} {% block post %} - {% for story in latest %} - <div class="post"> - <h2><a href="{{ story.get_absolute_url }}">{{ story.title }}</a></h2> - <div class="postinfo">Posted on <span class="postdate">{{ story.pub_date|date:"F j, Y" }}</span> by <strong>{{ story.author }}</strong></div> - - {{ story.replaced_body }} - <div class="postinfo">Posted under category <a href="/category/{{ story.category }}">{{ story.category }}</a>.</div> +{% for story in latest %} +{% get_free_comment_count for story.story story.id as comment_count %} +<div class="post"> + <h2><a href="{{ story.get_absolute_url }}">{{ story.title }}</a></h2> + <div class="postinfo">Posted on <span class="postdate">{{ story.pub_date|date:"F j, Y" }}</span> by <strong>{{ story.author }}</strong></div> + + {{ story.replaced_body }} + <div class="postinfo"> + Posted under category <a href="/category/{{ story.category }}">{{ story.category }}</a> | + <a href="{{ story.get_absolute_url }}">{{ comment_count }} Comments</a> </div> +</div> {% endfor %} </div> {% endblock %} Modified: trunk/cmsiki/templates/story/story_archive_day.html =================================================================== --- trunk/cmsiki/templates/story/story_archive_day.html 2007-03-27 16:50:59 UTC (rev 13) +++ trunk/cmsiki/templates/story/story_archive_day.html 2007-03-27 19:00:54 UTC (rev 14) @@ -1,16 +1,20 @@ {% extends "base.html" %} +{% load comments.comments %} {% block title %}{{ day|date:"F j" }} archive{% endblock %} {% block content %} <div class="content"> {% for story in object_list %} + {% get_free_comment_count for story.story story.id as comment_count %} <div class="post"> <h2><a href="{{ story.get_absolute_url }}">{{ story.title }}</a></h2> <div class="postinfo">Posted on <span class="postdate">{{ story.pub_date|date:"F j, Y" }}</span> by <strong>{{ story.author }}</strong></div> {{ story.replaced_body }} - <div class="postinfo">Posted under category <a href="/category/{{ story.category }}">{{ story.category }}</a>.</div> - + <div class="postinfo"> + Posted under category <a href="/category/{{ story.category }}">{{ story.category }}</a> | + <a href="{{ story.get_absolute_url }}">{{ comment_count }} Comments</a> + </div> </div> {% endfor %} </div> Modified: trunk/cmsiki/templates/story/story_archive_month.html =================================================================== --- trunk/cmsiki/templates/story/story_archive_month.html 2007-03-27 16:50:59 UTC (rev 13) +++ trunk/cmsiki/templates/story/story_archive_month.html 2007-03-27 19:00:54 UTC (rev 14) @@ -1,16 +1,22 @@ {% extends "base.html" %} +{% load comments.comments %} {% block title %}{{ month|date:"F" }} month archive{% endblock %} {% block content %} <div class="content"> {% for story in object_list %} + {% get_free_comment_count for story.story story.id as comment_count %} <div class="post"> <h2><a href="{{ story.get_absolute_url }}">{{ story.title }}</a></h2> <div class="postinfo">Posted on <span class="postdate">{{ story.pub_date|date:"F j, Y" }}</span> by <strong>{{ story.author }}</strong></div> {{ story.replaced_body }} - <div class="postinfo">Posted under category <a href="/category/{{ story.category }}">{{ story.category }}</a>.</div> + <div class="postinfo"> + Posted under category <a href="/category/{{ story.category }}">{{ story.category }}</a> | + <a href="{{ story.get_absolute_url }}">{{ comment_count }} Comments</a> + </div> + </div> {% endfor %} <div class="paginatelinks"> Modified: trunk/cmsiki/templates/story/story_detail.html =================================================================== --- trunk/cmsiki/templates/story/story_detail.html 2007-03-27 16:50:59 UTC (rev 13) +++ trunk/cmsiki/templates/story/story_detail.html 2007-03-27 19:00:54 UTC (rev 14) @@ -1,4 +1,6 @@ {% extends "base.html" %} +{% load comments.comments %} + {% block title %}{{ object.title }}{% endblock %} {% block categories %} @@ -25,5 +27,28 @@ </div> <div class="postinfo">Posted under category <a href="/category/{{ object.category }}">{{ object.category }}</a>.</div> {{ category }} +<!-- </div> --> + +{% get_free_comment_count for story.story object.id as comment_count %} +{% get_free_comment_list for story.story object.id as comment_list %} + +{% block comments %} +<!--<div class="post">--> +<h3 id="comments">{{ comment_count }} comments to this post</h3> +<ol class="commentlist"> +{% for comment in comment_list %} + <li class="comment_{% cycle odd,even %}" id="c{{ comment.id }}"> + <div class="commentmetadata"><a href="#c{{ comment.id }}">#{{ forloop.counter }}</a> + <b>{{ comment.person_name }}</b> commented, on {{ comment.submit_date|date:"F j, Y" }} at {{ comment.submit_date|date:"P" }}: + </div> + {{ comment.comment|escape|urlizetrunc:40|linebreaks }} + </li> +{% endfor %} +</ol> + +<h3 id="respond">Post a comment</h3> +{% free_comment_form for story.story object.id %} + +{% endblock comments %} </div> {% endblock %} Modified: trunk/cmsiki/urls.py =================================================================== --- trunk/cmsiki/urls.py 2007-03-27 16:50:59 UTC (rev 13) +++ trunk/cmsiki/urls.py 2007-03-27 19:00:54 UTC (rev 14) @@ -17,8 +17,13 @@ }, } +urlpatterns = patterns('', + (r'^comments/', include('django.contrib.comments.urls.comments')), +# (r'^comments/posted/', 'views.my_post_free_comment'), -urlpatterns = patterns('django.views.generic.date_based', +) + +urlpatterns += patterns('django.views.generic.date_based', # Example: # (r'^cmsiki/', include('cmsiki.apps.foo.urls.foo')), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |