Commit 72165849 by benjaoming

Browsing levels and adding articles to either current or parent level so users…

Browsing levels and adding articles to either current or parent level so users dont get confused about the hierarchy
parent c83ad432
...@@ -115,7 +115,7 @@ class ArticleFkManager(models.Manager): ...@@ -115,7 +115,7 @@ class ArticleFkManager(models.Manager):
class URLPathEmptyQuerySet(EmptyQuerySet, ArticleFkEmptyQuerySetMixin): class URLPathEmptyQuerySet(EmptyQuerySet, ArticleFkEmptyQuerySetMixin):
def select_related_common(self): def select_related_common(self):
return self return self
......
{% extends "wiki/article.html" %}
{% load wiki_tags i18n humanize %}
{% load url from future %}
{% block pagetitle %}{% trans "Listing articles in" %} {{ article.current_revision.title }}{% endblock %}
{% block wiki_contents_tab %}
<p class="lead">
{% with paginator.object_list.count as cnt %}
{% blocktrans with article.current_revision.title as title and cnt|pluralize:_("article,articles") as articles_plur and cnt|pluralize:_("is,are") as articles_plur_verb %}
There {{ articles_plur_verb }} <strong>{{ cnt }} {{ articles_plur }}</strong> in the "{{ title }}" level.
{% endblocktrans %}
{% endwith %}
</p>
<p>
{% if urlpath.parent %}
<a href="{% url 'wiki:dir' path=urlpath.parent.path %}" class="btn">
<span class="icon-arrow-up"></span>
{% trans "Go up one level" %}
</a>
{% endif %}
<a href="{% url 'wiki:get' path=urlpath.path %}" class="btn">
<span class="icon-arrow-right"></span>
{% trans "View article" %}
</a>
<a href="{% url 'wiki:create' path=urlpath.path %}" class="btn">
<span class="icon-plus"></span>
{% trans "Add article in this level" %}
</a>
</p>
<table class="table table-striped">
<tr>
<th>{% trans "Title" %}</th>
<th>{% trans "Last modified" %}</th>
</tr>
{% for article in articles %}
<tr>
<td>
<a href="{% url 'wiki:dir' path=article.path %}"> {{ article.article.current_revision.title }} </a>
</td>
<td>
{{ article.article.current_revision.created|naturaltime }}
</td>
</tr>
{% empty%}
<tr>
<td colspan="100">
<em>{% trans "There are no articles in this level" %}</em>
</td>
</tr>
{% endfor %}
</table>
{% include "wiki/includes/pagination.html" %}
{% endblock %}
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<div class="btn-group"> <div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#" style="padding: 7px;" title="{% trans "Sub-articles for" %} {{ article.current_revision.title }}"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#" style="padding: 7px;" title="{% trans "Sub-articles for" %} {{ article.current_revision.title }}">
<span class="icon-list"></span> <span class="icon-list"></span>
<span class="caret"></span> <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% for child in children_slice %} {% for child in children_slice %}
...@@ -30,16 +30,32 @@ ...@@ -30,16 +30,32 @@
{% endif %} {% endif %}
<li class="divider"></li> <li class="divider"></li>
<li> <li>
<a href="{% url 'wiki:list' path=urlpath.path %}">{% trans "List sub-pages" %} &raquo;</a> <a href="{% url 'wiki:dir' path=urlpath.path %}">{% trans "Browse articles in this level" %} &raquo;</a>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="pull-left" style="margin-left: 10px;"> <div class="pull-left" style="margin-left: 10px;">
<a class="btn" href="{% url 'wiki:create' path=urlpath.path %}" style="padding: 7px;"> <div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#" style="padding: 7px;" title="{% trans "Sub-articles for" %} {{ article.current_revision.title }}">
<span class="icon-plus"></span> <span class="icon-plus"></span>
{% trans "Add article" %} <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu">
<li>
{% if urlpath.parent %}
<a href="{% url 'wiki:create' path=urlpath.parent.path %}" style="padding: 7px;">
<span class="icon-arrow-right"></span>
{% trans "New article next to" %} {{ article.current_revision.title }}
</a>
{% endif %}
<a href="{% url 'wiki:create' path=urlpath.path %}" style="padding: 7px;">
<span class="icon-arrow-down"></span>
{% trans "New article below" %} {{ article.current_revision.title }}
</a>
</li>
</ul>
</div>
</div> </div>
<div style="clear: both"></div> <div style="clear: both"></div>
{% endif %} {% endif %}
{% extends "wiki/article.html" %}
{% load wiki_tags i18n sekizai_tags %}
{% load url from future %}
{% block pagetitle %}{% trans "Sub-articles of" %} {{ article.current_revision.title }}{% endblock %}
{% block wiki_contents_tab %}
<ul>
{% for article in articles %}
<li>
<a href="{% url 'wiki:get' child.path %}"> {{ article.article.current_revision.title }} </a>
</li>
{% endfor %}
</ul>
{% include "wiki/includes/pagination.html" %}
{% endblock %}
...@@ -55,7 +55,7 @@ urlpatterns += patterns('', ...@@ -55,7 +55,7 @@ urlpatterns += patterns('',
url('^(?P<path>.+/|)_edit/$', article.Edit.as_view(), name='edit'), url('^(?P<path>.+/|)_edit/$', article.Edit.as_view(), name='edit'),
url('^(?P<path>.+/|)_preview/$', article.Preview.as_view(), name='preview'), url('^(?P<path>.+/|)_preview/$', article.Preview.as_view(), name='preview'),
url('^(?P<path>.+/|)_history/$', article.History.as_view(), name='history'), url('^(?P<path>.+/|)_history/$', article.History.as_view(), name='history'),
url('^(?P<path>.+/|)_list/$', article.List.as_view(), name='list'), url('^(?P<path>.+/|)_dir/$', article.Dir.as_view(), name='dir'),
url('^(?P<path>.+/|)_settings/$', article.Settings.as_view(), name='settings'), url('^(?P<path>.+/|)_settings/$', article.Settings.as_view(), name='settings'),
url('^(?P<path>.+/|)_revision/change/(?P<revision_id>\d+)/$', 'wiki.views.article.change_revision', name='change_revision'), url('^(?P<path>.+/|)_revision/change/(?P<revision_id>\d+)/$', 'wiki.views.article.change_revision', name='change_revision'),
url('^(?P<path>.+/|)_revision/merge/(?P<revision_id>\d+)/$', 'wiki.views.article.merge', name='merge_revision'), url('^(?P<path>.+/|)_revision/merge/(?P<revision_id>\d+)/$', 'wiki.views.article.merge', name='merge_revision'),
......
...@@ -391,11 +391,12 @@ class History(ListView, ArticleMixin): ...@@ -391,11 +391,12 @@ class History(ListView, ArticleMixin):
return super(History, self).dispatch(request, article, *args, **kwargs) return super(History, self).dispatch(request, article, *args, **kwargs)
class List(ListView, ArticleMixin): class Dir(ListView, ArticleMixin):
template_name="wiki/list.html" template_name="wiki/dir.html"
allow_empty = True allow_empty = True
context_object_name = 'articles' context_object_name = 'articles'
model = models.URLPath
paginate_by = 30 paginate_by = 30
def get_queryset(self): def get_queryset(self):
...@@ -417,9 +418,13 @@ class List(ListView, ArticleMixin): ...@@ -417,9 +418,13 @@ class List(ListView, ArticleMixin):
return kwargs return kwargs
def get_template_names(self):
#WHY IS THIS CALLED???????
return [self.__class__.template_name]
@method_decorator(get_article(can_read=True)) @method_decorator(get_article(can_read=True))
def dispatch(self, request, article, *args, **kwargs): def dispatch(self, request, article, *args, **kwargs):
return super(List, self).dispatch(request, article, *args, **kwargs) return super(Dir, self).dispatch(request, article, *args, **kwargs)
class Plugin(View): class Plugin(View):
......
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