Commit 6d7b4779 by Bridger Maxwell

Fixed wiki revision feed.

parent ac0a7768
......@@ -13,7 +13,7 @@ urlpatterns = patterns('',
url(r'^history' + article_slug + r'(?:/(?P<page>[0-9]+))?$', 'simplewiki.views.history', name='wiki_history'),
url(r'^search_related' + article_slug, 'simplewiki.views.search_add_related', name='search_related'),
url(r'^random/?$', 'simplewiki.views.random_article', name='wiki_random'),
url(r'^revision_feed/([0-9]+)$', 'simplewiki.views.revision_feed', name='wiki_revision_feed'),
url(r'^revision_feed' + namespace + r'/(?P<page>[0-9]+)?$', 'simplewiki.views.revision_feed', name='wiki_revision_feed'),
url(r'^search' + namespace + r'?$', 'simplewiki.views.search_articles', name='wiki_search_articles'),
url(r'^list' + namespace + r'?$', 'simplewiki.views.search_articles', name='wiki_list_articles'), #Just an alias for the search, but you usually don't submit a search term
)
......@@ -296,9 +296,13 @@ def history(request, article_path, page=1, course_id=None):
return render_to_response('simplewiki/simplewiki_history.html', d)
def revision_feed(request, page=1):
def revision_feed(request, page=1, namespace=None, course_id=None):
course = get_course(course_id)
page_size = 10
if page == None:
page = 1
try:
p = int(page)
except ValueError:
......@@ -318,9 +322,10 @@ def revision_feed(request, page=1):
'wiki_next_page': next_page,
'wiki_prev_page': prev_page,
'wiki_history': history[beginItem:beginItem+page_size],
'show_delete_revision' : request.user.is_superuser,}
d.update(csrf(request))
'show_delete_revision' : request.user.is_superuser,
'namespace' : namespace}
update_template_dictionary(d, request, course)
return render_to_response('simplewiki/simplewiki_revision_feed.html', d)
def search_articles(request, namespace=None, course_id = None):
......
......@@ -5,7 +5,7 @@
<%block name="title"><title>Wiki - Revision feed - MITx 6.002x</title></%block>
<%!
from django.core.urlresolvers import reverse
from simplewiki.views import wiki_reverse
%>
<%block name="wiki_page_title">
......@@ -29,7 +29,7 @@
<% loopCount += 1 %>
<tr style="border-top: 1px" class="${'dark ' if (loopCount % 2) == 0 else ''}${'deleted ' if (revision.deleted==2) else ''}" >
<td width="15px">
<a href="${reverse('wiki_view_revision',args=[revision.counter, revision.article.get_url()])}"> ${revision.article.title} - ${revision}</a>
<a href="${wiki_reverse('wiki_view_revision', revision.article, course, kwargs={'revision_number' : revision.counter})}"> ${revision.article.title} - ${revision}</a>
</td>
<td>
${ revision.revision_text if revision.revision_text else "<i>None</i>" }</td>
......@@ -50,10 +50,10 @@
<tr>
<td colspan="4">
%if wiki_prev_page:
<a href="${reverse("wiki_revision_feed", args=[wiki_prev_page])}">Previous page</a>
<a href="${wiki_reverse("wiki_revision_feed", course=course, namespace=namespace, kwargs={'page': wiki_prev_page})}">Previous page</a>
%endif
%if wiki_next_page:
<a href="${reverse("wiki_revision_feed", args=[wiki_next_page])}">Next page</a>
<a href="${wiki_reverse("wiki_revision_feed", course=course, namespace=namespace, kwargs={'page': wiki_next_page})}">Next page</a>
%endif
</td>
</tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment