mirror of https://github.com/jumpserver/jumpserver
Update context name path1, path2 => app, action
parent
0a9e4a5e85
commit
641e998504
|
@ -28,19 +28,19 @@
|
||||||
|
|
||||||
<div class="row wrapper border-bottom white-bg page-heading">
|
<div class="row wrapper border-bottom white-bg page-heading">
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<h2>{{ title }}</h2>
|
<h2></h2>
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li>
|
<li>
|
||||||
<a href="">仪表盘</a>
|
<a href="">仪表盘</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
{% if path1 %}
|
{% if app %}
|
||||||
<a>{{ path1 }}</a>
|
<a>{{ app }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% if path2 %}
|
{% if action %}
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<strong>{{ path2 }}</strong>
|
<strong>{{ action }}</strong>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ol>
|
</ol>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<div class="ibox float-e-margins">
|
<div class="ibox float-e-margins">
|
||||||
<div class="ibox-title">
|
<div class="ibox-title">
|
||||||
<h5> {{ path2 }} </h5>
|
<h5> {{ action }} </h5>
|
||||||
<div class="ibox-tools">
|
<div class="ibox-tools">
|
||||||
<a class="collapise-link">
|
<a class="collapise-link">
|
||||||
<i class="fa fa-chevron-up"></i>
|
<i class="fa fa-chevron-up"></i>
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
<i class="fa fa-group"></i> <span class="nav-label">用户管理</span><span class="fa arrow"></span>
|
<i class="fa fa-group"></i> <span class="nav-label">用户管理</span><span class="fa arrow"></span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="nav nav-second-level active">
|
<ul class="nav nav-second-level active">
|
||||||
<li class="user"><a href="{% url 'users:user-list' %}">用户列表</a></li>
|
<li class="users"><a href="{% url 'users:user-list' %}">用户列表</a></li>
|
||||||
<li class="usergroup"><a href="{% url 'users:usergroup-list' %}">用户组列表</a></li>
|
<li class="usergroups"><a href="{% url 'users:usergroup-list' %}">用户组列表</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li id="">
|
<li id="">
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
|
|
||||||
from django.conf.urls import url, include
|
|
||||||
import api
|
|
||||||
|
|
||||||
app_name = 'users'
|
|
||||||
|
|
||||||
urlpatterns = [
|
|
||||||
url(r'^v1/users/$', api.UserListAddApi.as_view(), name='user-list-api'),
|
|
||||||
url(r'^v1/users/(?P<pk>[0-9]+)/$', api.UserDetailDeleteUpdateApi.as_view(), name='user-detail-api'),
|
|
||||||
url(r'^v1/usergroups/$', api.UserGroupListAddApi.as_view(), name='usergroup-list-api'),
|
|
||||||
url(r'^v1/usergroups/(?P<pk>[0-9]+)/$', api.UserGroupDetailDeleteUpdateApi.as_view(), name='usergroup-detail-api'),
|
|
||||||
]
|
|
|
@ -134,8 +134,11 @@
|
||||||
<td><span style="float: right">
|
<td><span style="float: right">
|
||||||
<div class="switch">
|
<div class="switch">
|
||||||
<div class="onoffswitch">
|
<div class="onoffswitch">
|
||||||
<input type="checkbox" checked class="onoffswitch-checkbox"
|
{% if user.is_active %}
|
||||||
id="example1">
|
<input type="checkbox" checked class="onoffswitch-checkbox" id="example1">
|
||||||
|
{% else %}
|
||||||
|
<input type="checkbox" class="onoffswitch-checkbox" id="example1">
|
||||||
|
{% endif %}
|
||||||
<label class="onoffswitch-label" for="example1">
|
<label class="onoffswitch-label" for="example1">
|
||||||
<span class="onoffswitch-inner"></span>
|
<span class="onoffswitch-inner"></span>
|
||||||
<span class="onoffswitch-switch"></span>
|
<span class="onoffswitch-switch"></span>
|
||||||
|
|
|
@ -7,16 +7,16 @@ import api
|
||||||
app_name = 'users'
|
app_name = 'users'
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^user/$', UserListView.as_view(), name='user-list'),
|
url(r'^users/$', UserListView.as_view(), name='user-list'),
|
||||||
url(r'^user/(?P<pk>[0-9]+)/$', UserDetailView.as_view(), name='user-detail'),
|
url(r'^users/(?P<pk>[0-9]+)/$', UserDetailView.as_view(), name='user-detail'),
|
||||||
url(r'^user/add/$', UserAddView.as_view(), name='user-add'),
|
url(r'^users/add/$', UserAddView.as_view(), name='user-add'),
|
||||||
url(r'^user/(?P<pk>[0-9]+)/edit/$', UserUpdateView.as_view(), name='user-edit'),
|
url(r'^users/(?P<pk>[0-9]+)/edit/$', UserUpdateView.as_view(), name='user-edit'),
|
||||||
url(r'^user/(?P<pk>[0-9]+)/delete/$', UserDeleteView.as_view(), name='user-delete'),
|
url(r'^users/(?P<pk>[0-9]+)/delete/$', UserDeleteView.as_view(), name='user-delete'),
|
||||||
url(r'^usergroup/$', UserGroupListView.as_view(), name='usergroup-list'),
|
url(r'^usergroups/$', UserGroupListView.as_view(), name='usergroup-list'),
|
||||||
url(r'^usergroup/(?P<pk>[0-9]+)/$', UserGroupDetailView.as_view(), name='usergroup-detail'),
|
url(r'^usergroups/(?P<pk>[0-9]+)/$', UserGroupDetailView.as_view(), name='usergroup-detail'),
|
||||||
url(r'^usergroup/add/$', UserGroupAddView.as_view(), name='usergroup-add'),
|
url(r'^usergroups/add/$', UserGroupAddView.as_view(), name='usergroup-add'),
|
||||||
url(r'^usergroup/(?P<pk>[0-9]+)/edit/$', UserGroupUpdateView.as_view(), name='usergroup-edit'),
|
url(r'^usergroups/(?P<pk>[0-9]+)/edit/$', UserGroupUpdateView.as_view(), name='usergroup-edit'),
|
||||||
url(r'^usergroup/(?P<pk>[0-9]+)/delete/$', UserGroupDeleteView.as_view(), name='usergroup-delete'),
|
url(r'^usergroups/(?P<pk>[0-9]+)/delete/$', UserGroupDeleteView.as_view(), name='usergroup-delete'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class UserListView(ListView):
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(UserListView, self).get_context_data(**kwargs)
|
context = super(UserListView, self).get_context_data(**kwargs)
|
||||||
context.update({'path1': '用户管理', 'path2': '用户列表', 'title': '用户列表', 'keyword': self.keyword})
|
context.update({'app': '用户管理', 'action': '用户列表', 'keyword': self.keyword})
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class UserAddView(SuccessMessageMixin, CreateView):
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(UserAddView, self).get_context_data(**kwargs)
|
context = super(UserAddView, self).get_context_data(**kwargs)
|
||||||
context.update({'path1': '用户管理', 'path2': '用户添加', 'title': '用户添加'})
|
context.update({'app': '用户管理', 'action': '用户添加'})
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
|
@ -87,6 +87,11 @@ class UserUpdateView(UpdateView):
|
||||||
print(form.errors)
|
print(form.errors)
|
||||||
return super(UserUpdateView, self).form_invalid(form)
|
return super(UserUpdateView, self).form_invalid(form)
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super(UserUpdateView, self).get_context_data(**kwargs)
|
||||||
|
context.update({'app': '用户管理', 'action': '用户编辑'})
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
class UserDeleteView(DeleteView):
|
class UserDeleteView(DeleteView):
|
||||||
model = User
|
model = User
|
||||||
|
@ -102,7 +107,7 @@ class UserDetailView(DetailView):
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(UserDetailView, self).get_context_data(**kwargs)
|
context = super(UserDetailView, self).get_context_data(**kwargs)
|
||||||
groups = [group for group in UserGroup.objects.iterator() if group not in self.object.groups.iterator()]
|
groups = [group for group in UserGroup.objects.iterator() if group not in self.object.groups.iterator()]
|
||||||
context.update({'path1': '用户管理', 'path2': '用户详情', 'title': '用户详情', 'groups': groups})
|
context.update({'app': '用户管理', 'action': '用户详情', 'groups': groups})
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,7 +131,7 @@ class UserGroupListView(ListView):
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(UserGroupListView, self).get_context_data(**kwargs)
|
context = super(UserGroupListView, self).get_context_data(**kwargs)
|
||||||
context.update({'path1': '用户管理', 'path2': '用户组列表', 'title': '用户组列表', 'keyword': self.keyword})
|
context.update({'app': '用户管理', 'action': '用户组列表', 'keyword': self.keyword})
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,7 +144,7 @@ class UserGroupAddView(CreateView):
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(UserGroupAddView, self).get_context_data(**kwargs)
|
context = super(UserGroupAddView, self).get_context_data(**kwargs)
|
||||||
users = User.objects.all()
|
users = User.objects.all()
|
||||||
context.update({'path1': '用户管理', 'path2': '用户组添加', 'title': '用户组添加', 'users': users})
|
context.update({'app': '用户管理', 'action': '用户组添加', 'users': users})
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
|
|
Loading…
Reference in New Issue