Commit 846a665f by benjaoming

Cleaning up template boiler plate markup

parent 588bcdde
{% extends "wiki/base.html" %} {% extends "wiki/article.html" %}
{% load wiki_tags i18n humanize %} {% load wiki_tags i18n humanize %}
{% load url from future %} {% load url from future %}
{% block pagetitle %}{% trans "Delete" %} "{{ attachment.current_revision.get_filename }}"{% endblock %} {% block pagetitle %}{% trans "Delete" %} "{{ attachment.current_revision.get_filename }}"{% endblock %}
{% block wiki_breadcrumbs %} {% block wiki_contents_tab %}
{% include "wiki/includes/breadcrumbs.html" %}
{% endblock %}
{% block wiki_contents %}
<div class="tabbable tabs-top" style="margin-top: 20px;"> {% if attachment.article == article %}
<ul class="nav nav-tabs"> <h2>{% trans "Delete" %} "{{ attachment.current_revision.get_filename }}"?</h2>
{% with "attachments" as selected %}
{% include "wiki/includes/article_menu.html" %}
{% endwith %}
<li>
<h1 style="margin-top: -10px;">
{{ article.current_revision.title }}
</h1>
</li>
</ul>
<div class="tab-content">
{% if attachment.article == article %}
<h2>{% trans "Delete" %} "{{ attachment.current_revision.get_filename }}"?</h2>
<p class="lead"> <p class="lead">
{% blocktrans with attachment.original_filename as filename %} {% blocktrans with attachment.original_filename as filename %}
The file may be referenced on other articles. Deleting it means that they will loose their references to this file. The following articles reference this file: The file may be referenced on other articles. Deleting it means that they will loose their references to this file. The following articles reference this file:
...@@ -34,8 +18,8 @@ ...@@ -34,8 +18,8 @@
<li style="font-size: 150%;">{{ a.current_revision.title }}</li> <li style="font-size: 150%;">{{ a.current_revision.title }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
<hr /> <hr />
<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 article_id=article.id %}" class="btn"> <a href="{% url 'wiki:attachments_index' path=urlpath.path article_id=article.id %}" class="btn">
...@@ -47,9 +31,9 @@ ...@@ -47,9 +31,9 @@
{% trans "Delete it!" %} {% trans "Delete it!" %}
</button> </button>
</div> </div>
</form> </form>
{% else %} {% else %}
<h2>{% trans "Remove" %} "{{ attachment.current_revision.get_filename }}"?</h2> <h2>{% trans "Remove" %} "{{ attachment.current_revision.get_filename }}"?</h2>
<p class="lead"> <p class="lead">
{% blocktrans with attachment.original_filename as filename %} {% blocktrans with attachment.original_filename as filename %}
...@@ -68,18 +52,9 @@ ...@@ -68,18 +52,9 @@
{% trans "Remove reference" %} {% trans "Remove reference" %}
</button> </button>
</div> </div>
</form> </form>
{% endif %}
</div>
</div>
<div class="tabbable tabs-below" style="margin-top: 20px;"> {% endif %}
<ul class="nav nav-tabs">
<li style="margin-top: 10px;"><em>{% trans "Article last modified:" %} {{ article.current_revision.modified }}</em></li>
</ul>
</div>
{% endblock %} {% endblock %}
{% extends "wiki/base.html" %} {% extends "wiki/article.html" %}
{% load wiki_tags i18n humanize %} {% load wiki_tags i18n humanize %}
{% load url from future %} {% load url from future %}
{% block pagetitle %}{% trans "History of" %} "{{ attachment.current_revision.get_filename }}"{% endblock %} {% block pagetitle %}{% trans "History of" %} "{{ attachment.current_revision.get_filename }}"{% endblock %}
{% block wiki_breadcrumbs %} {% block wiki_contents_tab %}
{% include "wiki/includes/breadcrumbs.html" %}
{% endblock %}
{% block wiki_contents %}
<div class="tabbable tabs-top" style="margin-top: 20px;"> <h2>{% trans "History of" %} "{{ attachment.current_revision.get_filename }}"</h2>
<ul class="nav nav-tabs"> <table class="table table-striped table-bordered">
{% with "attachments" as selected %}
{% include "wiki/includes/article_menu.html" %}
{% endwith %}
<li>
<h1 style="margin-top: -10px;">
{{ article.current_revision.title }}
</h1>
</li>
</ul>
<div class="tab-content">
<h2>{% trans "History of" %} "{{ attachment.current_revision.get_filename }}"</h2>
<table class="table table-striped table-bordered">
<tr> <tr>
<th>{% trans "Date" %}</th> <th>{% trans "Date" %}</th>
<th>{% trans "User" %}</th> <th>{% trans "User" %}</th>
...@@ -32,7 +16,7 @@ ...@@ -32,7 +16,7 @@
<th>{% trans "Size" %}</th> <th>{% trans "Size" %}</th>
<th style="text-align: right">{% trans "Action" %}</th> <th style="text-align: right">{% trans "Action" %}</th>
</tr> </tr>
{% for revision in revisions %} {% for revision in revisions %}
<tr> <tr>
<td> <td>
{{ revision.created }} {{ revision.created }}
...@@ -60,17 +44,9 @@ ...@@ -60,17 +44,9 @@
</form> </form>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
<a href="{% url 'wiki:attachments_index' path=urlpath.path article_id=article.id %}"><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 class="tabbable tabs-below" style="margin-top: 20px;">
<ul class="nav nav-tabs">
<li style="margin-top: 10px;"><em>{% trans "Article last modified:" %} {{ article.current_revision.modified }}</em></li>
</ul>
</div>
{% endblock %} {% endblock %}
{% extends "wiki/base.html" %} {% extends "wiki/article.html" %}
{% load wiki_tags i18n humanize %} {% load wiki_tags i18n humanize %}
{% load url from future %} {% load url from future %}
{% block pagetitle %}{% trans "Attachments" %}: {{ article.current_revision.title }}{% endblock %} {% block pagetitle %}{% trans "Attachments" %}: {{ article.current_revision.title }}{% endblock %}
{% block wiki_breadcrumbs %} {% block wiki_contents_tab %}
{% include "wiki/includes/breadcrumbs.html" %} <div class="row-fluid">
{% endblock %}
{% block wiki_contents %}
<div class="tabbable tabs-top" style="margin-top: 20px;">
<ul class="nav nav-tabs">
{% with "attachments" as selected %}
{% include "wiki/includes/article_menu.html" %}
{% endwith %}
<li>
<h1 style="margin-top: -10px;">
{{ article.current_revision.title }}
</h1>
</li>
</ul>
<div class="tab-content">
<div class="row-fluid">
<div class="span7"> <div class="span7">
<p class="lead">{% trans "The following files are available for this article. Copy the markdown tag to directly refer to a file from the article text." %}</p> <p class="lead">{% trans "The following files are available for this article. Copy the markdown tag to directly refer to a file from the article text." %}</p>
{% for attachment in attachments %} {% for attachment in attachments %}
...@@ -135,16 +118,7 @@ ...@@ -135,16 +118,7 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div>
</div>
<div class="tabbable tabs-below" style="margin-top: 20px;">
<ul class="nav nav-tabs">
<li style="margin-top: 10px;"><em>{% trans "Article last modified:" %} {{ article.current_revision.modified }}</em></li>
</ul>
</div>
{% endblock %} {% endblock %}
{% extends "wiki/base.html" %} {% extends "wiki/article.html" %}
{% load wiki_tags i18n humanize %} {% load wiki_tags i18n humanize %}
{% load url from future %} {% load url from future %}
{% block pagetitle %}{% trans "Replace" %} "{{ attachment.current_revision.get_filename }}"{% endblock %} {% block pagetitle %}{% trans "Replace" %} "{{ attachment.current_revision.get_filename }}"{% endblock %}
{% block wiki_breadcrumbs %} {% block wiki_contents_tab %}
{% include "wiki/includes/breadcrumbs.html" %}
{% endblock %}
{% block wiki_contents %} <h2>{% trans "Replace" %} "{{ attachment.current_revision.get_filename }}"</h2>
<div class="tabbable tabs-top" style="margin-top: 20px;"> {% if attachment.articles.count > 1 %}
<ul class="nav nav-tabs"> <p class="lead">
{% with "attachments" as selected %}
{% include "wiki/includes/article_menu.html" %}
{% endwith %}
<li>
<h1 style="margin-top: -10px;">
{{ article.current_revision.title }}
</h1>
</li>
</ul>
<div class="tab-content">
<h2>{% trans "Replace" %} "{{ attachment.current_revision.get_filename }}"</h2>
{% if attachment.articles.count > 1 %}
<p class="lead">
{% blocktrans with attachment.original_filename as filename %} {% blocktrans with attachment.original_filename as filename %}
Replacing an attachment means adding a new file that will be used in its place. All references to the file will be replaced by the one you upload and the file will be downloaded as <strong>{{ filename }}</strong>. Please note that this attachment is in use on other articles, you may distort contents. However, do not hestitate to take advantage of this and make replacements for the listed articles where necessary. This way of working is more efficient.... Replacing an attachment means adding a new file that will be used in its place. All references to the file will be replaced by the one you upload and the file will be downloaded as <strong>{{ filename }}</strong>. Please note that this attachment is in use on other articles, you may distort contents. However, do not hestitate to take advantage of this and make replacements for the listed articles where necessary. This way of working is more efficient....
{% endblocktrans %} {% endblocktrans %}
</p> </p>
<h3>{% trans "Articles using" %} {{ attachment.current_revision.get_filename }}</h3> <h3>{% trans "Articles using" %} {{ attachment.current_revision.get_filename }}</h3>
<ul> <ul>
{% for a in attachment.articles.all %}<li>{{ a.current_revision.title }}</li>{% endfor %} {% for a in attachment.articles.all %}<li>{{ a.current_revision.title }}</li>{% endfor %}
</ul> </ul>
<hr /> <hr />
{% else %} {% else %}
<p class="lead"> <p class="lead">
{% blocktrans with attachment.original_filename as filename %} {% blocktrans with attachment.original_filename as filename %}
Replacing an attachment means adding a new file that will be used in its place. All references to the file will be replaced by the one you upload and the file will be downloaded as <strong>{{ filename }}</strong>. Replacing an attachment means adding a new file that will be used in its place. All references to the file will be replaced by the one you upload and the file will be downloaded as <strong>{{ filename }}</strong>.
{% endblocktrans %} {% endblocktrans %}
</p> </p>
{% endif %} {% endif %}
<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 article_id=article.id %}" class="btn"> <a href="{% url 'wiki:attachments_index' path=urlpath.path article_id=article.id %}" class="btn">
...@@ -53,16 +38,6 @@ ...@@ -53,16 +38,6 @@
{% trans "Upload replacement" %} {% trans "Upload replacement" %}
</button> </button>
</div> </div>
</form> </form>
</div>
</div>
<div class="tabbable tabs-below" style="margin-top: 20px;">
<ul class="nav nav-tabs">
<li style="margin-top: 10px;"><em>{% trans "Article last modified:" %} {{ article.current_revision.modified }}</em></li>
</ul>
</div>
{% endblock %} {% endblock %}
{% extends "wiki/base.html" %} {% extends "wiki/article.html" %}
{% load wiki_tags i18n humanize %} {% load wiki_tags i18n humanize %}
{% load url from future %} {% load url from future %}
{% block pagetitle %}{% trans "Add file to" %} "{{ article.current_revision.title }}"{% endblock %} {% block pagetitle %}{% trans "Add file to" %} "{{ article.current_revision.title }}"{% endblock %}
{% block wiki_breadcrumbs %} {% block wiki_contents_tab %}
{% include "wiki/includes/breadcrumbs.html" %}
{% endblock %}
{% block wiki_contents %}
<div class="tabbable tabs-top" style="margin-top: 20px;"> <h2>{% trans "Add attachment from other article" %}</h2>
<ul class="nav nav-tabs">
{% with "attachments" as selected %}
{% include "wiki/includes/article_menu.html" %}
{% endwith %}
<li>
<h1 style="margin-top: -10px;">
{{ article.current_revision.title }}
</h1>
</li>
</ul>
<div class="tab-content">
<h2>{% trans "Add existing attachment to" %} {{ article.current_revision.title }}</h2>
<form method="GET" action="{% url 'wiki:attachments_search' path=urlpath.path article_id=article.id %}" 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>
{% trans "Search files and articles" %} {% trans "Search files and articles" %}
</button> </button>
</form> </form>
{% if attachments %} {% if attachments %}
<table class="table table-striped table-bordered"> <table class="table table-striped table-bordered">
<tr> <tr>
<th>{% trans "File" %}</th> <th>{% trans "File" %}</th>
<th>{% trans "Main article" %}</th> <th>{% trans "Main article" %}</th>
...@@ -42,7 +26,7 @@ ...@@ -42,7 +26,7 @@
<th>{% trans "Size" %}</th> <th>{% trans "Size" %}</th>
<th style="text-align: right">{% trans "Action" %}</th> <th style="text-align: right">{% trans "Action" %}</th>
</tr> </tr>
{% for attachment in attachments %} {% for attachment in attachments %}
<tr> <tr>
<td> <td>
<h4>{{ attachment.original_filename }}</h4> <h4>{{ attachment.original_filename }}</h4>
...@@ -73,27 +57,18 @@ ...@@ -73,27 +57,18 @@
</form> </form>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% else %} {% else %}
<p><em>{% trans "Your search did not return any results" %}</em></p> <p><em>{% trans "Your search did not return any results" %}</em></p>
{% endif %} {% endif %}
{% with query as appended_value and "query" as appended_key %} {% with query as appended_value and "query" as appended_key %}
{% include "wiki/includes/pagination.html" %} {% include "wiki/includes/pagination.html" %}
{% endwith %} {% endwith %}
<p> <p>
<a href="{% url 'wiki:attachments_index' path=urlpath.path article_id=article.id %}"><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 class="tabbable tabs-below" style="margin-top: 20px;">
<ul class="nav nav-tabs">
<li style="margin-top: 10px;"><em>{% trans "Article last modified:" %} {{ article.current_revision.modified }}</em></li>
</ul>
</div>
{% endblock %} {% endblock %}
...@@ -58,6 +58,7 @@ class AttachmentView(ArticleMixin, FormView): ...@@ -58,6 +58,7 @@ class AttachmentView(ArticleMixin, FormView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs['attachments'] = self.attachments kwargs['attachments'] = self.attachments
kwargs['search_form'] = forms.SearchForm() kwargs['search_form'] = forms.SearchForm()
kwargs['selected_tab'] = 'attachments'
return super(AttachmentView, self).get_context_data(**kwargs) return super(AttachmentView, self).get_context_data(**kwargs)
...@@ -76,6 +77,7 @@ class AttachmentHistoryView(ArticleMixin, TemplateView): ...@@ -76,6 +77,7 @@ class AttachmentHistoryView(ArticleMixin, TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs['attachment'] = self.attachment kwargs['attachment'] = self.attachment
kwargs['revisions'] = self.attachment.attachmentrevision_set.all().order_by('-revision_number') kwargs['revisions'] = self.attachment.attachmentrevision_set.all().order_by('-revision_number')
kwargs['selected_tab'] = 'attachments'
return super(AttachmentHistoryView, self).get_context_data(**kwargs) return super(AttachmentHistoryView, self).get_context_data(**kwargs)
...@@ -112,6 +114,7 @@ class AttachmentReplaceView(ArticleMixin, FormView): ...@@ -112,6 +114,7 @@ class AttachmentReplaceView(ArticleMixin, FormView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs['attachment'] = self.attachment kwargs['attachment'] = self.attachment
kwargs['selected_tab'] = 'attachments'
return super(AttachmentReplaceView, self).get_context_data(**kwargs) return super(AttachmentReplaceView, self).get_context_data(**kwargs)
class AttachmentDownloadView(ArticleMixin, View): class AttachmentDownloadView(ArticleMixin, View):
...@@ -127,7 +130,6 @@ class AttachmentDownloadView(ArticleMixin, View): ...@@ -127,7 +130,6 @@ class AttachmentDownloadView(ArticleMixin, View):
return super(AttachmentDownloadView, self).dispatch(request, article, *args, **kwargs) return super(AttachmentDownloadView, self).dispatch(request, article, *args, **kwargs)
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
if self.revision: if self.revision:
return send_file(request, self.revision.file.path, return send_file(request, self.revision.file.path,
self.revision.created, self.attachment.original_filename) self.revision.created, self.attachment.original_filename)
...@@ -154,6 +156,9 @@ class AttachmentChangeRevisionView(ArticleMixin, View): ...@@ -154,6 +156,9 @@ class AttachmentChangeRevisionView(ArticleMixin, View):
return redirect("wiki:attachments_index", path=self.urlpath.path, article_id=self.article.id) return redirect("wiki:attachments_index", path=self.urlpath.path, article_id=self.article.id)
def get_context_data(self, **kwargs):
kwargs['selected_tab'] = 'attachments'
return ArticleMixin.get_context_data(self, **kwargs)
class AttachmentAddView(ArticleMixin, View): class AttachmentAddView(ArticleMixin, View):
...@@ -205,6 +210,7 @@ class AttachmentDeleteView(ArticleMixin, FormView): ...@@ -205,6 +210,7 @@ class AttachmentDeleteView(ArticleMixin, FormView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs['attachment'] = self.attachment kwargs['attachment'] = self.attachment
kwargs['selected_tab'] = 'attachments'
return super(AttachmentDeleteView, self).get_context_data(**kwargs) return super(AttachmentDeleteView, self).get_context_data(**kwargs)
...@@ -239,4 +245,5 @@ class AttachmentSearchView(ArticleMixin, ListView): ...@@ -239,4 +245,5 @@ class AttachmentSearchView(ArticleMixin, ListView):
kwargs['query'] = self.query kwargs['query'] = self.query
kwargs.update(kwargs_article) kwargs.update(kwargs_article)
kwargs.update(kwargs_listview) kwargs.update(kwargs_listview)
kwargs['selected_tab'] = 'attachments'
return kwargs return kwargs
...@@ -15,23 +15,16 @@ ...@@ -15,23 +15,16 @@
<li style="float: left"> <li style="float: left">
<h1 style="margin-top: -10px;">{{ article.current_revision.title }}</h1> <h1 style="margin-top: -10px;">{{ article.current_revision.title }}</h1>
</li> </li>
{% with "view" as selected %}
{% include "wiki/includes/article_menu.html" %} {% include "wiki/includes/article_menu.html" %}
{% endwith %}
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
{% block wiki_contents_tab %}
{% wiki_render article %} {% wiki_render article %}
{% endblock %}
</div> </div>
</div> </div>
<div class="tabbable tabs-below" style="margin-top: 20px;"> <p style="margin-top: 20px;"><em>{% trans "Article last modified:" %} {{ article.current_revision.modified }}</em></p>
<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>
</div>
{% endblock %} {% endblock %}
{% extends "wiki/base.html" %} {% extends "wiki/article.html" %}
{% load wiki_tags i18n %} {% load wiki_tags i18n %}
{% load url from future %} {% load url from future %}
{% block pagetitle %}{% trans "Edit" %}: {{ article.current_revision.title }}{% endblock %} {% block pagetitle %}{% trans "Edit" %}: {{ article.current_revision.title }}{% endblock %}
{% block wiki_breadcrumbs %} {% block wiki_contents_tab %}
{% include "wiki/includes/breadcrumbs.html" %}
{% endblock %}
{% block wiki_contents %}
<div class="tabbable tabs-top" style="margin-top: 20px;"> <form method="POST" class="form-horizontal">
<ul class="nav nav-tabs">
{% with "edit" as selected %}
{% include "wiki/includes/article_menu.html" %}
{% endwith %}
<li>
<h1 style="margin-top: -10px;">
{{ article.current_revision.title }}
</h1>
</li>
</ul>
<div class="tab-content">
<form method="POST" class="form-horizontal">
{% include "wiki/includes/editor.html" %} {% include "wiki/includes/editor.html" %}
<div class="form-actions"> <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='{% url 'wiki:preview' path=urlpath.path article_id=article.id %}'"> <button type="submit" name="preview" value="1" class="btn btn-large" onclick="$('#previewModal').modal('show'); this.form.target='previewWindow'; this.form.action='{% url 'wiki:preview' path=urlpath.path article_id=article.id %}'">
...@@ -57,15 +40,7 @@ ...@@ -57,15 +40,7 @@
</div> </div>
</div> </div>
</form> </form>
</div>
</div>
<div class="tabbable tabs-below" style="margin-top: 20px;">
<ul class="nav nav-tabs">
<li style="margin-top: 10px;"><em>{% trans "Article last modified:" %} {{ article.current_revision.modified }}</em></li>
</ul>
</div>
{% endblock %} {% endblock %}
{% extends "wiki/base.html" %} {% extends "wiki/article.html" %}
{% 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.current_revision.title }}{% endblock %} {% block pagetitle %}{% trans "History" %}: {{ article.current_revision.title }}{% endblock %}
{% block wiki_breadcrumbs %} {% block wiki_contents_tab %}
{% include "wiki/includes/breadcrumbs.html" %}
{% endblock %}
{% block wiki_contents %}
{% addtoblock "js" %} {% addtoblock "js" %}
<script type="text/javascript" src="{{ STATIC_URL }}wiki/js/diffview.js"></script> <script type="text/javascript" src="{{ STATIC_URL }}wiki/js/diffview.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}wiki/js/diff.js"></script> <script type="text/javascript" src="{{ STATIC_URL }}wiki/js/diff.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready( $(document).ready(
function() { function() {
$('.accordion input[disabled!="disabled"][type="radio"]').first().attr('checked', 'true'); $('.accordion input[disabled!="disabled"][type="radio"]').first().attr('checked', 'true');
...@@ -21,10 +17,10 @@ ...@@ -21,10 +17,10 @@
$('.modal-body').css('height', $(window).height()*0.70 + 'px'); $('.modal-body').css('height', $(window).height()*0.70 + 'px');
$('.modal').css('max-height', $(window).height() + 'px'); $('.modal').css('max-height', $(window).height() + 'px');
}); });
</script> </script>
{% endaddtoblock %} {% endaddtoblock %}
{% addtoblock "css" %} {% addtoblock "css" %}
<style type="text/css"> <style type="text/css">
td.linenumber { td.linenumber {
width: 20px; width: 20px;
} }
...@@ -53,20 +49,11 @@ ...@@ -53,20 +49,11 @@
.diff-container table { .diff-container table {
border-top: 1px solid #DDD; border-top: 1px solid #DDD;
} }
</style> </style>
{% endaddtoblock %} {% endaddtoblock %}
<div class="tabbable tabs-top" style="margin-top: 20px;">
<ul class="nav nav-tabs">
{% with "history" as selected %} <form method="GET">
{% include "wiki/includes/article_menu.html" %}
{% endwith %}
<li>
<h1 style="margin-top: -10px;">
{{ article.current_revision.title }}
</h1>
</li>
</ul>
<form method="GET">
<div class="tab-content" style="overflow: visible;"> <div class="tab-content" style="overflow: visible;">
{% for revision in revisions %} {% for revision in revisions %}
<div class="accordion" id="accordion{{ revision.revision_number }}"> <div class="accordion" id="accordion{{ revision.revision_number }}">
...@@ -211,15 +198,7 @@ ...@@ -211,15 +198,7 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
</form> </form>
</div>
<div style="clear:both"></div>
<div class="tabbable tabs-below" style="margin-top: 30px;">
<ul class="nav nav-tabs">
<li style="margin-top: 10px;"><em>{% trans "Article last modified:" %} {{ article.current_revision.modified }}</em></li>
</ul>
</div>
{% endblock %} {% endblock %}
{% load i18n wiki_tags %}{% load url from future %} {% load i18n wiki_tags %}{% load url from future %}
{% with selected_tab as selected %}
{% 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 %}">
...@@ -36,3 +38,5 @@ ...@@ -36,3 +38,5 @@
{% trans "View" %} {% trans "View" %}
</a> </a>
</li> </li>
{% endwith %}
...@@ -20,7 +20,7 @@ from django.core.urlresolvers import reverse ...@@ -20,7 +20,7 @@ from django.core.urlresolvers import reverse
from django.db import transaction from django.db import transaction
from wiki.core.exceptions import NoRootURL from wiki.core.exceptions import NoRootURL
class ArticleView(ArticleMixin, TemplateView, ): class ArticleView(ArticleMixin, TemplateView):
template_name="wiki/article.html" template_name="wiki/article.html"
...@@ -28,6 +28,9 @@ class ArticleView(ArticleMixin, TemplateView, ): ...@@ -28,6 +28,9 @@ class ArticleView(ArticleMixin, TemplateView, ):
def dispatch(self, request, article, *args, **kwargs): def dispatch(self, request, article, *args, **kwargs):
return super(ArticleView, self).dispatch(request, article, *args, **kwargs) return super(ArticleView, self).dispatch(request, article, *args, **kwargs)
def get_context_data(self, **kwargs):
kwargs['selected_tab'] = 'view'
return ArticleMixin.get_context_data(self, **kwargs)
class Create(FormView, ArticleMixin): class Create(FormView, ArticleMixin):
...@@ -181,6 +184,7 @@ class Edit(FormView, ArticleMixin): ...@@ -181,6 +184,7 @@ class Edit(FormView, ArticleMixin):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs['edit_form'] = kwargs.pop('form', None) kwargs['edit_form'] = kwargs.pop('form', None)
kwargs['editor'] = editors.editor kwargs['editor'] = editors.editor
kwargs['selected_tab'] = 'edit'
return super(Edit, self).get_context_data(**kwargs) return super(Edit, self).get_context_data(**kwargs)
...@@ -200,6 +204,7 @@ class History(ListView, ArticleMixin): ...@@ -200,6 +204,7 @@ class History(ListView, ArticleMixin):
kwargs_listview = ListView.get_context_data(self, **kwargs) kwargs_listview = ListView.get_context_data(self, **kwargs)
kwargs.update(kwargs_article) kwargs.update(kwargs_article)
kwargs.update(kwargs_listview) kwargs.update(kwargs_listview)
kwargs['selected_tab'] = 'history'
return kwargs return kwargs
@method_decorator(get_article(can_read=True)) @method_decorator(get_article(can_read=True))
...@@ -267,6 +272,7 @@ class Settings(ArticleMixin, TemplateView): ...@@ -267,6 +272,7 @@ class Settings(ArticleMixin, TemplateView):
return redirect('wiki:settings', article_id=self.article.id) return redirect('wiki:settings', article_id=self.article.id)
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs['selected_tab'] = 'settings'
kwargs['forms'] = self.forms kwargs['forms'] = self.forms
return super(Settings, self).get_context_data(**kwargs) return super(Settings, self).get_context_data(**kwargs)
......
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