Commit d7351905 by Calen Pennington

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

Added optional <wiki> tag to course to specify an alternative wiki page.
parents 45f516cd 1277c5f8
......@@ -60,6 +60,8 @@ class CourseDescriptor(SequenceDescriptor):
def __init__(self, system, definition=None, **kwargs):
super(CourseDescriptor, self).__init__(system, definition, **kwargs)
self.textbooks = self.definition['data']['textbooks']
self.wiki_slug = self.definition['data']['wiki_slug'] or self.location.course
msg = None
if self.start is None:
......@@ -94,8 +96,19 @@ class CourseDescriptor(SequenceDescriptor):
for textbook in xml_object.findall("textbook"):
textbooks.append(cls.Textbook.from_xml_object(textbook))
xml_object.remove(textbook)
#Load the wiki tag if it exists
wiki_slug = None
wiki_tag = xml_object.find("wiki")
if wiki_tag is not None:
wiki_slug = wiki_tag.attrib.get("slug", default=None)
xml_object.remove(wiki_tag)
definition = super(CourseDescriptor, cls).definition_from_xml(xml_object, system)
definition.setdefault('data', {})['textbooks'] = textbooks
definition['data']['wiki_slug'] = wiki_slug
return definition
def has_started(self):
......@@ -206,10 +219,6 @@ class CourseDescriptor(SequenceDescriptor):
return self.location.course
@property
def wiki_slug(self):
return self.location.course
@property
def org(self):
return self.location.org
......@@ -80,7 +80,7 @@ def course_wiki_redirect(request, course_id):
urlpath = URLPath.create_article(
root,
course_slug,
title=course.number,
title=course_slug,
content="This is the wiki for **{0}**'s _{1}_.".format(course.org, course.title),
user_message="Course page automatically created.",
user=None,
......
......@@ -199,6 +199,17 @@ section.wiki {
font-size: 0.9em;
font-family: Monaco, monospace;
}
.toc {
background-color: $sidebar-color;
padding: 9px;
margin: 10px 0;
@include border-radius(5px);
ul {
margin: 0;
}
}
}
......@@ -216,7 +227,7 @@ section.wiki {
padding: 40px 40px;
@include box-sizing(border-box);
.timestamp {
.timestamp{
margin-top: 15px;
padding: 15px 0 0 10px;
border-top: 1px solid $light-gray;
......@@ -230,6 +241,26 @@ section.wiki {
.date {
font-size: 0.9em;
}
}
.see-children {
padding: 15px 0 0;
border-top: 1px solid $light-gray;
margin-top: 15px;
a {
display: block;
padding: 2px 4px 2px 10px;
border-radius: 3px;
font-size: 0.9em;
line-height: 25px;
&:hover {
background-color: #f6f6f6;
text-decoration: none;
}
}
}
}
......@@ -659,6 +690,59 @@ section.wiki {
margin-top: 9px;
}
/*-----------------
Directory
-----------------*/
.directory-toolbar {
background-color: $sidebar-color;
padding: 9px;
margin: 0 -9px 20px;
@include border-radius(5px);
.well-small {
@include clearfix;
a {
@include inline-block;
}
}
+ p {
font-size: 0.9em;
color: #aaa;
}
}
.filter-clear {
margin-right: 10px;
margin-top: 10px;
font-size: .9em;
a {
color: #aaa;
&:hover {
color: #777;
}
}
}
.table.table-striped {
width: 100%;
margin-top: 20px;
th, td {
border-bottom: 1px solid $light-gray;
padding: 8px;
}
tr:nth-child(even) {
background: #F6F6F6;
}
}
......
......@@ -11,25 +11,19 @@
{% block wiki_contents %}
<div class="article-wrapper">
<article class="main-article">
{% if selected_tab != "edit" %}
<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 %}
{% block wiki_contents_tab %}
{% wiki_render article %}
{% endblock %}
{% endblock %}
</article>
<div class="article-functions">
<div class="article-functions">
<ul class="nav nav-tabs">
{% include "wiki/includes/article_menu.html" %}
</ul>
......@@ -37,6 +31,12 @@
<span class="label">{% trans "Last modified:" %}</span><br />
<span class="date">{{ article.current_revision.modified }}</span>
</div>
{% if urlpath %}
<div class="see-children">
<a href="{% url 'wiki:dir' path=urlpath.path %}">See all children</a>
</div>
{% endif %}
</div>
</div>
......
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