Commit 32416cd1 by Bridger Maxwell

Merge branch 'master' of github.com:benjaoming/django-wiki

parents ce4fd7a8 59ecabd4
...@@ -9,6 +9,7 @@ from django.utils.html import escape, conditional_escape ...@@ -9,6 +9,7 @@ from django.utils.html import escape, conditional_escape
from itertools import chain from itertools import chain
from wiki import models from wiki import models
from wiki.conf import settings
from wiki.editors import getEditor from wiki.editors import getEditor
from wiki.core.diff import simple_merge from wiki.core.diff import simple_merge
from django.forms.widgets import HiddenInput from django.forms.widgets import HiddenInput
...@@ -190,6 +191,7 @@ class TextInputPrepend(forms.TextInput): ...@@ -190,6 +191,7 @@ class TextInputPrepend(forms.TextInput):
html = super(TextInputPrepend, self).render(*args, **kwargs) html = super(TextInputPrepend, self).render(*args, **kwargs)
return mark_safe('<div class="input-prepend"><span class="add-on">%s</span>%s</div>' % (self.prepend, html)) return mark_safe('<div class="input-prepend"><span class="add-on">%s</span>%s</div>' % (self.prepend, html))
class CreateForm(forms.Form): class CreateForm(forms.Form):
def __init__(self, urlpath_parent, *args, **kwargs): def __init__(self, urlpath_parent, *args, **kwargs):
...@@ -206,15 +208,19 @@ class CreateForm(forms.Form): ...@@ -206,15 +208,19 @@ class CreateForm(forms.Form):
def clean_slug(self): def clean_slug(self):
slug = self.cleaned_data['slug'] slug = self.cleaned_data['slug']
if slug[0] == "_": if slug.startswith("_"):
raise forms.ValidationError(_(u'A slug may not begin with an underscore.')) raise forms.ValidationError(_(u'A slug may not begin with an underscore.'))
already_existing_slug = models.URLPath.objects.filter(slug=slug, parent=self.urlpath_parent)
if settings.URL_CASE_SENSITIVE:
already_existing_slug = models.URLPath.objects.filter(slug=slug, parent=self.urlpath_parent)
else:
already_existing_slug = models.URLPath.objects.filter(slug__iexact=slug, parent=self.urlpath_parent)
if already_existing_slug: if already_existing_slug:
slug = already_existing_slug[0] already_urlpath = already_existing_slug[0]
if slug.article and slug.article.deleted: if already_urlpath.article and already_urlpath.article.current_revision.deleted:
raise forms.ValidationError(_(u'A deleted article with slug "%s" already exists.') % slug) raise forms.ValidationError(_(u'A deleted article with slug "%s" already exists.') % already_urlpath.slug)
else: else:
raise forms.ValidationError(_(u'A slug named "%s" already exists.') % slug) raise forms.ValidationError(_(u'A slug named "%s" already exists.') % already_urlpath.slug)
return slug return slug
......
...@@ -8,19 +8,20 @@ ...@@ -8,19 +8,20 @@
<div class="row-fluid"> <div class="row-fluid">
<div class="span8"> <div class="span8">
<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>
<table class="table table-bordered table-striped">
{% for attachment in attachments %} {% for attachment in attachments %}
<table class="table table-bordered table-striped" style="width: 100%;">
<tr> <tr>
<td colspan="4"> <th colspan="4">
<h4 style="margin: 0;"> <h4>
<a href="{% url 'wiki:attachments_download' path=urlpath.path article_id=article.id 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>
{% endif %} {% endif %}
</h4> </h4>
{{ attachment.current_revision.description }} </th>
</td>
</tr> </tr>
<tr> <tr>
<th>{% trans "Markdown tag" %}</th> <th>{% trans "Markdown tag" %}</th>
...@@ -63,14 +64,18 @@ ...@@ -63,14 +64,18 @@
</td> </td>
<td>{{ attachment.current_revision.get_size|filesizeformat }}</td> <td>{{ attachment.current_revision.get_size|filesizeformat }}</td>
</tr> </tr>
</table>
{% empty %} {% empty %}
<p style="margin-bottom: 20px;"><em>{% trans "There are no attachments for this article." %}</em></p> <tr>
<td>
<p style="margin-bottom: 20px;"><em>{% trans "There are no attachments for this article." %}</em></p>
</td>
</tr>
{% endfor %} {% endfor %}
</table>
</div> </div>
{% if article|can_write:user %} {% if article|can_write:user %}
<div class="span4" style="min-width: 330px;"> <div class="span4" style="min-width: 330px;">
<div class="accordion" id="accordion_upload"> <div class="accordion">
<div class="accordion-group"> <div class="accordion-group">
...@@ -96,11 +101,9 @@ ...@@ -96,11 +101,9 @@
</div> </div>
</div> </div>
</div>
<div class="accordion" id="accordion_add">
<div class="accordion-group"> <div class="accordion-group">
<div class="accordion-heading"> <div class="accordion-heading">
<a class="accordion-toggle" href="#collapse_add" data-toggle="collapse"> <a class="accordion-toggle" data-toggle="collapse">
<h3>{% trans "Search and add file" %} <span class="icon-plus-sign"></span></h3> <h3>{% trans "Search and add file" %} <span class="icon-plus-sign"></span></h3>
</a> </a>
</div> </div>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<div class="" style="margin-top: 20px;"> <div class="" style="margin-top: 20px;">
<ul class="nav nav-pills" style="border-bottom: 1px solid #EEE;"> <ul class="nav nav-pills" style="border-bottom: 1px solid #EEE;">
<li class="pull-left"> <li class="pull-left">
<h1 style="margin-top: -10px;"> <h1 id="article-title">
{{ article.current_revision.title }} {{ article.current_revision.title }}
<small style="font-size: 14px;"> <small style="font-size: 14px;">
{% if urlpath.parent %} {% if urlpath.parent %}
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<!-- Le styles --> <!-- Le styles -->
<link href="{{ STATIC_URL }}wiki/bootstrap/css/bootstrap.css" rel="stylesheet"> <link href="{{ STATIC_URL }}wiki/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="{{ STATIC_URL }}wiki/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
<!-- TODO: Put all this stuff in Less --> <!-- TODO: Put all this stuff in Less -->
<style media="print"> <style media="print">
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
#id_title {font-size: 20px; height: 30px; padding: 6px; width: 98%;} #id_title {font-size: 20px; height: 30px; padding: 6px; width: 98%;}
#id_summary {width: 98%; padding: 6px;} #id_summary {width: 98%; padding: 6px;}
.table { font-size: 90%;} h1#article-title {font-size: 2em; margin-top: -5px;}
#article_edit_form label {max-width: 100px;} #article_edit_form label {max-width: 100px;}
#article_edit_form .controls {margin-left: 120px;} #article_edit_form .controls {margin-left: 120px;}
...@@ -37,6 +38,8 @@ ...@@ -37,6 +38,8 @@
#attachment_form #id_description #attachment_form #id_description
{ width: 95% } { width: 95% }
#edit_sidebar .accordion {margin-bottom: 5px;}
.wiki-article div.toc { .wiki-article div.toc {
margin: 10px 0; margin: 10px 0;
background: #f9f9f9; background: #f9f9f9;
...@@ -44,8 +47,8 @@ ...@@ -44,8 +47,8 @@
width: 300px; width: 300px;
border: 1px solid #CCC; border: 1px solid #CCC;
} }
.wiki-article a.linknotfound {color: #C00;} .wiki-article a.linknotfound {color: #C87;}
.wiki-article pre { .wiki-article pre {
max-width: 700px; max-width: 700px;
...@@ -72,7 +75,6 @@ ...@@ -72,7 +75,6 @@
} }
.breadcrumb .icon-bar:first-child{margin-top: 0;} .breadcrumb .icon-bar:first-child{margin-top: 0;}
</style> </style>
<link href="{{ STATIC_URL }}wiki/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
<script src="{{ STATIC_URL }}wiki/js/jquery.min.js"></script> <script src="{{ STATIC_URL }}wiki/js/jquery.min.js"></script>
<script src="{{ STATIC_URL }}wiki/js/core.js"></script> <script src="{{ STATIC_URL }}wiki/js/core.js"></script>
...@@ -142,7 +144,9 @@ ...@@ -142,7 +144,9 @@
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
<header class="jumbotron subhead" id="overview">
adasd
</header>
<div class="container" style="margin-top: 60px;"> <div class="container" style="margin-top: 60px;">
{% if messages %} {% if messages %}
{% for message in messages %} {% for message in messages %}
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</form> </form>
</div> </div>
<div class="span4"> <div class="span4" id="edit_sidebar">
{% include "wiki/includes/editor_sidebar.html" %} {% include "wiki/includes/editor_sidebar.html" %}
</div> </div>
......
{% for plugin, plugin_form in sidebar %}
<div class="accordion" id="accordion_{{ plugin.slug }}"> <div class="accordion" id="accordion_{{ plugin.slug }}">
{% for plugin, plugin_form in sidebar %}
<div class="accordion-group"> <div class="accordion-group">
<div class="accordion-heading"> <div class="accordion-heading">
<a class="accordion-toggle" href="#collapse_{{ plugin.slug }}" data-toggle="collapse"> <a class="accordion-toggle" href="#collapse_{{ plugin.slug }}" data-toggle="collapse">
<h3 style="margin: 0;">{{ plugin.sidebar.headline }} <span class="{{ plugin.sidebar.icon_class }}"></span></h3> <h3>{{ plugin.sidebar.headline }} <span class="{{ plugin.sidebar.icon_class }}"></span></h3>
</a> </a>
</div> </div>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</div> </div>
</div> </div>
{% endfor %}
</div> </div>
{% endfor %}
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