From 779281a70381062a70f3991a75e887545a397ecc Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Sun, 19 Aug 2012 17:37:58 -0400 Subject: [PATCH 1/9] Updated to use django-wiki with significantly less sql queries. --- lms/envs/common.py | 1 + lms/templates/wiki/includes/breadcrumbs.html | 2 +- requirements.txt | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lms/envs/common.py b/lms/envs/common.py index 94c39d2f8139..cda3a5a8b15f 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -301,6 +301,7 @@ ################################# WIKI ################################### WIKI_ACCOUNT_HANDLING = False WIKI_EDITOR = 'course_wiki.editors.CodeMirror' +WIKI_SHOW_MAX_CHILDREN = 0 # We don't use the little menu that shows children of an article in the breadcrumb ################################# Jasmine ################################### JASMINE_TEST_DIRECTORY = PROJECT_ROOT + '/static/coffee' diff --git a/lms/templates/wiki/includes/breadcrumbs.html b/lms/templates/wiki/includes/breadcrumbs.html index 6afe248a2919..6eb4a1eb896a 100644 --- a/lms/templates/wiki/includes/breadcrumbs.html +++ b/lms/templates/wiki/includes/breadcrumbs.html @@ -3,7 +3,7 @@
-
+ %if create_article_root: From b2ebd6573b61be79936c6119acf1c04801d40e38 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Sun, 19 Aug 2012 19:57:19 -0400 Subject: [PATCH 4/9] Got simplewiki just cleaned up enough to work again, so I could view a page for reference. --- lms/djangoapps/simplewiki/views.py | 6 +++--- lms/templates/simplewiki/simplewiki_edit.html | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/simplewiki/views.py b/lms/djangoapps/simplewiki/views.py index ac807b13ed6d..ef0928709fef 100644 --- a/lms/djangoapps/simplewiki/views.py +++ b/lms/djangoapps/simplewiki/views.py @@ -39,7 +39,7 @@ def update_template_dictionary(dictionary, request=None, course=None, article=No if course: dictionary['course'] = course if 'namespace' not in dictionary: - dictionary['namespace'] = course.wiki_namespace + dictionary['namespace'] = "edX" else: dictionary['course'] = None @@ -99,7 +99,7 @@ def root_redirect(request, course_id=None): course = get_opt_course_with_access(request.user, course_id, 'load') #TODO: Add a default namespace to settings. - namespace = course.wiki_namespace if course else "edX" + namespace = "edX" try: root = Article.get_root(namespace) @@ -479,7 +479,7 @@ def not_found(request, article_path, course): """Generate a NOT FOUND message for some URL""" d = {'wiki_err_notfound': True, 'article_path': article_path, - 'namespace': course.wiki_namespace} + 'namespace': "edX"} update_template_dictionary(d, request, course) return render_to_response('simplewiki/simplewiki_error.html', d) diff --git a/lms/templates/simplewiki/simplewiki_edit.html b/lms/templates/simplewiki/simplewiki_edit.html index 856dfb9cc8d6..0381a21857df 100644 --- a/lms/templates/simplewiki/simplewiki_edit.html +++ b/lms/templates/simplewiki/simplewiki_edit.html @@ -69,6 +69,7 @@

${ wiki_article.title }

%else: + %endif <%include file="simplewiki_instructions.html"/> From b68461153eac913142105f9c075a405ccf0f24b8 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Sun, 19 Aug 2012 21:19:08 -0400 Subject: [PATCH 5/9] Changed default title and content of course wiki page. --- lms/djangoapps/course_wiki/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/course_wiki/views.py b/lms/djangoapps/course_wiki/views.py index b1d9f1cf2649..cfe802bbd744 100644 --- a/lms/djangoapps/course_wiki/views.py +++ b/lms/djangoapps/course_wiki/views.py @@ -80,8 +80,8 @@ def course_wiki_redirect(request, course_id): urlpath = URLPath.create_article( root, course_slug, - title=course.title, - content="This is the wiki for " + course.title + ".", + title=course.number, + content="{0}\n===\nThis is the wiki for **{1}**'s _{2}_.".format(course.number, course.org, course.title), user_message="Course page automatically created.", user=None, ip_address=None, From d4422fcf3c8e10c7bf5f27c2fe6ee836273a74c1 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Mon, 20 Aug 2012 16:24:12 -0400 Subject: [PATCH 6/9] Fixed bug in breadcrumbs. --- lms/templates/wiki/includes/breadcrumbs.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lms/templates/wiki/includes/breadcrumbs.html b/lms/templates/wiki/includes/breadcrumbs.html index 6fe955212eaa..053bc2400e5d 100644 --- a/lms/templates/wiki/includes/breadcrumbs.html +++ b/lms/templates/wiki/includes/breadcrumbs.html @@ -16,6 +16,10 @@ %> %endfor
  • ${article.current_revision.title}
  • + <% + if not create_article_root and urlpath.article.can_write(user): + create_article_root = urlpath + %>
    From 732166ab06c4f44c721b994d5dca309cfa3e5201 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Mon, 20 Aug 2012 16:51:39 -0400 Subject: [PATCH 7/9] Updated django-wiki version. --- repo-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repo-requirements.txt b/repo-requirements.txt index 9dc4629b49d6..5b5003403973 100644 --- a/repo-requirements.txt +++ b/repo-requirements.txt @@ -1,5 +1,5 @@ -e git://github.com/MITx/django-staticfiles.git@6d2504e5c8#egg=django-staticfiles -e git://github.com/MITx/django-pipeline.git#egg=django-pipeline --e git://github.com/benjaoming/django-wiki.git@c145596#egg=django-wiki +-e git://github.com/benjaoming/django-wiki.git@e237b2ac#egg=django-wiki -e common/lib/capa -e common/lib/xmodule From 0d6ab42321c898019f0a2261f1899a99dd6772b8 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Mon, 20 Aug 2012 17:23:39 -0400 Subject: [PATCH 8/9] Removed inactive 'view this revision' button from history page. --- lms/templates/wiki/history.html | 34 +++++++++++---------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/lms/templates/wiki/history.html b/lms/templates/wiki/history.html index 0c120d5c547f..60fe0deadeb5 100644 --- a/lms/templates/wiki/history.html +++ b/lms/templates/wiki/history.html @@ -52,6 +52,9 @@ {% endaddtoblock %} +

    + {% trans "Click each revision to see a list of edited lines. Click the Preview button to see how the article looked at this stage. At the bottom of this page, you can change to a particular revision or merge an old revision with the current one." %} +

    @@ -60,20 +63,14 @@
    - {{ revision.created }} (#{{ revision.revision_number }}) by {% if revision.user %}{{ revision.user }}{% else %}{% if user|is_moderator %}{{ revision.ip_address|default:"anonymous (IP not logged)" }}{% else %}{% trans "anonymous (IP logged)" %}{% endif %}{% endif %} - {% if revision == article.current_revision %} - * - {% endif %} - {% if revision.deleted %} - {% trans "deleted" %} - {% endif %} - {% if revision.previous_revision.deleted and not revision.deleted %} - {% trans "restored" %} - {% endif %} + + {% include "wiki/includes/revision_info.html" with current_revision=article.current_revision %}
    {% if revision.user_message %} {{ revision.user_message }} + {% elif revision.automatic_log %} + {{ revision.automatic_log }} {% else %} ({% trans "no log message" %}) {% endif %} @@ -84,21 +81,12 @@
    - {% if revision == article.current_revision %} - - - {% trans "Preview this version" %} - - {% else %} + {% if not revision == article.current_revision %} {% endif %} - - - {% trans "Show changes" %} - {% if article|can_write:user %} @@ -157,7 +145,7 @@