Commit 45f516cd by Calen Pennington

Merge pull request #493 from MITx/feature/bridger/new_wiki

Feature/bridger/new wiki
parents 2eb3f376 14382702
...@@ -5,6 +5,7 @@ from django.http import Http404 ...@@ -5,6 +5,7 @@ from django.http import Http404
from django.shortcuts import redirect from django.shortcuts import redirect
from wiki.models import reverse as wiki_reverse from wiki.models import reverse as wiki_reverse
from courseware.access import has_access
from courseware.courses import get_course_with_access from courseware.courses import get_course_with_access
...@@ -135,7 +136,9 @@ def context_processor(request): ...@@ -135,7 +136,9 @@ def context_processor(request):
try: try:
course = get_course_with_access(request.user, course_id, 'load') course = get_course_with_access(request.user, course_id, 'load')
return {'course' : course} staff_access = has_access(request.user, course, 'staff')
return {'course' : course,
'staff_access': staff_access}
except Http404: except Http404:
# We couldn't access the course for whatever reason. It is too late to change # We couldn't access the course for whatever reason. It is too late to change
# the URL here, so we just leave the course context. The middleware shouldn't # the URL here, so we just leave the course context. The middleware shouldn't
......
...@@ -81,7 +81,7 @@ def course_wiki_redirect(request, course_id): ...@@ -81,7 +81,7 @@ def course_wiki_redirect(request, course_id):
root, root,
course_slug, course_slug,
title=course.number, title=course.number,
content="{0}\n===\nThis is the wiki for **{1}**'s _{2}_.".format(course.number, course.org, course.title), content="This is the wiki for **{0}**'s _{1}_.".format(course.org, course.title),
user_message="Course page automatically created.", user_message="Course page automatically created.",
user=None, user=None,
ip_address=None, ip_address=None,
...@@ -114,7 +114,7 @@ def get_or_create_root(): ...@@ -114,7 +114,7 @@ def get_or_create_root():
"===", "===",
"Visit a course wiki to add an article.")) "Visit a course wiki to add an article."))
root = URLPath.create_root(title="edX Wiki", root = URLPath.create_root(title="Wiki",
content=starting_content) content=starting_content)
article = root.article article = root.article
article.group = None article.group = None
......
...@@ -318,6 +318,7 @@ WIKI_ACCOUNT_HANDLING = False ...@@ -318,6 +318,7 @@ WIKI_ACCOUNT_HANDLING = False
WIKI_EDITOR = 'course_wiki.editors.CodeMirror' 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 WIKI_SHOW_MAX_CHILDREN = 0 # We don't use the little menu that shows children of an article in the breadcrumb
WIKI_ANONYMOUS = False # Don't allow anonymous access until the styling is figured out WIKI_ANONYMOUS = False # Don't allow anonymous access until the styling is figured out
WIKI_CAN_CHANGE_PERMISSIONS = lambda article, user: user.has_perm('wiki.assign')
################################# Jasmine ################################### ################################# Jasmine ###################################
JASMINE_TEST_DIRECTORY = PROJECT_ROOT + '/static/coffee' JASMINE_TEST_DIRECTORY = PROJECT_ROOT + '/static/coffee'
......
...@@ -784,6 +784,39 @@ section.wiki { ...@@ -784,6 +784,39 @@ section.wiki {
text-decoration: none; text-decoration: none;
} }
} }
.missing {
max-width: 400px;
margin: lh(2) auto;
display: block;
overflow: hidden;
background: $pink;
padding: lh();
@include box-shadow(inset 0 0 0 1px lighten($pink, 10%));
border: 1px solid darken($pink, 15%);
p {
color: #fff;
a {
display: block;
background: darken($pink, 8%);
margin: lh() (-(lh())) (-(lh()));
padding: lh();
border-top: 1px solid darken($pink, 15%);
color: #fff;
font-weight: bold;
font-size: em(18);
@include transition;
text-align: center;
-webkit-font-smoothing: antialiased;
&:hover {
background: darken($pink, 12%);
}
}
}
}
} }
.modal-backdrop { .modal-backdrop {
......
...@@ -14,7 +14,14 @@ ...@@ -14,7 +14,14 @@
<article class="main-article"> <article class="main-article">
{% if selected_tab != "edit" %} {% if selected_tab != "edit" %}
<h1>{{ article.current_revision.title }}</h1> <h1>{{ article.current_revision.title }}</h1>
{% comment %}
This has been disabled until we can style it.
{% if urlpath %}
<a href="{% url 'wiki:dir' path=urlpath.path %}">Show all children</a>
{% endif %}
{% endcomment %}
{% endif %} {% endif %}
{% block wiki_contents_tab %} {% block wiki_contents_tab %}
......
{% extends "wiki/base.html" %}
{% load wiki_tags i18n sekizai_tags %}
{% load url from future %}
{% block pagetitle %}{% trans "Delete article" %}{% endblock %}
{% block wiki_contents %}
<h1 class="page-header">{% trans "Delete" %} "{{ article.current_revision.title }}"</h1>
{% if cannot_delete_root %}
<p class="lead">{% trans "You cannot delete a root article." %}</p>
<p><a href="{% url 'wiki:get' path=urlpath.path article_id=article.id %}">{% trans "Go back" %}</a></p>
{% else %}
{% if cannot_delete_children %}
<p class="alert alert-error"><strong>{% trans "You cannot delete this article because you do not have permission to delete articles with children. Try to remove the children manually one-by-one." %}</strong></p>
{% endif %}
{% if delete_children %}
<p class="lead">{% trans "You are deleting an article. This means that its children will be deleted as well. If you choose to purge, children will also be purged!" %}</p>
<h2>{% trans "Articles that will be deleted" %}</h2>
<ul>
{% for child in delete_children %}
<li><a href="{% url 'wiki:get' article_id=child.article.id %}" target="_blank">{{ child.article }}</a></li>
{% if delete_children_more %}
<li><em>{% trans "...and more!" %}</em></li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% if not cannot_delete_children %}
<p class="lead">{% trans "You are deleting an article. Please confirm." %}</p>
<form method="POST" class="form-horizontal">
{% wiki_form delete_form %}
<script type="text/javascript">
$('#id_revision').val('{{ article.current_revision.id }}');
</script>
<div class="form-actions">
<a href="{% url 'wiki:get' path=urlpath.path article_id=article.id %}" class="btn btn-large">
<span class="icon-circle-arrow-left"></span>
{% trans "Go back" %}
</a>
<button type="submit" name="save_changes" class="btn btn-danger btn-large">
<span class="icon-plus"></span>
{% trans "Delete article" %}
</button>
</div>
</form>
{% endif %}
{% endif %}
{% endblock %}
...@@ -35,6 +35,10 @@ ...@@ -35,6 +35,10 @@
%endif %endif
%endfor %endfor
<%doc>
The settings link has been disabled because the notifications app hasn't been integrated yet and those are the only useful settings.
%if not user.is_anonymous(): %if not user.is_anonymous():
<li class="${"active" if selected_tab == "settings" else ""}"> <li class="${"active" if selected_tab == "settings" else ""}">
<a href="${reverse('wiki:settings', kwargs={'article_id' : article.id, 'path' : urlpath.path})}"> <a href="${reverse('wiki:settings', kwargs={'article_id' : article.id, 'path' : urlpath.path})}">
...@@ -43,4 +47,6 @@ ...@@ -43,4 +47,6 @@
</a> </a>
</li> </li>
%endif %endif
</%doc>
...@@ -115,7 +115,13 @@ ...@@ -115,7 +115,13 @@
{% if attachment.current_revision.user %}{{ attachment.current_revision.user }}{% else %}{% if user|is_moderator %}{{ attachment.current_revision.ip_address|default:"anonymous (IP not logged)" }}{% else %}{% trans "anonymous (IP logged)" %}{% endif %}{% endif %} {% if attachment.current_revision.user %}{{ attachment.current_revision.user }}{% else %}{% if user|is_moderator %}{{ attachment.current_revision.ip_address|default:"anonymous (IP not logged)" }}{% else %}{% trans "anonymous (IP logged)" %}{% endif %}{% endif %}
</td> </td>
<td>{{ attachment.current_revision.get_size|filesizeformat }}</td> <td>{{ attachment.current_revision.get_size|filesizeformat }}</td>
<td>{{ attachment.attachmentrevision_set.all.count }} {% trans "revisions" %}</td>
<td>
<a href="{% url 'wiki:attachments_history' path=urlpath.path article_id=article.id attachment_id=attachment.id %}">
<span class="icon-time"></span>
{% trans "File history" %} ({{ attachment.attachmentrevision_set.all.count }} {% trans "revisions" %})
</a>
</td>
</tr> </tr>
</table> </table>
</div> </div>
......
...@@ -10,22 +10,31 @@ ...@@ -10,22 +10,31 @@
<div class="main-article"> <div class="main-article">
{% if revision %} {% if revision %}
<div class="alert alert-info"> <div class="alert alert-info">
<strong>{% trans "Previewing revision" %}:</strong> {{ 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 %} <strong>{% trans "Previewing revision" %}:</strong>
{% include "wiki/includes/revision_info.html" %}
</div> </div>
{% endif %} {% endif %}
{% if merge %} {% if merge %}
<div class="alert alert-info"> <div class="alert alert-info">
<strong>{% trans "Previewing merge between" %}:</strong> <strong>{% trans "Previewing merge between" %}:</strong>
{{ merge1.created }} (#{{ merge1.revision_number }}) by {% if merge1.user %}{{ merge1.user }}{% else %}{% if user|is_moderator %}{{ merge1.ip_address|default:"anonymous (IP not logged)" }}{% else %}{% trans "anonymous (IP logged)" %}{% endif %}{% endif %} {% include "wiki/includes/revision_info.html" with revision=merge1 %}
<strong>{% trans "and" %}</strong> <strong>{% trans "and" %}</strong>
{{ merge1.created }} (#{{ merge1.revision_number }}) by {% if merge1.user %}{{ merge1.user }}{% else %}{% if user|is_moderator %}{{ merge1.ip_address|default:"anonymous (IP not logged)" }}{% else %}{% trans "anonymous (IP logged)" %}{% endif %}{% endif %} {% include "wiki/includes/revision_info.html" with revision=merge2 %}
</div> </div>
{% endif %} {% endif %}
<h1 class="page-header">{{ title }}</h1> <h1 class="page-header">{{ title }}</h1>
{% wiki_render article content %} {% if revision and revision.deleted %}
<div class="warning">
<strong>This revision has been deleted.</strong>
<p>Restoring to this revision will mark the article as deleted.</p>
</div>
{% else %}
{% wiki_render article content %}
{% endif %}
</div> </div>
</section> </section>
......
{% extends "wiki/base.html" %}
{% load wiki_tags i18n %}
{% load url from future %}
{% block pagetitle %}{% trans "Settings" %}: {{ article.current_revision.title }}{% endblock %}
{% block wiki_breadcrumbs %}
{% include "wiki/includes/breadcrumbs.html" %}
{% endblock %}
{% block wiki_contents %}
<div class="article-wrapper">
<article class="main-article">
{% if selected_tab != "edit" %}
<h1>{{ article.current_revision.title }}</h1>
{% endif %}
{% for form in forms %}
<form method="POST" class="form-horizontal" id="settings_form" action="?f={{form.action}}">
<h2>{{ form.settings_form_headline }}</h2>
<div class="well">
{% wiki_form form %}
</div>
<div class="form-actions">
<button type="submit" name="save" value="1" class="btn btn-large btn-primary">
<span class="icon-ok"></span>
{% trans "Save changes" %}
</button>
</div>
</form>
{% endfor %}
</article>
<div class="article-functions">
<ul class="nav nav-tabs">
{% with "settings" as selected %}
{% include "wiki/includes/article_menu.html" %}
{% endwith %}
</ul>
<div class="timestamp">
<span class="label">{% trans "Last modified:" %}</span><br />
<span class="date">{{ article.current_revision.modified }}</span>
</div>
</div>
</div>
{% endblock %}
{% 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 %}
-e git://github.com/MITx/django-staticfiles.git@6d2504e5c8#egg=django-staticfiles -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/MITx/django-pipeline.git#egg=django-pipeline
-e git://github.com/benjaoming/django-wiki.git@02275fb4#egg=django-wiki -e git://github.com/benjaoming/django-wiki.git@63003aa#egg=django-wiki
-e git://github.com/dementrock/pystache_custom.git@776973740bdaad83a3b029f96e415a7d1e8bec2f#egg=pystache_custom-dev -e git://github.com/dementrock/pystache_custom.git@776973740bdaad83a3b029f96e415a7d1e8bec2f#egg=pystache_custom-dev
-e common/lib/capa -e common/lib/capa
-e common/lib/xmodule -e common/lib/xmodule
...@@ -2,7 +2,7 @@ django>=1.4,<1.5 ...@@ -2,7 +2,7 @@ django>=1.4,<1.5
pip pip
numpy numpy
scipy scipy
markdown Markdown<2.3.0
pygments pygments
lxml lxml
boto boto
...@@ -43,5 +43,7 @@ django-ses ...@@ -43,5 +43,7 @@ django-ses
django-storages django-storages
django-threaded-multihost django-threaded-multihost
django-sekizai<0.7 django-sekizai<0.7
django-mptt>=0.5.3
sorl-thumbnail
networkx networkx
-r repo-requirements.txt -r repo-requirements.txt
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