Converted wiki edit page and breadcrumbs.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -7,45 +7,35 @@
|
||||
%>
|
||||
|
||||
<%namespace name="article_menu" file="includes/article_menu.html"/>
|
||||
<%namespace name="breadcrumbs" file="includes/breadcrumbs.html"/>
|
||||
|
||||
|
||||
<%block name="title"><title>${article.current_revision.title}</title></%block>
|
||||
|
||||
|
||||
<%doc>
|
||||
<%block name="wiki_breadcrumbs">
|
||||
Render "wiki/includes/breadcrumbs.html"
|
||||
## {% include "wiki/includes/breadcrumbs.html" %}
|
||||
${breadcrumbs.body(article, urlpath)}
|
||||
</%block>
|
||||
</%doc>
|
||||
|
||||
|
||||
|
||||
<%block name="wiki_contents">
|
||||
|
||||
<div class="tabbable tabs-top" style="margin-top: 20px;">
|
||||
<ul class="nav nav-tabs">
|
||||
<li style="float: left">
|
||||
<h1 style="margin-top: -10px;">${article.current_revision.title}</h1>
|
||||
</li>
|
||||
${article_menu.body('view', article, plugins)}
|
||||
</ul>
|
||||
<div class="tabbable tabs-top" style="margin-top: 20px;">
|
||||
<ul class="nav nav-tabs">
|
||||
<li style="float: left">
|
||||
<h1 style="margin-top: -10px;">${article.current_revision.title}</h1>
|
||||
</li>
|
||||
${article_menu.body('view', article, plugins)}
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
${ render_inclusion(wiki_render, 'wiki/includes/render.html', article ) }
|
||||
<div class="tab-content">
|
||||
${ render_inclusion(wiki_render, 'wiki/includes/render.html', article ) }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tabbable tabs-below" style="margin-top: 20px;">
|
||||
<%doc>
|
||||
<ul class="nav nav-tabs">
|
||||
{% with "view" as selected %}
|
||||
{% include "wiki/includes/article_menu.html" %}
|
||||
{% endwith %}
|
||||
<li style="margin-top: 10px;"><em>{% trans "Article last modified:" %} {{ article.current_revision.modified }}</em></li>
|
||||
</ul>
|
||||
</%doc>
|
||||
</div>
|
||||
|
||||
<div class="tabbable tabs-below" style="margin-top: 20px;">
|
||||
<ul class="nav nav-tabs">
|
||||
${article_menu.body('view', article, plugins)}
|
||||
<li style="margin-top: 10px;"><em>Article last modified: ${ article.current_revision.modified }</em></li>
|
||||
</ul>
|
||||
</div>
|
||||
</%block>
|
||||
|
||||
|
||||
77
lms/templates/wiki/edit.html
Normal file
77
lms/templates/wiki/edit.html
Normal file
@@ -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"><title>Edit: ${article.current_revision.title}</title></%block>
|
||||
|
||||
<%block name="wiki_breadcrumbs">
|
||||
${breadcrumbs.body(article, urlpath)}
|
||||
</%block>
|
||||
|
||||
|
||||
<%block name="wiki_contents">
|
||||
<div class="tabbable tabs-top" style="margin-top: 20px;">
|
||||
<ul class="nav nav-tabs">
|
||||
<li style="float: left">
|
||||
<h1 style="margin-top: -10px;">${article.current_revision.title}</h1>
|
||||
</li>
|
||||
${article_menu.body('edit', article, plugins)}
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<form method="POST" class="form-horizontal">
|
||||
${django_template_include("wiki/includes/editor.html", context)}
|
||||
<div class="form-actions">
|
||||
<button type="submit" name="preview" value="1" class="btn btn-large" onclick="$('#previewModal').modal('show'); this.form.target='previewWindow'; this.form.action='${reverse('wiki:preview_url', kwargs={'path' : urlpath.path})}'">
|
||||
<span class="icon-eye-open"></span>
|
||||
Preview
|
||||
</button>
|
||||
<button type="submit" name="save" value="1" class="btn btn-large btn-primary" onclick="this.form.target=''; this.form.action='${reverse('wiki:edit_url', kwargs={'path' : urlpath.path})}'">
|
||||
<span class="icon-ok"></span>
|
||||
Save changes
|
||||
</button>
|
||||
|
||||
<a class="pull-right btn btn-danger">
|
||||
<span class="icon-trash"></span>
|
||||
Delete article
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="modal hide fade" id="previewModal" style="width: 80%; min-height: 500px; margin-left: -40%;">
|
||||
<div class="modal-body">
|
||||
<iframe name="previewWindow" style="width: 100%; min-height: 400px; border: 0;" frameborder="0"></iframe>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn btn-large" data-dismiss="modal">
|
||||
<span class="icon-circle-arrow-left"></span>
|
||||
Back to editor
|
||||
</a>
|
||||
<button type="submit" name="save" value="1" class="btn btn-large btn-primary" onclick="this.form.target=''; this.form.action='${reverse('wiki:edit_url', kwargs={'path' : urlpath.path})}'">
|
||||
<span class="icon-ok"></span>
|
||||
Save changes
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tabbable tabs-below" style="margin-top: 20px;">
|
||||
<ul class="nav nav-tabs">
|
||||
${article_menu.body('edit', article, plugins)}
|
||||
<li style="margin-top: 10px;"><em>Article last modified: ${ article.current_revision.modified }</em></li>
|
||||
</ul>
|
||||
</div>
|
||||
</%block>
|
||||
|
||||
|
||||
47
lms/templates/wiki/includes/breadcrumbs.html
Normal file
47
lms/templates/wiki/includes/breadcrumbs.html
Normal file
@@ -0,0 +1,47 @@
|
||||
## mako
|
||||
<%page args="article, urlpath" />
|
||||
<%! from django.core.urlresolvers import reverse %>
|
||||
|
||||
%if urlpath:
|
||||
<ul class="breadcrumb pull-left" class="">
|
||||
%for ancestor in urlpath.get_ancestors():
|
||||
<span class="divider">/</span>
|
||||
<li><a href="${reverse('wiki:get_url', ancestor.path)}">${ ancestor.article.current_revision.title }</a></li>
|
||||
%endfor
|
||||
<span class="divider">/</span>
|
||||
<li class="active"><a href="${reverse('wiki:get_url', kwargs={'path' : urlpath.path})}">${ article.current_revision.title }</a></li>
|
||||
<span class="divider">/</span>
|
||||
</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="Sub-articles for ${ article.current_revision.title }">
|
||||
<span class="icon-list"></span>
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
%if len(urlpath.get_children()) > 0:
|
||||
%for child in urlpath.get_children():
|
||||
<li>
|
||||
<a href="${reverse('wiki:get_url', child.path)}">
|
||||
${child.article.current_revision.title}
|
||||
</a>
|
||||
</li>
|
||||
%endfor
|
||||
%else:
|
||||
<li><a href="#"><em>No sub-articles</em></a></li>
|
||||
%endif
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<a href="" onclick="alert('TODO')">List sub-pages »</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-left" style="margin-left: 10px;">
|
||||
<a class="btn" href="${reverse('wiki:create_url', kwargs={'path' : urlpath.path})}" style="padding: 7px;">
|
||||
<span class="icon-plus"></span>
|
||||
Add article
|
||||
</a>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
%endif
|
||||
@@ -152,6 +152,8 @@ if settings.WIKI_ENABLED:
|
||||
# )
|
||||
urlpatterns += (
|
||||
|
||||
#url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/wiki/', include('simplewiki.urls')),
|
||||
|
||||
url(r'wiki/', include(wiki_pattern())),
|
||||
url(r'^notify/', include(notify_pattern())),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user