kopia lustrzana https://github.com/wagtail/wagtail
Merge remote-tracking branch 'upstream/master'
commit
9c3dbbaec4
|
@ -93,17 +93,6 @@ $(function(){
|
|||
});
|
||||
});
|
||||
|
||||
$(".nav-main .more > a").bind('click keydown', function(){
|
||||
var currentAlt = $(this).data('altstate');
|
||||
var newAlt = $(this).html();
|
||||
|
||||
$(this).html(currentAlt);
|
||||
$(this).data('altstate', newAlt);
|
||||
$(this).toggleClass('icon-arrow-up icon-arrow-down');
|
||||
$(this).parent().find('ul').toggle('fast');
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#menu-search input').bind('focus', function(){
|
||||
$('#menu-search').addClass('focussed');
|
||||
}).bind('blur', function(){
|
||||
|
|
|
@ -226,19 +226,6 @@ img{
|
|||
}
|
||||
}
|
||||
|
||||
.more{
|
||||
border:0;
|
||||
|
||||
> a{
|
||||
&:before{
|
||||
margin-right:0.4em;
|
||||
}
|
||||
font-size:0.8em;
|
||||
padding:0.2em 1.2em;
|
||||
background-color:$color-grey-1-1;
|
||||
}
|
||||
}
|
||||
|
||||
.avatar{
|
||||
display:none;
|
||||
}
|
||||
|
@ -312,10 +299,6 @@ img{
|
|||
}
|
||||
}
|
||||
|
||||
.js .nav-main .more ul{
|
||||
display:none;
|
||||
}
|
||||
|
||||
.explorer{
|
||||
position:absolute;
|
||||
margin-top:70px;
|
||||
|
|
|
@ -229,4 +229,24 @@
|
|||
<tr><td colspan="3" class="no-results-message"><p>{% trans "No pages have been created." %}{% if parent_page and parent_page_perms.can_add_subpage %} {% blocktrans %}Why not <a href="{{ add_page_url }}">add one</a>?{% endblocktrans %}{% endif %}</td></tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
{% if parent_page and pages and pages.paginator %}
|
||||
<div class="pagination">
|
||||
<p>{% blocktrans with page_number=pages.number num_pages=pages.paginator.num_pages%}
|
||||
Page {{ page_number }} of {{ num_pages }}.
|
||||
{% endblocktrans %}</p>
|
||||
<ul>
|
||||
<li class="prev">
|
||||
{% if pages.has_previous %}
|
||||
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?p={{ pages.previous_page_number }}{% if ordering %}&ordering={{ ordering }}{% endif %}" class="icon icon-arrow-left">{% trans "Previous" %}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="next">
|
||||
{% if pages.has_next %}
|
||||
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?p={{ pages.next_page_number }}{% if ordering %}&ordering={{ ordering }}{% endif %}" class="icon icon-arrow-right-after">{% trans 'Next' %}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
|
@ -10,19 +10,5 @@
|
|||
<div class="avatar icon icon-user"><a href="{% url 'wagtailadmin_account' %}" title="{% trans 'Account settings' %}">{% if request.user.email %}<img src="{% gravatar_url request.user.email %}" />{% endif %}</a></div>
|
||||
<a href="{% url 'wagtailadmin_logout' %}">{% trans "Log out" %}</a>
|
||||
</li>
|
||||
{% if request.user.is_superuser %} {# for now, 'More' links will be superuser-only #}
|
||||
<li class="more">
|
||||
<a href="#" class="icon icon-arrow-down" data-altstate="{% trans 'Less' %}">{% trans 'More' %}</a>
|
||||
<ul>
|
||||
<li class="menu-redirects"><a href="{% url 'wagtailredirects_index' %}" class="icon icon-redirect">{% trans 'Redirects' %}</a></li>
|
||||
<li class="menu-editorspicks"><a href="{% url 'wagtailsearch_editorspicks_index' %}" class="icon icon-pick">{% trans 'Editors Picks' %}</a></li>
|
||||
{% get_wagtailadmin_tab_urls as wagtailadmin_tab_urls %}
|
||||
{% for name, title in wagtailadmin_tab_urls %}
|
||||
<li class="menu-{{ title|slugify }}"><a href="{% url name %}" class="icon icon-{{name}}">{{ title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
|
|
@ -26,17 +26,6 @@ def explorer_subnav(nodes):
|
|||
}
|
||||
|
||||
|
||||
@register.assignment_tag
|
||||
def get_wagtailadmin_tab_urls():
|
||||
resolver = urlresolvers.get_resolver(None)
|
||||
return [
|
||||
(key, value[2].get("title", key))
|
||||
for key, value
|
||||
in resolver.reverse_dict.items()
|
||||
if isinstance(key, basestring) and key.startswith('wagtailadmin_tab_')
|
||||
]
|
||||
|
||||
|
||||
@register.inclusion_tag('wagtailadmin/shared/main_nav.html', takes_context=True)
|
||||
def main_nav(context):
|
||||
menu_items = [
|
||||
|
|
|
@ -25,7 +25,7 @@ class TestPageExplorer(TestCase):
|
|||
response = self.client.get(reverse('wagtailadmin_explore', args=(self.root_page.id, )))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(self.root_page, response.context['parent_page'])
|
||||
self.assertTrue(response.context['pages'].filter(id=self.child_page.id).exists())
|
||||
self.assertTrue(response.context['pages'].paginator.object_list.filter(id=self.child_page.id).exists())
|
||||
|
||||
|
||||
class TestPageCreation(TestCase):
|
||||
|
|
|
@ -33,6 +33,17 @@ def index(request, parent_page_id=None):
|
|||
else:
|
||||
ordering = 'title'
|
||||
|
||||
# Pagination
|
||||
if ordering != 'ord':
|
||||
p = request.GET.get('p', 1)
|
||||
paginator = Paginator(pages, 50)
|
||||
try:
|
||||
pages = paginator.page(p)
|
||||
except PageNotAnInteger:
|
||||
pages = paginator.page(1)
|
||||
except EmptyPage:
|
||||
pages = paginator.page(paginator.num_pages)
|
||||
|
||||
return render(request, 'wagtailadmin/pages/index.html', {
|
||||
'parent_page': parent_page,
|
||||
'ordering': ordering,
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
from django.core import urlresolvers
|
||||
from django.conf.urls import include, url
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from wagtail.wagtailadmin import hooks
|
||||
from wagtail.wagtailredirects import urls
|
||||
|
||||
from wagtail.wagtailadmin.menu import MenuItem
|
||||
|
||||
|
||||
def register_admin_urls():
|
||||
return [
|
||||
url(r'^redirects/', include(urls)),
|
||||
]
|
||||
hooks.register('register_admin_urls', register_admin_urls)
|
||||
|
||||
|
||||
def construct_main_menu(request, menu_items):
|
||||
# TEMPORARY: Only show if the user is a superuser
|
||||
if request.user.is_superuser:
|
||||
menu_items.append(
|
||||
MenuItem(_('Redirects'), urlresolvers.reverse('wagtailredirects_index'), classnames='icon icon-redirect', order=800)
|
||||
)
|
||||
hooks.register('construct_main_menu', construct_main_menu)
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
from django.core import urlresolvers
|
||||
from django.conf.urls import include, url
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from wagtail.wagtailadmin import hooks
|
||||
from wagtail.wagtailsearch.urls import admin as admin_urls
|
||||
|
||||
from wagtail.wagtailadmin.menu import MenuItem
|
||||
|
||||
|
||||
def register_admin_urls():
|
||||
return [
|
||||
url(r'^search/', include(admin_urls)),
|
||||
]
|
||||
hooks.register('register_admin_urls', register_admin_urls)
|
||||
|
||||
|
||||
def construct_main_menu(request, menu_items):
|
||||
# TEMPORARY: Only show if the user is a superuser
|
||||
if request.user.is_superuser:
|
||||
menu_items.append(
|
||||
MenuItem(_('Editors picks'), urlresolvers.reverse('wagtailsearch_editorspicks_index'), classnames='icon icon-pick', order=900)
|
||||
)
|
||||
hooks.register('construct_main_menu', construct_main_menu)
|
||||
|
|
Ładowanie…
Reference in New Issue