move admin_site_links out of default/site (fixes failed NoReverseMatch tests for me)

This commit is contained in:
Chris Van 2013-03-21 21:41:44 -07:00
Родитель 390f30d97f
Коммит 9957cfad7b
8 изменённых файлов: 45 добавлений и 76 удалений

42
apps/zadmin/helpers.py Normal file
Просмотреть файл

@ -0,0 +1,42 @@
from jingo import register
from amo.urlresolvers import reverse
@register.function
def admin_site_links():
return {
'addons': [
('Search for add-ons by name or id', reverse('zadmin.addon-search')),
('Featured add-ons', reverse('zadmin.features')),
('Discovery Pane promo modules', reverse('discovery.module_admin')),
('Monthly Pick', reverse('zadmin.monthly_pick')),
('Upgrade jetpack add-ons', reverse('zadmin.jetpack')),
('Bulk add-on validation', reverse('zadmin.validation')),
('Fake mail', reverse('zadmin.mail')),
('Flagged reviews', reverse('zadmin.flagged')),
('ACR Reports', reverse('zadmin.compat')),
('Email Add-on Developers', reverse('zadmin.email_devs')),
],
'users': [
('Configure groups', reverse('admin:access_group_changelist')),
],
'settings': [
('View site settings', reverse('zadmin.settings')),
('Django admin pages', reverse('zadmin.home')),
('Site Events', reverse('zadmin.site_events')),
('Update prices', reverse('zadmin.price_tiers')),
],
'tools': [
('View request environment', reverse('amo.env')),
('Manage elasticsearch', reverse('zadmin.elastic')),
('Purge data from memcache', reverse('zadmin.memcache')),
('Purge pages from zeus', reverse('zadmin.hera')),
('Create a new OAuth Consumer',
reverse('zadmin.oauth-consumer-create')),
('View event log', reverse('admin:editors_eventlog_changelist')),
('View addon log', reverse('admin:devhub_activitylog_changelist')),
('Generate error', reverse('zadmin.generate-error')),
('Site Status', reverse('amo.monitor')),
],
}

Просмотреть файл

@ -24,7 +24,6 @@ data-default-locale="en-us"
{% block search_form %} {% block search_form %}
{% endblock %} {% endblock %}
{% set links = admin_site_links() %}
{% macro ul(links, section) %} {% macro ul(links, section) %}
<ul> <ul>
{% for title, link in links[section] %} {% for title, link in links[section] %}
@ -33,6 +32,8 @@ data-default-locale="en-us"
</ul> </ul>
{% endmacro %} {% endmacro %}
{% set links = mkt_admin_site_links() if settings.MARKETPLACE else admin_site_links() %}
{% block navbar %} {% block navbar %}
<div id="navbar"> <div id="navbar">
<ul class="top"> <ul class="top">

Просмотреть файл

@ -1,4 +1,3 @@
from lib.settings_base import * from lib.settings_base import *
ROOT_URLCONF = 'default.urls' ROOT_URLCONF = 'default.urls'
INSTALLED_APPS += ('default.site',)

Просмотреть файл

Просмотреть файл

@ -1,48 +0,0 @@
from django.conf import settings
from jingo import register
from amo.helpers import url
from mkt.site.helpers import admin_site_links as mkt_admin_site_links
@register.function
def admin_site_links():
if settings.MARKETPLACE:
return mkt_admin_site_links()
return {
'addons': [
('Search for add-ons by name or id', url('zadmin.addon-search')),
('Featured add-ons', url('zadmin.features')),
('Discovery Pane promo modules', url('discovery.module_admin')),
('Monthly Pick', url('zadmin.monthly_pick')),
('Upgrade jetpack add-ons', url('zadmin.jetpack')),
('Bulk add-on validation', url('zadmin.validation')),
('Fake mail', url('zadmin.mail')),
('Flagged reviews', url('zadmin.flagged')),
('ACR Reports', url('zadmin.compat')),
('Email Add-on Developers', url('zadmin.email_devs')),
],
'users': [
('Configure groups', url('admin:access_group_changelist')),
],
'settings': [
('View site settings', url('zadmin.settings')),
('Django admin pages', url('zadmin.home')),
('Site Events', url('zadmin.site_events')),
('Update prices', url('zadmin.price_tiers')),
],
'tools': [
('View request environment', url('amo.env')),
('Manage elasticsearch', url('zadmin.elastic')),
('Purge data from memcache', url('zadmin.memcache')),
('Purge pages from zeus', url('zadmin.hera')),
('Create a new OAuth Consumer',
url('zadmin.oauth-consumer-create')),
('View event log', url('admin:editors_eventlog_changelist')),
('View addon log', url('admin:devhub_activitylog_changelist')),
('Generate error', url('zadmin.generate-error')),
('Site Status', url('amo.monitor')),
],
}

Просмотреть файл

Просмотреть файл

@ -353,7 +353,7 @@ def timelabel(context, time):
@register.function @register.function
def admin_site_links(): def mkt_admin_site_links():
return { return {
'addons': [ 'addons': [
('Search for apps by name or id', reverse('zadmin.addon-search')), ('Search for apps by name or id', reverse('zadmin.addon-search')),

Просмотреть файл

@ -1,28 +1,3 @@
{% extends 'admin/base.html' %} {% extends 'admin/base.html' %}
{% block title %} | Marketplace Admin{% endblock %} {% block title %} | Marketplace Admin{% endblock %}
{% block navbar %}
<div id="navbar">
<ul class="top">
<li class="top">
<a href="{{ url('zadmin.home') }}" class="controller">Manage Apps</a>
{{ ul(links, 'addons') }}
</li>
<li class="top">
<a href="" class="controller">Manage Users</a>
{{ ul(links, 'users') }}
</li>
<li class="top">
<a href="" class="controller">Site Settings</a>
{{ ul(links, 'settings') }}
</li>
<li class="top">
<a href="" class="controller">Server Tools</a>
{{ ul(links, 'tools') }}
</li>
</ul>
</div>
{% endblock %}
{% block footer %}{% endblock %}