Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
3f4c4d74
Commit
3f4c4d74
authored
Aug 10, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Got most of the wiki article page working. It shows the article menu now.
parent
45baccae
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
157 additions
and
39 deletions
+157
-39
common/lib/mitxmako/mitxmako/template.py
+1
-1
common/lib/mitxmako/mitxmako/templatetag_helpers.py
+23
-0
lms/templates/wiki/article.html
+41
-38
lms/templates/wiki/includes/article_menu.html
+51
-0
lms/templates/wiki/mako_base.html
+41
-0
No files found.
common/lib/mitxmako/mitxmako/template.py
View file @
3f4c4d74
...
...
@@ -20,7 +20,7 @@ from mitxmako import middleware
django_variables
=
[
'lookup'
,
'output_encoding'
,
'module_directory'
,
'encoding_errors'
]
# TODO: We should make this a Django Template subclass that simply has the MakoTemplate inside of it? (Intead of inheriting from MakoTemplate)
class
Template
(
MakoTemplate
):
"""
This bridges the gap between a Mako template and a djano template. It can
...
...
common/lib/mitxmako/mitxmako/templatetag_helpers.py
0 → 100644
View file @
3f4c4d74
from
django.template.base
import
Template
,
Context
from
django.template.loader
import
get_template
,
select_template
def
render_inclusion
(
func
,
file_name
,
*
args
,
**
kwargs
):
_dict
=
func
(
*
args
,
**
kwargs
)
if
isinstance
(
file_name
,
Template
):
t
=
file_name
elif
not
isinstance
(
file_name
,
basestring
)
and
is_iterable
(
file_name
):
t
=
select_template
(
file_name
)
else
:
t
=
get_template
(
file_name
)
nodelist
=
t
.
nodelist
new_context
=
Context
(
_dict
)
# **{
# 'autoescape': context.autoescape,
# 'current_app': context.current_app,
# 'use_l10n': context.use_l10n,
# 'use_tz': context.use_tz,
# })
return
nodelist
.
render
(
new_context
)
lms/templates/wiki/article.html
View file @
3f4c4d74
## mako
<
%
inherit
file=
"../main.html"
/>
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%
inherit
file=
"mako_base.html"
/>
<
%
block
name=
"bodyextra"
>
<
%!
from
wiki
.
templatetags
.
wiki_tags
import
wiki_render
from
mitxmako
.
templatetag_helpers
import
render_inclusion
%
>
This is a mako template with inheritance!
<
%
namespace
name=
"article_menu"
file=
"includes/article_menu.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" %}
</
%
block>
</
%
doc>
<!-- {% 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 %}
<h1> Did it work? </h1>
<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>
{% with "view" as selected %}
{% include "wiki/includes/article_menu.html" %}
{% endwith %}
</ul>
<div class="tab-content">
{% wiki_render article %}
</div>
</div>
<div class="tabbable tabs-below" style="margin-top: 20px;">
<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>
<
%
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=
"tab-content"
>
${ render_inclusion(wiki_render, 'wiki/includes/render.html', article ) }
</div>
{% endblock %} -->
</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>
</
%
block>
lms/templates/wiki/includes/article_menu.html
0 → 100644
View file @
3f4c4d74
## mako
<
%
page
args=
"selected, article, plugins"
/>
<
%!
from
django
.
core
.
urlresolvers
import
reverse
%
>
<
%
if
urlpath:
tab_reverse =
lambda
name
,
kwargs=
{}:
reverse
(
name
,
kwargs=
dict({'path'
:
urlpath
.
path
},
**
kwargs
))
else:
tab_reverse =
lambda
name
,
kwargs=
{}:
reverse
(
name
,
kwargs=
dict({'article_id'
:
article
.
id
},
**
kwargs
))
%
>
%for plugin in plugins:
%if hasattr(plugin, "article_tab"):
<li
class=
"pull-right{% if selected == plugin.slug %} active{% endif %}"
>
<a
href=
"${tab_reverse('wiki:plugin_url', kwargs={'slug' : plugin.slug}) }"
>
<span
class=
"${plugin.article_tab[1]}"
></span>
${plugin.article_tab[0]}
</a>
</li>
%endif
%endfor
<li
class=
"pull-right${"
active
"
if
selected =
=
"
settings
"
else
""}"
>
%if not user.is_anonymous:
<a
href=
"${tab_reverse('wiki:settings_url')}"
>
<span
class=
"icon-wrench"
></span>
Settings
</a>
%endif
</li>
<li
class=
"pull-right${"
active
"
if
selected =
=
"
history
"
else
""}"
>
<a
href=
"${tab_reverse('wiki:history_url')}"
>
<span
class=
"icon-time"
></span>
Changes
</a>
</li>
<li
class=
"pull-right${"
active
"
if
selected =
=
"
edit
"
else
""}"
>
<a
href=
"${tab_reverse('wiki:edit_url')}"
>
<span
class=
"icon-edit"
></span>
Edit
</a>
</li>
<li
class=
"pull-right${"
active
"
if
selected =
=
"
view
"
else
""}"
>
<a
href=
"${tab_reverse('wiki:get_url')}"
>
<span
class=
"icon-home"
></span>
View
</a>
</li>
lms/templates/wiki/mako_base.html
0 → 100644
View file @
3f4c4d74
## mako
<
%
inherit
file=
"../main.html"
/>
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'course'
/>
</
%
block>
<
%
block
name=
"bodyextra"
>
## %if course:
##
<
%
include
file=
"../course_navigation.html"
args=
"active_page='wiki'"
/>
## %endif
<div
class=
"container"
style=
"margin-top: 60px;"
>
<
%
doc
>
{% if messages %}
{% for message in messages %}
<div
class=
"alert alert-{{ message.tags }}"
>
<a
class=
"close"
data-dismiss=
"alert"
href=
"#"
>
×
</a>
{{ message }}
</div>
{% endfor %}
{% endif %}
</
%
doc>
<
%
block
name=
"wiki_breadcrumbs"
/>
<
%
block
name=
"wiki_contents"
/>
<div
style=
"padding: 50px 0;"
>
<footer>
<hr
/>
<a
href=
"https://github.com/benjaoming/django-wiki"
class=
"pull-right"
><img
src=
"{{ STATIC_URL }}wiki/img/github_icon.png"
/></a>
<p>
Powered by
<a
href=
"http://www.django-wiki.org"
>
django-wiki
</a>
, an open source application under the
<a
href=
"http://www.gnu.org/licenses/quick-guide-gplv3.html"
>
GPLv3
</a>
license. Let knowledge be the cure.
</p>
<div
style=
"clear: both"
></div>
</footer>
</div>
</div>
<!-- /container -->
</
%
block>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment