Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ab87f4fc
authored
Sep 09, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: autocomplete for group members
parent
b61a5728
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
15 deletions
+25
-15
circle/dashboard/forms.py
+9
-0
circle/dashboard/static/dashboard/dashboard.css
+5
-1
circle/dashboard/templates/dashboard/group-detail.html
+2
-3
circle/dashboard/views.py
+9
-11
No files found.
circle/dashboard/forms.py
View file @
ab87f4fc
...
@@ -1063,6 +1063,15 @@ class AclUserOrGroupAddForm(forms.Form):
...
@@ -1063,6 +1063,15 @@ class AclUserOrGroupAddForm(forms.Form):
class
AddGroupMemberForm
(
forms
.
Form
):
new_member
=
forms
.
CharField
(
widget
=
autocomplete_light
.
TextWidget
(
'AclUserAutocomplete'
,
autocomplete_js_attributes
=
{
"placeholder"
:
_
(
"Name of user"
)},
attrs
=
{
'class'
:
'form-control'
}),
label
=
_
(
"E-mail address or identifier of user"
))
class
UserKeyForm
(
forms
.
ModelForm
):
class
UserKeyForm
(
forms
.
ModelForm
):
name
=
forms
.
CharField
(
required
=
True
,
label
=
_
(
'Name'
))
name
=
forms
.
CharField
(
required
=
True
,
label
=
_
(
'Name'
))
key
=
forms
.
CharField
(
key
=
forms
.
CharField
(
...
...
circle/dashboard/static/dashboard/dashboard.css
View file @
ab87f4fc
...
@@ -591,11 +591,15 @@ footer a, footer a:hover, footer a:visited {
...
@@ -591,11 +591,15 @@ footer a, footer a:hover, footer a:visited {
width
:
100px
;
width
:
100px
;
}
}
#group-detail-user-table
tr
:last-child
td
:nth-child
(
2
)
{
text-align
:
left
;
}
#group-detail-perm-header
{
#group-detail-perm-header
{
margin-top
:
25px
;
margin-top
:
25px
;
}
}
textarea
[
name
=
"
list-new-namelist
"
]
{
textarea
[
name
=
"
new_members
"
]
{
max-width
:
500px
;
max-width
:
500px
;
min-height
:
80px
;
min-height
:
80px
;
margin-bottom
:
10px
;
margin-bottom
:
10px
;
...
...
circle/dashboard/templates/dashboard/group-detail.html
View file @
ab87f4fc
...
@@ -89,13 +89,12 @@
...
@@ -89,13 +89,12 @@
<tr>
<tr>
<td><i
class=
"fa fa-plus"
></i></td>
<td><i
class=
"fa fa-plus"
></i></td>
<td
colspan=
"2"
>
<td
colspan=
"2"
>
<input
type=
"text"
class=
"form-control"
name=
"list-new-name"
{{addmemberform.new_member}}
placeholder=
"{% trans "
Name
of
user
"
%}"
>
</td>
</td>
</tr>
</tr>
</tbody>
</tbody>
</table>
</table>
<textarea
name=
"
list-new-namelist
"
class=
"form-control"
<textarea
name=
"
new_members
"
class=
"form-control"
placeholder=
"{% trans "
Add
multiple
users
at
once
(
one
identifier
per
line
)."
%}"
></textarea>
placeholder=
"{% trans "
Add
multiple
users
at
once
(
one
identifier
per
line
)."
%}"
></textarea>
<div
class=
"form-actions"
>
<div
class=
"form-actions"
>
<button
type=
"submit"
class=
"btn btn-success"
>
{% trans "Save" %}
</button>
<button
type=
"submit"
class=
"btn btn-success"
>
{% trans "Save" %}
</button>
...
...
circle/dashboard/views.py
View file @
ab87f4fc
...
@@ -72,7 +72,8 @@ from .forms import (
...
@@ -72,7 +72,8 @@ from .forms import (
CirclePasswordChangeForm
,
VmCreateDiskForm
,
VmDownloadDiskForm
,
CirclePasswordChangeForm
,
VmCreateDiskForm
,
VmDownloadDiskForm
,
TraitsForm
,
RawDataForm
,
GroupPermissionForm
,
AclUserOrGroupAddForm
,
TraitsForm
,
RawDataForm
,
GroupPermissionForm
,
AclUserOrGroupAddForm
,
VmResourcesForm
,
VmAddInterfaceForm
,
VmListSearchForm
,
VmResourcesForm
,
VmAddInterfaceForm
,
VmListSearchForm
,
TemplateListSearchForm
,
ConnectCommandForm
TemplateListSearchForm
,
ConnectCommandForm
,
TransferOwnershipForm
,
AddGroupMemberForm
)
)
from
.tables
import
(
from
.tables
import
(
...
@@ -1283,6 +1284,7 @@ class GroupDetailView(CheckedDetailView):
...
@@ -1283,6 +1284,7 @@ class GroupDetailView(CheckedDetailView):
self
.
object
.
profile
,
self
.
request
.
user
,
self
.
object
.
profile
,
self
.
request
.
user
,
'dashboard.views.group-acl'
)
'dashboard.views.group-acl'
)
context
[
'aclform'
]
=
AclUserOrGroupAddForm
()
context
[
'aclform'
]
=
AclUserOrGroupAddForm
()
context
[
'addmemberform'
]
=
AddGroupMemberForm
()
context
[
'group_profile_form'
]
=
GroupProfileUpdate
.
get_form_object
(
context
[
'group_profile_form'
]
=
GroupProfileUpdate
.
get_form_object
(
self
.
request
,
self
.
object
.
profile
)
self
.
request
,
self
.
object
.
profile
)
...
@@ -1299,17 +1301,15 @@ class GroupDetailView(CheckedDetailView):
...
@@ -1299,17 +1301,15 @@ class GroupDetailView(CheckedDetailView):
if
request
.
POST
.
get
(
'new_name'
):
if
request
.
POST
.
get
(
'new_name'
):
return
self
.
__set_name
(
request
)
return
self
.
__set_name
(
request
)
if
request
.
POST
.
get
(
'
list-new-name
'
):
if
request
.
POST
.
get
(
'
new_member
'
):
return
self
.
__add_user
(
request
)
return
self
.
__add_user
(
request
)
if
request
.
POST
.
get
(
'
list-new-namelist
'
):
if
request
.
POST
.
get
(
'
new_members
'
):
return
self
.
__add_list
(
request
)
return
self
.
__add_list
(
request
)
if
(
request
.
POST
.
get
(
'list-new-name'
)
is
not
None
)
and
\
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
(
request
.
POST
.
get
(
'list-new-namelist'
)
is
not
None
):
kwargs
=
{
'pk'
:
self
.
get_object
()
.
pk
}))
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
kwargs
=
{
'pk'
:
self
.
get_object
()
.
pk
}))
def
__add_user
(
self
,
request
):
def
__add_user
(
self
,
request
):
name
=
request
.
POST
[
'
list-new-name
'
]
name
=
request
.
POST
[
'
new_member
'
]
self
.
__add_username
(
request
,
name
)
self
.
__add_username
(
request
,
name
)
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
...
@@ -1328,9 +1328,7 @@ class GroupDetailView(CheckedDetailView):
...
@@ -1328,9 +1328,7 @@ class GroupDetailView(CheckedDetailView):
messages
.
warning
(
request
,
_
(
'User "
%
s" not found.'
)
%
name
)
messages
.
warning
(
request
,
_
(
'User "
%
s" not found.'
)
%
name
)
def
__add_list
(
self
,
request
):
def
__add_list
(
self
,
request
):
if
not
self
.
get_has_level
()(
request
.
user
,
'operator'
):
userlist
=
request
.
POST
.
get
(
'new_members'
)
.
split
(
'
\r\n
'
)
raise
PermissionDenied
()
userlist
=
request
.
POST
.
get
(
'list-new-namelist'
)
.
split
(
'
\r\n
'
)
for
line
in
userlist
:
for
line
in
userlist
:
self
.
__add_username
(
request
,
line
)
self
.
__add_username
(
request
,
line
)
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment