mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-11 00:33:17 +00:00
Move/re-namespace existing users forms, templates, urls, views
This commit is contained in:
parent
7286692c39
commit
f0e1b7b6b2
11 changed files with 30 additions and 30 deletions
|
|
@ -17,7 +17,7 @@
|
|||
<ul class="filter-options">
|
||||
<li><a href="{% url 'wagtailimages_index' %}?q={{ query_string|urlencode }}" class="icon icon-image">{% trans "Images" %}</a></li>
|
||||
<li><a href="{% url 'wagtaildocs_index' %}?q={{ query_string|urlencode }}" class="icon icon-doc-full-inverse">{% trans "Documents" %}</a></li>
|
||||
<li><a href="{% url 'wagtailusers_index' %}?q={{ query_string|urlencode }}" class="icon icon-user">{% trans "Users" %}</a></li>
|
||||
<li><a href="{% url 'wagtailusers_users_index' %}?q={{ query_string|urlencode }}" class="icon icon-user">{% trans "Users" %}</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<li><a href="#roles">{% trans "Roles" %}</a></li>
|
||||
</ul>
|
||||
|
||||
<form action="{% url 'wagtailusers_create' %}" method="POST">
|
||||
<form action="{% url 'wagtailusers_users_create' %}" method="POST">
|
||||
<div class="tab-content">
|
||||
{% csrf_token %}
|
||||
<section id="account" class="active nice-padding">
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<li><a href="#roles">{% trans "Roles" %}</a></li>
|
||||
</ul>
|
||||
|
||||
<form action="{% url 'wagtailusers_edit' user.id %}" method="POST">
|
||||
<form action="{% url 'wagtailusers_users_edit' user.id %}" method="POST">
|
||||
<div class="tab-content">
|
||||
{% csrf_token %}
|
||||
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
{% block extra_js %}
|
||||
<script>
|
||||
window.headerSearch = {
|
||||
url: "{% url 'wagtailusers_index' %}",
|
||||
url: "{% url 'wagtailusers_users_index' %}",
|
||||
termInput: "#id_q",
|
||||
targetOutput: "#user-results"
|
||||
}
|
||||
|
|
@ -16,11 +16,11 @@
|
|||
{% block content %}
|
||||
{% trans "Users" as users_str %}
|
||||
{% trans "Add a user" as add_a_user_str %}
|
||||
{% include "wagtailadmin/shared/header.html" with title=users_str add_link="wagtailusers_create" add_text=add_a_user_str icon="user" search_url="wagtailusers_index" %}
|
||||
{% include "wagtailadmin/shared/header.html" with title=users_str add_link="wagtailusers_users_create" add_text=add_a_user_str icon="user" search_url="wagtailusers_users_index" %}
|
||||
|
||||
<div class="nice-padding">
|
||||
<div id="user-results" class="users">
|
||||
{% include "wagtailusers/results.html" %}
|
||||
{% include "wagtailusers/users/results.html" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -6,17 +6,17 @@
|
|||
<th class="name">
|
||||
{% trans "Name" %}
|
||||
{% if ordering == "name" %}
|
||||
<a href="{% url 'wagtailusers_index' %}" class="icon icon-arrow-down-after teal"></a>
|
||||
<a href="{% url 'wagtailusers_users_index' %}" class="icon icon-arrow-down-after teal"></a>
|
||||
{% else %}
|
||||
<a href="{% url 'wagtailusers_index' %}?ordering=name" class="icon icon-arrow-down-after"></a>
|
||||
<a href="{% url 'wagtailusers_users_index' %}?ordering=name" class="icon icon-arrow-down-after"></a>
|
||||
{% endif %}
|
||||
</th>
|
||||
<th class="username">
|
||||
{% trans "Username" %}
|
||||
{% if ordering == "username" %}
|
||||
<a href="{% url 'wagtailusers_index' %}" class="icon icon-arrow-down-after teal"></a>
|
||||
<a href="{% url 'wagtailusers_users_index' %}" class="icon icon-arrow-down-after teal"></a>
|
||||
{% else %}
|
||||
<a href="{% url 'wagtailusers_index' %}?ordering=username" class="icon icon-arrow-down-after"></a>
|
||||
<a href="{% url 'wagtailusers_users_index' %}?ordering=username" class="icon icon-arrow-down-after"></a>
|
||||
{% endif %}
|
||||
</th>
|
||||
<th class="level">{% trans "Level" %}</th>
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
<td class="title">
|
||||
<h2>
|
||||
<span class="avatar small icon icon-user"><img src="{% gravatar_url user.email 25 %}" /></span>
|
||||
<a href="{% url 'wagtailusers_edit' user.id %}">{{ user.get_full_name|default:user.username }}</a>
|
||||
<a href="{% url 'wagtailusers_users_edit' user.id %}">{{ user.get_full_name|default:user.username }}</a>
|
||||
</h2>
|
||||
</td>
|
||||
<td class="username">{{ user.username }}</td>
|
||||
|
|
@ -10,9 +10,9 @@
|
|||
</h2>
|
||||
{% endif %}
|
||||
|
||||
{% include "wagtailusers/list.html" %}
|
||||
{% include "wagtailusers/users/list.html" %}
|
||||
|
||||
{% include "wagtailadmin/shared/pagination_nav.html" with items=users is_searching=is_searching linkurl="wagtailusers_index" %}
|
||||
{% include "wagtailadmin/shared/pagination_nav.html" with items=users is_searching=is_searching linkurl="wagtailusers_users_index" %}
|
||||
{% else %}
|
||||
{% if is_searching %}
|
||||
<p>{% blocktrans %}Sorry, no users match "<em>{{ query_string }}</em>"{% endblocktrans %}</p>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
from django.conf.urls import url
|
||||
from wagtail.wagtailusers.views import users
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', users.index, name='wagtailusers_index'),
|
||||
url(r'^new/$', users.create, name='wagtailusers_create'),
|
||||
url(r'^(\d+)/$', users.edit, name='wagtailusers_edit'),
|
||||
]
|
||||
0
wagtail/wagtailusers/urls/__init__.py
Normal file
0
wagtail/wagtailusers/urls/__init__.py
Normal file
8
wagtail/wagtailusers/urls/users.py
Normal file
8
wagtail/wagtailusers/urls/users.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
from django.conf.urls import url
|
||||
from wagtail.wagtailusers.views import users
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', users.index, name='wagtailusers_users_index'),
|
||||
url(r'^new/$', users.create, name='wagtailusers_users_create'),
|
||||
url(r'^(\d+)/$', users.edit, name='wagtailusers_users_edit'),
|
||||
]
|
||||
|
|
@ -60,14 +60,14 @@ def index(request):
|
|||
users = paginator.page(paginator.num_pages)
|
||||
|
||||
if request.is_ajax():
|
||||
return render(request, "wagtailusers/results.html", {
|
||||
return render(request, "wagtailusers/users/results.html", {
|
||||
'users': users,
|
||||
'is_searching': is_searching,
|
||||
'query_string': q,
|
||||
'ordering': ordering,
|
||||
})
|
||||
else:
|
||||
return render(request, "wagtailusers/index.html", {
|
||||
return render(request, "wagtailusers/users/index.html", {
|
||||
'search_form': form,
|
||||
'users': users,
|
||||
'is_searching': is_searching,
|
||||
|
|
@ -82,13 +82,13 @@ def create(request):
|
|||
if form.is_valid():
|
||||
user = form.save()
|
||||
messages.success(request, _("User '{0}' created.").format(user))
|
||||
return redirect('wagtailusers_index')
|
||||
return redirect('wagtailusers_users_index')
|
||||
else:
|
||||
messages.error(request, _("The user could not be created due to errors.") )
|
||||
else:
|
||||
form = UserCreationForm()
|
||||
|
||||
return render(request, 'wagtailusers/create.html', {
|
||||
return render(request, 'wagtailusers/users/create.html', {
|
||||
'form': form,
|
||||
})
|
||||
|
||||
|
|
@ -101,13 +101,13 @@ def edit(request, user_id):
|
|||
if form.is_valid():
|
||||
user = form.save()
|
||||
messages.success(request, _("User '{0}' updated.").format(user))
|
||||
return redirect('wagtailusers_index')
|
||||
return redirect('wagtailusers_users_index')
|
||||
else:
|
||||
messages.error(request, _("The user could not be saved due to errors."))
|
||||
else:
|
||||
form = UserEditForm(instance=user)
|
||||
|
||||
return render(request, 'wagtailusers/edit.html', {
|
||||
return render(request, 'wagtailusers/users/edit.html', {
|
||||
'user': user,
|
||||
'form': form,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ from django.utils.translation import ugettext_lazy as _
|
|||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.wagtailadmin.menu import MenuItem
|
||||
|
||||
from wagtail.wagtailusers import urls
|
||||
from wagtail.wagtailusers.urls import users
|
||||
|
||||
|
||||
def register_admin_urls():
|
||||
return [
|
||||
url(r'^users/', include(urls)),
|
||||
url(r'^users/', include(users)),
|
||||
]
|
||||
hooks.register('register_admin_urls', register_admin_urls)
|
||||
|
||||
|
|
@ -18,6 +18,6 @@ hooks.register('register_admin_urls', register_admin_urls)
|
|||
def construct_main_menu(request, menu_items):
|
||||
if request.user.has_module_perms('auth'):
|
||||
menu_items.append(
|
||||
MenuItem(_('Users'), urlresolvers.reverse('wagtailusers_index'), classnames='icon icon-user', order=600)
|
||||
MenuItem(_('Users'), urlresolvers.reverse('wagtailusers_users_index'), classnames='icon icon-user', order=600)
|
||||
)
|
||||
hooks.register('construct_main_menu', construct_main_menu)
|
||||
|
|
|
|||
Loading…
Reference in a new issue