Commit c619639c by benjaoming

Making more agile url patterns that are agnostic to either receiving a path or…

Making more agile url patterns that are agnostic to either receiving a  path or an article_id. The path takes precedence over the article_id, except for the root article which needs to be forced in the template. Prettyfying the article revision list.
parent 24ea6718
...@@ -27,7 +27,7 @@ class AttachmentPreprocessor(markdown.preprocessors.Preprocessor): ...@@ -27,7 +27,7 @@ class AttachmentPreprocessor(markdown.preprocessors.Preprocessor):
attachment = models.Attachment.objects.get(article=self.markdown.article, attachment = models.Attachment.objects.get(article=self.markdown.article,
id=attachment_id) id=attachment_id)
url = reverse('wiki:attachments_download', kwargs={'article_id': self.markdown.article.id, url = reverse('wiki:attachments_download', kwargs={'article_id': self.markdown.article.id,
'attachment_id':attachment.id}) 'attachment_id':attachment.id,})
line = line.replace(m.group(1), u"""<span class="attachment"><a href="%s" title="%s">%s</a>""" % line = line.replace(m.group(1), u"""<span class="attachment"><a href="%s" title="%s">%s</a>""" %
(url, _(u"Click to download file"), attachment.original_filename)) (url, _(u"Click to download file"), attachment.original_filename))
new_text.append(line) new_text.append(line)
......
...@@ -10,10 +10,7 @@ ...@@ -10,10 +10,7 @@
{% block wiki_contents %} {% block wiki_contents %}
{% article_for_object urlpath as article %} <div class="tabbable tabs-top" style="margin-top: 20px;">
{% if article %}
<div class="tabbable tabs-top" style="margin-top: 40px;">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
{% with "attachments" as selected %} {% with "attachments" as selected %}
{% include "wiki/includes/article_menu.html" %} {% include "wiki/includes/article_menu.html" %}
...@@ -41,7 +38,7 @@ ...@@ -41,7 +38,7 @@
<form method="POST" class="form-horizontal" id="attachment_form" enctype="multipart/form-data"> <form method="POST" class="form-horizontal" id="attachment_form" enctype="multipart/form-data">
{% wiki_form form %} {% wiki_form form %}
<div class="form-actions"> <div class="form-actions">
<a href="{% url 'wiki:attachments_index' path=urlpath.path %}" class="btn"> <a href="{% url 'wiki:attachments_index' path=urlpath.path article_id=article.id %}" class="btn">
<span class="icon-arrow-left"></span> <span class="icon-arrow-left"></span>
{% trans "Go back" %} {% trans "Go back" %}
</a> </a>
...@@ -62,7 +59,7 @@ ...@@ -62,7 +59,7 @@
<form method="POST" class="form-horizontal" id="attachment_form" enctype="multipart/form-data"> <form method="POST" class="form-horizontal" id="attachment_form" enctype="multipart/form-data">
{% wiki_form form %} {% wiki_form form %}
<div class="form-actions"> <div class="form-actions">
<a href="{% url 'wiki:attachments_index' path=urlpath.path %}" class="btn"> <a href="{% url 'wiki:attachments_index' path=urlpath.path article_id=article.id %}" class="btn">
<span class="icon-arrow-left"></span> <span class="icon-arrow-left"></span>
{% trans "Go back" %} {% trans "Go back" %}
</a> </a>
...@@ -84,9 +81,5 @@ ...@@ -84,9 +81,5 @@
</ul> </ul>
</div> </div>
{% else %}
{% trans "An article for this path does not exist." %}
{% endif %}
{% endblock %} {% endblock %}
...@@ -10,10 +10,7 @@ ...@@ -10,10 +10,7 @@
{% block wiki_contents %} {% block wiki_contents %}
{% article_for_object urlpath as article %} <div class="tabbable tabs-top" style="margin-top: 20px;">
{% if article %}
<div class="tabbable tabs-top" style="margin-top: 40px;">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
{% with "attachments" as selected %} {% with "attachments" as selected %}
{% include "wiki/includes/article_menu.html" %} {% include "wiki/includes/article_menu.html" %}
...@@ -48,9 +45,9 @@ ...@@ -48,9 +45,9 @@
<td>{{ revision.get_filename }}</td> <td>{{ revision.get_filename }}</td>
<td>{{ revision.file.size|filesizeformat }}</td> <td>{{ revision.file.size|filesizeformat }}</td>
<td style="text-align: right"> <td style="text-align: right">
<form method="POST" action="{% url 'wiki:attachments_revision_change' path=urlpath.path attachment_id=attachment.id revision_id=revision.id %}"> <form method="POST" action="{% url 'wiki:attachments_revision_change' path=urlpath.path article_id=article.id attachment_id=attachment.id revision_id=revision.id %}">
{% csrf_token %} {% csrf_token %}
<a href="{% url 'wiki:attachments_download' path=urlpath.path attachment_id=attachment.id revision_id=revision.id %}" class="btn btn-primary"> <a href="{% url 'wiki:attachments_download' path=urlpath.path article_id=article.id attachment_id=attachment.id revision_id=revision.id %}" class="btn btn-primary">
<span class="icon-download"></span> <span class="icon-download"></span>
{% trans "Download" %} {% trans "Download" %}
</a> </a>
...@@ -65,7 +62,7 @@ ...@@ -65,7 +62,7 @@
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
<a href="{% url 'wiki:attachments_index' path=urlpath.path %}"><span class="icon-arrow-left"></span> {% trans "Go back" %}</a> <a href="{% url 'wiki:attachments_index' path=urlpath.path article_id=article.id %}"><span class="icon-arrow-left"></span> {% trans "Go back" %}</a>
</div> </div>
</div> </div>
...@@ -75,9 +72,5 @@ ...@@ -75,9 +72,5 @@
</ul> </ul>
</div> </div>
{% else %}
{% trans "An article for this path does not exist." %}
{% endif %}
{% endblock %} {% endblock %}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{% load wiki_tags i18n humanize %} {% load wiki_tags i18n humanize %}
{% load url from future %} {% load url from future %}
{% block pagetitle %}{% trans "Attachments" %}: {% article_for_object urlpath as article %}{{ article.current_revision.title }}{% endblock %} {% block pagetitle %}{% trans "Attachments" %}: {{ article.current_revision.title }}{% endblock %}
{% block wiki_breadcrumbs %} {% block wiki_breadcrumbs %}
{% include "wiki/includes/breadcrumbs.html" %} {% include "wiki/includes/breadcrumbs.html" %}
...@@ -10,10 +10,7 @@ ...@@ -10,10 +10,7 @@
{% block wiki_contents %} {% block wiki_contents %}
{% article_for_object urlpath as article %} <div class="tabbable tabs-top" style="margin-top: 20px;">
{% if article %}
<div class="tabbable tabs-top" style="margin-top: 40px;">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
{% with "attachments" as selected %} {% with "attachments" as selected %}
{% include "wiki/includes/article_menu.html" %} {% include "wiki/includes/article_menu.html" %}
...@@ -34,7 +31,7 @@ ...@@ -34,7 +31,7 @@
<tr> <tr>
<td colspan="4"> <td colspan="4">
<h3> <h3>
<a href="{% url 'wiki:attachments_download' path=urlpath.path attachment_id=attachment.id %}">{{ attachment.current_revision.get_filename }}</a> <a href="{% url 'wiki:attachments_download' path=urlpath.path article_id=article.id attachment_id=attachment.id %}">{{ attachment.current_revision.get_filename }}</a>
<span class="badge">{{ attachment.current_revision.created|naturaltime }}</span> <span class="badge">{{ attachment.current_revision.created|naturaltime }}</span>
{% if attachment.current_revision.deleted %} {% if attachment.current_revision.deleted %}
<span class="badge badge-important">{% trans "deleted" %}</span> <span class="badge badge-important">{% trans "deleted" %}</span>
...@@ -51,15 +48,15 @@ ...@@ -51,15 +48,15 @@
{% if attachment|can_write:user %} {% if attachment|can_write:user %}
<p> <p>
{% if not attachment.current_revision.deleted %} {% if not attachment.current_revision.deleted %}
<a href="{% url 'wiki:attachments_replace' path=urlpath.path attachment_id=attachment.id %}" class="btn">{% trans "Replace" %}</a> <a href="{% url 'wiki:attachments_replace' path=urlpath.path article_id=article.id attachment_id=attachment.id %}" class="btn">{% trans "Replace" %}</a>
{% if attachment.article = article %} {% if attachment.article = article %}
<a href="{% url 'wiki:attachments_delete' path=urlpath.path attachment_id=attachment.id %}" class="btn">{% trans "Delete" %}</a> <a href="{% url 'wiki:attachments_delete' path=urlpath.path article_id=article.id attachment_id=attachment.id %}" class="btn">{% trans "Delete" %}</a>
{% else %} {% else %}
<a href="{% url 'wiki:attachments_delete' path=urlpath.path attachment_id=attachment.id %}" class="btn">{% trans "Detach" %}</a> <a href="{% url 'wiki:attachments_delete' path=urlpath.path article_id=article.id attachment_id=attachment.id %}" class="btn">{% trans "Detach" %}</a>
{% endif %} {% endif %}
{% else %} {% else %}
{% if attachment.current_revision.previous_revision.id %} {% if attachment.current_revision.previous_revision.id %}
<form method="POST" action="{% url 'wiki:attachments_revision_change' path=urlpath.path attachment_id=attachment.id revision_id=attachment.current_revision.previous_revision.id %}"> <form method="POST" action="{% url 'wiki:attachments_revision_change' path=urlpath.path article_id=article.id attachment_id=attachment.id revision_id=attachment.current_revision.previous_revision.id %}">
{% csrf_token %} {% csrf_token %}
<button class="btn"> <button class="btn">
{% trans "Restore" %} {% trans "Restore" %}
...@@ -70,7 +67,7 @@ ...@@ -70,7 +67,7 @@
</p> </p>
{% endif %} {% endif %}
<p> <p>
<a href="{% url 'wiki:attachments_history' path=urlpath.path attachment_id=attachment.id %}"> <a href="{% url 'wiki:attachments_history' path=urlpath.path article_id=article.id attachment_id=attachment.id %}">
<span class="icon-time"></span> <span class="icon-time"></span>
{% trans "File history" %} ({{ attachment.attachmentrevision_set.all.count }} {% trans "revisions" %}) {% trans "File history" %} ({{ attachment.attachmentrevision_set.all.count }} {% trans "revisions" %})
</a> </a>
...@@ -125,7 +122,7 @@ ...@@ -125,7 +122,7 @@
<div id="collapse_add" class="accordion-body collapse"> <div id="collapse_add" class="accordion-body collapse">
<div class="accordion-inner"> <div class="accordion-inner">
<p>{% trans "You can reuse files from other articles. These files are subject to updates on other articles which may or may not be a good thing." %}</p> <p>{% trans "You can reuse files from other articles. These files are subject to updates on other articles which may or may not be a good thing." %}</p>
<form method="GET" action="{% url 'wiki:attachments_search' path=urlpath.path %}" class="form-search"> <form method="GET" action="{% url 'wiki:attachments_search' path=urlpath.path article_id=article.id %}" class="form-search">
{{ search_form.query }} {{ search_form.query }}
<button class="btn btn-large"> <button class="btn btn-large">
{% trans "Search files and articles" %} {% trans "Search files and articles" %}
...@@ -150,9 +147,5 @@ ...@@ -150,9 +147,5 @@
</ul> </ul>
</div> </div>
{% else %}
{% trans "An article for this path does not exist." %}
{% endif %}
{% endblock %} {% endblock %}
...@@ -9,11 +9,7 @@ ...@@ -9,11 +9,7 @@
{% endblock %} {% endblock %}
{% block wiki_contents %} {% block wiki_contents %}
<div class="tabbable tabs-top" style="margin-top: 20px;">
{% article_for_object urlpath as article %}
{% if article %}
<div class="tabbable tabs-top" style="margin-top: 40px;">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
{% with "attachments" as selected %} {% with "attachments" as selected %}
{% include "wiki/includes/article_menu.html" %} {% include "wiki/includes/article_menu.html" %}
...@@ -48,7 +44,7 @@ ...@@ -48,7 +44,7 @@
<form method="POST" class="form-horizontal" id="attachment_form" enctype="multipart/form-data"> <form method="POST" class="form-horizontal" id="attachment_form" enctype="multipart/form-data">
{% wiki_form form %} {% wiki_form form %}
<div class="form-actions"> <div class="form-actions">
<a href="{% url 'wiki:attachments_index' path=urlpath.path %}" class="btn"> <a href="{% url 'wiki:attachments_index' path=urlpath.path article_id=article.id %}" class="btn">
<span class="icon-arrow-left"></span> <span class="icon-arrow-left"></span>
{% trans "Go back" %} {% trans "Go back" %}
</a> </a>
...@@ -68,9 +64,5 @@ ...@@ -68,9 +64,5 @@
</ul> </ul>
</div> </div>
{% else %}
{% trans "An article for this path does not exist." %}
{% endif %}
{% endblock %} {% endblock %}
...@@ -10,10 +10,7 @@ ...@@ -10,10 +10,7 @@
{% block wiki_contents %} {% block wiki_contents %}
{% article_for_object urlpath as article %} <div class="tabbable tabs-top" style="margin-top: 20px;">
{% if article %}
<div class="tabbable tabs-top" style="margin-top: 40px;">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
{% with "attachments" as selected %} {% with "attachments" as selected %}
{% include "wiki/includes/article_menu.html" %} {% include "wiki/includes/article_menu.html" %}
...@@ -27,7 +24,7 @@ ...@@ -27,7 +24,7 @@
<div class="tab-content"> <div class="tab-content">
<h2>{% trans "Add existing attachment to" %} {{ article.current_revision.title }}</h2> <h2>{% trans "Add existing attachment to" %} {{ article.current_revision.title }}</h2>
<form method="GET" action="{% url 'wiki:attachments_search' path=urlpath.path %}" class="form-search"> <form method="GET" action="{% url 'wiki:attachments_search' path=urlpath.path article_id=article.id %}" class="form-search">
{{ search_form.query }} {{ search_form.query }}
<button class="btn"> <button class="btn">
<span class="icon-search"></span> <span class="icon-search"></span>
...@@ -63,9 +60,9 @@ ...@@ -63,9 +60,9 @@
</td> </td>
<td>{{ attachment.current_revision.file.size|filesizeformat }}</td> <td>{{ attachment.current_revision.file.size|filesizeformat }}</td>
<td style="text-align: right"> <td style="text-align: right">
<form method="POST" action="{% url 'wiki:attachments_add' path=urlpath.path attachment_id=attachment.id %}"> <form method="POST" action="{% url 'wiki:attachments_add' path=urlpath.path article_id=article.id attachment_id=attachment.id %}">
{% csrf_token %} {% csrf_token %}
<a href="{% url 'wiki:attachments_download' path=urlpath.path attachment_id=attachment.id %}" class="btn"> <a href="{% url 'wiki:attachments_download' path=urlpath.path article_id=article.id attachment_id=attachment.id %}" class="btn">
<span class="icon-download"></span> <span class="icon-download"></span>
{% trans "Download" %} {% trans "Download" %}
</a> </a>
...@@ -87,7 +84,7 @@ ...@@ -87,7 +84,7 @@
{% endwith %} {% endwith %}
<p> <p>
<a href="{% url 'wiki:attachments_index' path=urlpath.path %}"><span class="icon-arrow-left"></span> {% trans "Go back" %}</a> <a href="{% url 'wiki:attachments_index' path=urlpath.path article_id=article.id %}"><span class="icon-arrow-left"></span> {% trans "Go back" %}</a>
</p> </p>
</div> </div>
</div> </div>
...@@ -98,9 +95,5 @@ ...@@ -98,9 +95,5 @@
</ul> </ul>
</div> </div>
{% else %}
{% trans "An article for this path does not exist." %}
{% endif %}
{% endblock %} {% endblock %}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{% load wiki_tags i18n %} {% load wiki_tags i18n %}
{% load url from future %} {% load url from future %}
{% block pagetitle %}{% article_for_object urlpath as article %}{{ article.current_revision.title }}{% endblock %} {% block pagetitle %}{{ article.current_revision.title }}{% endblock %}
{% block wiki_breadcrumbs %} {% block wiki_breadcrumbs %}
{% include "wiki/includes/breadcrumbs.html" %} {% include "wiki/includes/breadcrumbs.html" %}
...@@ -10,9 +10,6 @@ ...@@ -10,9 +10,6 @@
{% block wiki_contents %} {% block wiki_contents %}
{% article_for_object urlpath as article %}
{% if article %}
<div class="tabbable tabs-top" style="margin-top: 20px;"> <div class="tabbable tabs-top" style="margin-top: 20px;">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li style="float: left"> <li style="float: left">
...@@ -36,10 +33,5 @@ ...@@ -36,10 +33,5 @@
</ul> </ul>
</div> </div>
{% else %}
{% trans "An article for this path does not exist." %}
{% endif %}
{% endblock %} {% endblock %}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{% load wiki_tags i18n %} {% load wiki_tags i18n %}
{% load url from future %} {% load url from future %}
{% block pagetitle %}{% trans "Edit" %}: {% article_for_object urlpath as article %}{{ article.current_revision.title }}{% endblock %} {% block pagetitle %}{% trans "Edit" %}: {{ article.current_revision.title }}{% endblock %}
{% block wiki_breadcrumbs %} {% block wiki_breadcrumbs %}
{% include "wiki/includes/breadcrumbs.html" %} {% include "wiki/includes/breadcrumbs.html" %}
...@@ -10,10 +10,7 @@ ...@@ -10,10 +10,7 @@
{% block wiki_contents %} {% block wiki_contents %}
{% article_for_object urlpath as article %} <div class="tabbable tabs-top" style="margin-top: 20px;">
{% if article %}
<div class="tabbable tabs-top" style="margin-top: 40px;">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
{% with "edit" as selected %} {% with "edit" as selected %}
{% include "wiki/includes/article_menu.html" %} {% include "wiki/includes/article_menu.html" %}
...@@ -70,9 +67,5 @@ ...@@ -70,9 +67,5 @@
</ul> </ul>
</div> </div>
{% else %}
{% trans "An article for this path does not exist." %}
{% endif %}
{% endblock %} {% endblock %}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{% load wiki_tags i18n sekizai_tags %} {% load wiki_tags i18n sekizai_tags %}
{% load url from future %} {% load url from future %}
{% block pagetitle %}{% trans "History" %}: {% article_for_object urlpath as article %}{{ article.current_revision.title }}{% endblock %} {% block pagetitle %}{% trans "History" %}: {{ article.current_revision.title }}{% endblock %}
{% block wiki_breadcrumbs %} {% block wiki_breadcrumbs %}
{% include "wiki/includes/breadcrumbs.html" %} {% include "wiki/includes/breadcrumbs.html" %}
...@@ -55,10 +55,7 @@ ...@@ -55,10 +55,7 @@
} }
</style> </style>
{% endaddtoblock %} {% endaddtoblock %}
{% article_for_object urlpath as article %} <div class="tabbable tabs-top" style="margin-top: 20px;">
{% if article %}
<div class="tabbable tabs-top" style="margin-top: 40px;">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
{% with "history" as selected %} {% with "history" as selected %}
{% include "wiki/includes/article_menu.html" %} {% include "wiki/includes/article_menu.html" %}
...@@ -80,11 +77,20 @@ ...@@ -80,11 +77,20 @@
{% if revision == article.current_revision %} {% if revision == article.current_revision %}
<strong>*</strong> <strong>*</strong>
{% endif %} {% endif %}
<div style="color: #CCC;">
<small>
{% if revision.user_message %}
{{ revision.user_message }}
{% else %}
({% trans "no log message" %})
{% endif %}
</small>
</div>
</a> </a>
<div class="progress progress-striped active" style="display: none; width: 40px; float: left; margin-top: 7px; margin-bottom: -7px;"> <div class="progress progress-striped active" style="display: none; width: 40px; float: left; margin-top: 7px; margin-bottom: -7px;">
<div class="bar" style="width: 100%;"></div> <div class="bar" style="width: 100%;"></div>
</div> </div>
<div class="pull-right" style="vertical-align: middle; margin: 3px;"> <div class="pull-right" style="vertical-align: middle; margin: 8px 3px;">
{% if revision == article.current_revision %} {% if revision == article.current_revision %}
<a href="#" class="btn disabled"> <a href="#" class="btn disabled">
<span class="icon-lock"></span> <span class="icon-lock"></span>
...@@ -111,8 +117,6 @@ ...@@ -111,8 +117,6 @@
<div id="collapse{{ revision.revision_number }}" class="accordion-body collapse"> <div id="collapse{{ revision.revision_number }}" class="accordion-body collapse">
<div class="accordion-inner diff-container" style="padding: 0;"> <div class="accordion-inner diff-container" style="padding: 0;">
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>{% trans "User message:" %}</dt>
<dd>{{ revision.user_message|default:"-" }}</dd>
<dt>{% trans "Auto log:" %}</dt> <dt>{% trans "Auto log:" %}</dt>
<dd>{{ revision.automatic_log|default:"-"|linebreaksbr }}</dd> <dd>{{ revision.automatic_log|default:"-"|linebreaksbr }}</dd>
</dl> </dl>
...@@ -217,9 +221,5 @@ ...@@ -217,9 +221,5 @@
</ul> </ul>
</div> </div>
{% else %}
{% trans "An article for this path does not exist." %}
{% endif %}
{% endblock %} {% endblock %}
...@@ -3,17 +3,26 @@ ...@@ -3,17 +3,26 @@
{% for plugin in plugins %} {% for plugin in plugins %}
{% if plugin.article_tab %} {% if plugin.article_tab %}
<li class="pull-right{% if selected == plugin.slug %} active{% endif %}"> <li class="pull-right{% if selected == plugin.slug %} active{% endif %}">
<a href="{% url 'wiki:plugin_url' urlpath.path plugin.slug %}"> {% if urlpath %}
<a href="{% url 'wiki:plugin_url' path=urlpath.path slug=plugin.slug %}">
<span class="{{ plugin.article_tab.1 }}"></span> <span class="{{ plugin.article_tab.1 }}"></span>
{{ plugin.article_tab.0 }} {{ plugin.article_tab.0 }}
</a> </a>
{% else %}
<a href="{% url 'wiki:plugin' slug=plugin.slug article_id=article.id %}">
<span class="{{ plugin.article_tab.1 }}"></span>
{{ plugin.article_tab.0 }}
</a>
{% endif %}
</li> </li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if urlpath %}
<li class="pull-right{% if selected == "settings" %} active{% endif %}"> <li class="pull-right{% if selected == "settings" %} active{% endif %}">
{% if not user.is_anonymous %} {% if not user.is_anonymous %}
<a href="{% url 'wiki:settings_url' urlpath.path %}"> <a href="{% url 'wiki:settings_url' path=urlpath.path %}">
<span class="icon-wrench"></span> <span class="icon-wrench"></span>
{% trans "Settings" %} {% trans "Settings" %}
</a> </a>
...@@ -38,3 +47,32 @@ ...@@ -38,3 +47,32 @@
</a> </a>
</li> </li>
{% else %}
<li class="pull-right{% if selected == "settings" %} active{% endif %}">
{% if not user.is_anonymous %}
<a href="{% url 'wiki:settings' article_id=article.id %}">
<span class="icon-wrench"></span>
{% trans "Settings" %}
</a>
{% endif %}
</li>
<li class="pull-right{% if selected == "history" %} active{% endif %}">
<a href="{% url 'wiki:history' article_id=article.id %}">
<span class="icon-time"></span>
{% trans "Changes" %}
</a>
</li>
<li class="pull-right{% if selected == "edit" %} active{% endif %}">
<a href="{% url 'wiki:edit' article_id=article.id %}">
<span class="icon-edit"></span>
{% trans "Edit" %}
</a>
</li>
<li class="pull-right{% if selected == "view" %} active{% endif %}">
<a href="{% url 'wiki:get' article_id=article.id %}">
<span class="icon-home"></span>
{% trans "View" %}
</a>
</li>
{% endif %}
{% load i18n %}{% load url from future %} {% load i18n %}{% load url from future %}
{% if urlpath %}
<ul class="breadcrumb pull-left" class=""> <ul class="breadcrumb pull-left" class="">
{% for ancestor in urlpath.get_ancestors.all %} {% for ancestor in urlpath.get_ancestors.all %}
<span class="divider">/</span> <span class="divider">/</span>
<li><a href="{% url 'wiki:get_url' ancestor.path %}">{{ ancestor.article.current_revision.title }}</a></li> <li><a href="{% url 'wiki:get_url' ancestor.path %}">{{ ancestor.article.current_revision.title }}</a></li>
{% endfor %} {% endfor %}
<span class="divider">/</span> <span class="divider">/</span>
<li class="active"><a href="{% url 'wiki:get_url' urlpath.path %}">{{ urlpath.article.current_revision.title }}</a></li> <li class="active"><a href="{% url 'wiki:get_url' urlpath.path %}">{{ article.current_revision.title }}</a></li>
<span class="divider">/</span> <span class="divider">/</span>
</ul> </ul>
<div class="pull-left" style="margin-left: 10px;"> <div class="pull-left" style="margin-left: 10px;">
...@@ -35,7 +36,5 @@ ...@@ -35,7 +36,5 @@
{% trans "Add article" %} {% trans "Add article" %}
</a> </a>
</div> </div>
<div style="clear: both"></div> <div style="clear: both"></div>
{% endif %}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{% load wiki_tags i18n %} {% load wiki_tags i18n %}
{% load url from future %} {% load url from future %}
{% block pagetitle %}{% trans "Settings" %}: {% article_for_object urlpath as article %}{{ article.current_revision.title }}{% endblock %} {% block pagetitle %}{% trans "Settings" %}: {{ article.current_revision.title }}{% endblock %}
{% block wiki_breadcrumbs %} {% block wiki_breadcrumbs %}
{% include "wiki/includes/breadcrumbs.html" %} {% include "wiki/includes/breadcrumbs.html" %}
...@@ -10,10 +10,7 @@ ...@@ -10,10 +10,7 @@
{% block wiki_contents %} {% block wiki_contents %}
{% article_for_object urlpath as article %} <div class="tabbable tabs-top" style="margin-top: 20px;">
{% if article %}
<div class="tabbable tabs-top" style="margin-top: 40px;">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
{% with "settings" as selected %} {% with "settings" as selected %}
{% include "wiki/includes/article_menu.html" %} {% include "wiki/includes/article_menu.html" %}
...@@ -50,9 +47,5 @@ ...@@ -50,9 +47,5 @@
</ul> </ul>
</div> </div>
{% else %}
{% trans "An article for this path does not exist." %}
{% endif %}
{% endblock %} {% endblock %}
...@@ -26,14 +26,14 @@ urlpatterns += patterns('', ...@@ -26,14 +26,14 @@ urlpatterns += patterns('',
url('^_revision/merge/(?P<article_id>\d+)/(?P<revision_id>\d+)/preview/$', 'wiki.views.article.merge', name='merge_revision_preview', kwargs={'preview': True}), url('^_revision/merge/(?P<article_id>\d+)/(?P<revision_id>\d+)/preview/$', 'wiki.views.article.merge', name='merge_revision_preview', kwargs={'preview': True}),
# Paths decided by article_ids # Paths decided by article_ids
url('^(?P<article_id>\d+)/create/$', article.Create.as_view(), name='create_url'), url('^(?P<article_id>\d+)/$', article.ArticleView.as_view(), name='get'),
url('^(?P<article_id>\d+)/edit/$', article.Edit.as_view(), name='edit_url'), url('^(?P<article_id>\d+)/edit/$', article.Edit.as_view(), name='edit'),
url('^(?P<article_id>\d+)/preview/$', 'wiki.views.article.preview', name='preview_url'), url('^(?P<article_id>\d+)/preview/$', 'wiki.views.article.preview', name='preview'),
url('^(?P<article_id>\d+)/history/$', article.History.as_view(), name='history_url'), url('^(?P<article_id>\d+)/history/$', article.History.as_view(), name='history'),
url('^(?P<article_id>\d+)/settings/$', article.Settings.as_view(), name='settings_url'), url('^(?P<article_id>\d+)/settings/$', article.Settings.as_view(), name='settings'),
url('^(?P<article_id>\d+)/revision/change/(?P<revision_id>\d+)/$', 'wiki.views.article.change_revision', name='change_revision_url'), url('^(?P<article_id>\d+)/revision/change/(?P<revision_id>\d+)/$', 'wiki.views.article.change_revision', name='change_revision'),
url('^(?P<article_id>\d+)/revision/merge/(?P<revision_id>\d+)/$', 'wiki.views.article.merge', name='merge_revision_url'), url('^(?P<article_id>\d+)/revision/merge/(?P<revision_id>\d+)/$', 'wiki.views.article.merge', name='merge_revision'),
url('^(?P<article_id>\d+)/plugin/(?P<slug>\w+)/$', article.Plugin.as_view(), name='plugin_url'), url('^(?P<article_id>\d+)/plugin/(?P<slug>\w+)/$', article.Plugin.as_view(), name='plugin'),
) )
...@@ -42,6 +42,8 @@ for plugin in plugins_registry._cache.values(): ...@@ -42,6 +42,8 @@ for plugin in plugins_registry._cache.values():
plugin_urlpatterns = getattr(plugin, 'urlpatterns', None) plugin_urlpatterns = getattr(plugin, 'urlpatterns', None)
if slug and plugin_urlpatterns: if slug and plugin_urlpatterns:
urlpatterns += patterns('', urlpatterns += patterns('',
url('^(?P<path>.+/|)_plugin/'+slug+'/', include(plugin_urlpatterns)),
url('^(?P<article_id>\d+)(?P<path>)/plugin/'+slug+'/', include(plugin_urlpatterns)),
url('^(?P<article_id>\d+)/plugin/'+slug+'/', include(plugin_urlpatterns)), url('^(?P<article_id>\d+)/plugin/'+slug+'/', include(plugin_urlpatterns)),
) )
...@@ -57,13 +59,6 @@ urlpatterns += patterns('', ...@@ -57,13 +59,6 @@ urlpatterns += patterns('',
url('^(?P<path>.+/|)_plugin/(?P<slug>\w+)/$', article.Plugin.as_view(), name='plugin_url'), url('^(?P<path>.+/|)_plugin/(?P<slug>\w+)/$', article.Plugin.as_view(), name='plugin_url'),
) )
for plugin in plugins_registry._cache.values():
slug = getattr(plugin, 'slug', None)
plugin_urlpatterns = getattr(plugin, 'urlpatterns', None)
if slug and plugin_urlpatterns:
urlpatterns += patterns('',
url('^(?P<path>.+/|)_plugin/'+slug+'/', include(plugin_urlpatterns)),
)
urlpatterns += patterns('', urlpatterns += patterns('',
url('^(?P<path>.+/|)$', article.ArticleView.as_view(), name='get_url'), url('^(?P<path>.+/|)$', article.ArticleView.as_view(), name='get_url'),
......
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