Mercurial > public > sg101
changeset 87:515d1daec811
Forums: added intra-page links for posts. Added last_page variable for topic. Conditionally display reply form using last_page.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 12 Sep 2009 18:45:35 +0000 |
parents | f81226b5e87b |
children | 3abf0b045749 |
files | gpp/forums/views.py gpp/templates/forums/topic.html |
diffstat | 2 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gpp/forums/views.py Sat Sep 05 20:47:08 2009 +0000 +++ b/gpp/forums/views.py Sat Sep 12 18:45:35 2009 +0000 @@ -60,11 +60,13 @@ topic.save() posts = topic.posts.select_related() + last_page = True # TODO return render_to_response('forums/topic.html', { 'forum': topic.forum, 'topic': topic, 'posts': posts, + 'last_page': last_page, 'form': PostForm(), }, context_instance=RequestContext(request))
--- a/gpp/templates/forums/topic.html Sat Sep 05 20:47:08 2009 +0000 +++ b/gpp/templates/forums/topic.html Sat Sep 12 18:45:35 2009 +0000 @@ -11,13 +11,18 @@ </h3> <div class="forum-block"> +{% if last_page %} +<a href="#forum-reply-form">New Reply</a> • +{% else %} <a href="">New Reply</a> • +{% endif %} <a href="{% url forums-new_topic slug=forum.slug %}">New Topic</a> <table class="forum-topic"> {% for post in posts %} <tr class="forum-post"> <td class="forum-post-author"> + <a name="p{{ post.id }}"></a> <a href="{% url bio-view_profile username=post.user.username %}">{{ post.user.username }}</a><br /> {% avatar post.user %} </td> @@ -33,10 +38,11 @@ </tr> {% endfor %} </table> -{% if user.is_authenticated %} +{% if last_page and user.is_authenticated %} +<a name="forum-reply-form"></a> <form action="" method="post"> <fieldset> -<legend>Reply to Thread</legend> +<legend>Reply to "{{ topic.name }}"</legend> {{ form.as_p }} <input type="submit" value="Submit Reply" /> </fieldset>