From e462fad3676cebe1283d302f1c7daf28aa2f77e7 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Fri, 10 Aug 2012 18:15:21 -0400 Subject: [PATCH] Converted wiki edit page and breadcrumbs. --- .../mitxmako/mitxmako/templatetag_helpers.py | 5 ++ lms/templates/wiki/article.html | 46 +++++------ lms/templates/wiki/edit.html | 77 +++++++++++++++++++ lms/templates/wiki/includes/breadcrumbs.html | 47 +++++++++++ lms/urls.py | 2 + 5 files changed, 149 insertions(+), 28 deletions(-) create mode 100644 lms/templates/wiki/edit.html create mode 100644 lms/templates/wiki/includes/breadcrumbs.html diff --git a/common/lib/mitxmako/mitxmako/templatetag_helpers.py b/common/lib/mitxmako/mitxmako/templatetag_helpers.py index 0c66cea090..10c502fbfe 100644 --- a/common/lib/mitxmako/mitxmako/templatetag_helpers.py +++ b/common/lib/mitxmako/mitxmako/templatetag_helpers.py @@ -1,3 +1,4 @@ +from django.template import loader from django.template.base import Template, Context from django.template.loader import get_template, select_template @@ -21,3 +22,7 @@ def render_inclusion(func, file_name, *args, **kwargs): # 'use_tz': context.use_tz, # }) return nodelist.render(new_context) + +def django_template_include(file_name, mako_context): + dictionary = dict( mako_context ) + return loader.render_to_string(file_name, dictionary=dictionary) diff --git a/lms/templates/wiki/article.html b/lms/templates/wiki/article.html index bedeb368d0..3a2c9653fa 100644 --- a/lms/templates/wiki/article.html +++ b/lms/templates/wiki/article.html @@ -7,45 +7,35 @@ %> <%namespace name="article_menu" file="includes/article_menu.html"/> +<%namespace name="breadcrumbs" file="includes/breadcrumbs.html"/> <%block name="title">${article.current_revision.title} -<%doc> <%block name="wiki_breadcrumbs"> -Render "wiki/includes/breadcrumbs.html" -## {% include "wiki/includes/breadcrumbs.html" %} +${breadcrumbs.body(article, urlpath)} - - - <%block name="wiki_contents"> - -
- +
+ -
- ${ render_inclusion(wiki_render, 'wiki/includes/render.html', article ) } +
+ ${ render_inclusion(wiki_render, 'wiki/includes/render.html', article ) } +
-
- -
- <%doc> - - -
+
+ +
diff --git a/lms/templates/wiki/edit.html b/lms/templates/wiki/edit.html new file mode 100644 index 0000000000..6ee1490148 --- /dev/null +++ b/lms/templates/wiki/edit.html @@ -0,0 +1,77 @@ +## mako +<%inherit file="mako_base.html"/> + +<%! + from django.core.urlresolvers import reverse + from mitxmako.templatetag_helpers import django_template_include +%> + +<%namespace name="article_menu" file="includes/article_menu.html"/> +<%namespace name="breadcrumbs" file="includes/breadcrumbs.html"/> + + +<%block name="title">Edit: ${article.current_revision.title} + +<%block name="wiki_breadcrumbs"> +${breadcrumbs.body(article, urlpath)} + + + +<%block name="wiki_contents"> +
+ + +
+
+ ${django_template_include("wiki/includes/editor.html", context)} +
+ + + + + + Delete article + + +
+ + +
+ +
+
+ +
+ +
+ + + diff --git a/lms/templates/wiki/includes/breadcrumbs.html b/lms/templates/wiki/includes/breadcrumbs.html new file mode 100644 index 0000000000..3edd9bf0a8 --- /dev/null +++ b/lms/templates/wiki/includes/breadcrumbs.html @@ -0,0 +1,47 @@ +## mako +<%page args="article, urlpath" /> +<%! from django.core.urlresolvers import reverse %> + +%if urlpath: + +
+
+ + + + + +
+
+ +
+%endif \ No newline at end of file diff --git a/lms/urls.py b/lms/urls.py index 44523dd827..23852d00c1 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -152,6 +152,8 @@ if settings.WIKI_ENABLED: # ) urlpatterns += ( + #url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/wiki/', include('simplewiki.urls')), + url(r'wiki/', include(wiki_pattern())), url(r'^notify/', include(notify_pattern())), )