Skip to content

Commit

Permalink
Merge pull request openedx#471 from MITx/feature/bridger/new_wiki
Browse files Browse the repository at this point in the history
New wiki update
  • Loading branch information
cpennington committed Aug 21, 2012
2 parents b76a748 + 72a281a commit 50a570a
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 70 deletions.
4 changes: 2 additions & 2 deletions lms/djangoapps/course_wiki/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions lms/djangoapps/simplewiki/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,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'
Expand Down
1 change: 1 addition & 0 deletions lms/templates/simplewiki/simplewiki_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ <h1>${ wiki_article.title }</h1>
%else:
<input type="submit" id="submit_edit" name="edit" value="Save Changes" />
<input type="submit" id="submit_delete" name="delete" value="Delete article" />
%endif

<%include file="simplewiki_instructions.html"/>

Expand Down
34 changes: 11 additions & 23 deletions lms/templates/wiki/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
</style>
{% endaddtoblock %}

<p class="lead">
{% 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." %}
</p>

<form method="GET">
<div class="tab-content" style="overflow: visible;">
Expand All @@ -60,20 +63,14 @@
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" style="float: left;" href="#collapse{{ revision.revision_number }}" onclick="get_diff_json('{% url 'wiki:diff' revision.id %}', $('#collapse{{ revision.revision_number }}'))">
{{ 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 %}
<strong>*</strong>
{% endif %}
{% if revision.deleted %}
<span class="badge badge-important">{% trans "deleted" %}</span>
{% endif %}
{% if revision.previous_revision.deleted and not revision.deleted %}
<span class="badge badge-success">{% trans "restored" %}</span>
{% endif %}
<span class="icon-plus"></span>
{% include "wiki/includes/revision_info.html" with current_revision=article.current_revision %}
<div style="color: #CCC;">
<small>
{% if revision.user_message %}
{{ revision.user_message }}
{% elif revision.automatic_log %}
{{ revision.automatic_log }}
{% else %}
({% trans "no log message" %})
{% endif %}
Expand All @@ -84,21 +81,12 @@
<div class="bar" style="width: 100%;"></div>
</div>
<div class="pull-right" style="vertical-align: middle; margin: 8px 3px;">
{% if revision == article.current_revision %}
<a href="#" class="btn disabled">
<span class="icon-lock"></span>
{% trans "Preview this version" %}
</a>
{% else %}
{% if not revision == article.current_revision %}
<button type="submit" class="btn" onclick="$('#previewModal').modal('show'); this.form.target='previewWindow'; this.form.r.value='{{ revision.id }}'; this.form.action='{% url 'wiki:preview_revision' article.id %}'; $('#previewModal .switch-to-revision').attr('href', '{% url 'wiki:change_revision' path=urlpath.path article_id=article.id revision_id=revision.id %}')">
<span class="icon-eye-open"></span>
{% trans "Preview this version" %}
{% trans "Preview this revision" %}
</button>
{% endif %}
<a class="btn btn-info" href="#collapse{{ revision.revision_number }}" onclick="get_diff_json('{% url 'wiki:diff' revision_id=revision.id %}', $('#collapse{{ revision.revision_number }}'))">
<span class="icon-list-alt"></span>
{% trans "Show changes" %}
</a>

{% if article|can_write:user %}
<input type="radio"{% if revision == article.current_revision %} disabled="true"{% endif %} style="margin: 0 10px;" value="{{ revision.id }}" name="revision_id" switch-button-href="{% url 'wiki:change_revision' path=urlpath.path revision_id=revision.id %}" merge-button-href="{% url 'wiki:merge_revision_preview' article_id=article.id revision_id=revision.id %}" merge-button-commit-href="{% url 'wiki:merge_revision' path=urlpath.path article_id=article.id revision_id=revision.id %}" />
Expand Down Expand Up @@ -157,7 +145,7 @@
<input type="hidden" name="r" value="" />
<div class="modal hide fade" id="previewModal">
<div class="modal-body">
<iframe name="previewWindow" frameborder="0"></iframe>
<iframe name="previewWindow"></iframe>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-large" data-dismiss="modal">
Expand All @@ -184,7 +172,7 @@ <h1>{% trans "Merge with current" %}</h1>
<p class="lead"><span class="icon-info-sign"></span> {% trans "When you merge a revision with the current, all data will be retained from both versions and merged at its approximate location from each revision." %} <strong>{% trans "After this, it's important to do a manual review." %}</strong></p>
</div>
<div class="modal-body">
<iframe name="mergeWindow" frameborder="0"></iframe>
<iframe name="mergeWindow"></iframe>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-large" data-dismiss="modal">
Expand Down
66 changes: 26 additions & 40 deletions lms/templates/wiki/includes/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -1,52 +1,38 @@
{% load i18n %}{% load url from future %}
{% if urlpath %}
## mako
<%! from django.core.urlresolvers import reverse %>

%if urlpath is not Undefined and urlpath:
<header>
<ul class="breadcrumb pull-left" class="">
{% for ancestor in urlpath.get_ancestors.all %}
<li><a href="{% url 'wiki:get' path=ancestor.path %}">{{ ancestor.article.current_revision.title }}</a></li>
{% endfor %}
<li class="active"><a href="{% url 'wiki:get' path=urlpath.path %}">{{ article.current_revision.title }}</a></li>
<%
# The create button links to the highest ancestor we have edit priveleges to
create_article_root = None
%>
%for ancestor in urlpath.cached_ancestors:
<li><a href="${reverse('wiki:get', kwargs={'path' : ancestor.path})}">${ancestor.article.current_revision.title}</a></li>
<%
if not create_article_root and ancestor.article.can_write(user):
create_article_root = ancestor
%>
%endfor
<li class="active"><a href="${reverse('wiki:get', kwargs={'path' : urlpath.path})}">${article.current_revision.title}</a></li>
<%
if not create_article_root and urlpath.article.can_write(user):
create_article_root = urlpath
%>
</ul>


<div class="pull-left" style="margin-left: 10px;">
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#" style="padding: 7px;" title="{% trans "Sub-articles for" %} {{ article.current_revision.title }}">
<span class="icon-list"></span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
{% for child in children_slice %}
<li>
<a href="{% url 'wiki:get' path=child.path %}">
{{ child.article.current_revision.title }}
</a>
</li>
{% empty %}
<li><a href="#"><em>{% trans "No sub-articles" %}</em></a></li>
{% endfor %}
{% if children_slice_more %}
<li><a href="#"><em>{% trans "...and more" %}</em></a></li>
{% endif %}
<li class="divider"></li>
<li>
<a href="" onclick="alert('TODO')">{% trans "List sub-pages" %} &raquo;</a>
</li>
</ul>
</div>
</div>


<div class="global-functions pull-right">
<form class="search-wiki pull-left">
<!-- <form class="search-wiki pull-left">
<input type="search" placeholder="search wiki" />
</form>
<a class="add-article-btn btn pull-left" href="{% url 'wiki:create' path=urlpath.path %}" style="padding: 7px;">
</form> -->
%if create_article_root:
<a class="add-article-btn btn pull-left" href="${reverse('wiki:create', kwargs={'path' : create_article_root.path})}" style="padding: 7px;">
<span class="icon-plus"></span>
{% trans "Add article" %}
Add article
</a>
%endif
</div>
</header>

{% endif %}
%endif
18 changes: 18 additions & 0 deletions lms/templates/wiki/wiki-404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends "wiki/base.html" %}
{% load wiki_tags i18n %}
{% load url from future %}

{% block pagetitle %}{{ article.current_revision.title }}{% endblock %}

{% block wiki_breadcrumbs %}
{% include "wiki/includes/breadcrumbs.html" %}
{% endblock %}

{% block wiki_contents %}

<div class="missing-wrapper">
<p>This article was not found, and neither was the parent. <a href="#">Go back to the main wiki article.</a></p>
<button type="submit">Create a new article</button>
</div>

{% endblock %}
3 changes: 1 addition & 2 deletions repo-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +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/dementrock/pystache_custom.git#egg=pystache_custom
-e git://github.com/benjaoming/django-wiki.git@e237b2ac#egg=django-wiki
-e common/lib/capa
-e common/lib/xmodule

0 comments on commit 50a570a

Please sign in to comment.