Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
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):
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
):
name
=
forms
.
CharField
(
required
=
True
,
label
=
_
(
'Name'
))
key
=
forms
.
CharField
(
...
...
circle/dashboard/static/dashboard/dashboard.css
View file @
ab87f4fc
...
...
@@ -591,11 +591,15 @@ footer a, footer a:hover, footer a:visited {
width
:
100px
;
}
#group-detail-user-table
tr
:last-child
td
:nth-child
(
2
)
{
text-align
:
left
;
}
#group-detail-perm-header
{
margin-top
:
25px
;
}
textarea
[
name
=
"
list-new-namelist
"
]
{
textarea
[
name
=
"
new_members
"
]
{
max-width
:
500px
;
min-height
:
80px
;
margin-bottom
:
10px
;
...
...
circle/dashboard/templates/dashboard/group-detail.html
View file @
ab87f4fc
...
...
@@ -89,13 +89,12 @@
<tr>
<td><i
class=
"fa fa-plus"
></i></td>
<td
colspan=
"2"
>
<input
type=
"text"
class=
"form-control"
name=
"list-new-name"
placeholder=
"{% trans "
Name
of
user
"
%}"
>
{{addmemberform.new_member}}
</td>
</tr>
</tbody>
</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>
<div
class=
"form-actions"
>
<button
type=
"submit"
class=
"btn btn-success"
>
{% trans "Save" %}
</button>
...
...
circle/dashboard/views.py
View file @
ab87f4fc
...
...
@@ -72,7 +72,8 @@ from .forms import (
CirclePasswordChangeForm
,
VmCreateDiskForm
,
VmDownloadDiskForm
,
TraitsForm
,
RawDataForm
,
GroupPermissionForm
,
AclUserOrGroupAddForm
,
VmResourcesForm
,
VmAddInterfaceForm
,
VmListSearchForm
,
TemplateListSearchForm
,
ConnectCommandForm
TemplateListSearchForm
,
ConnectCommandForm
,
TransferOwnershipForm
,
AddGroupMemberForm
)
from
.tables
import
(
...
...
@@ -1283,6 +1284,7 @@ class GroupDetailView(CheckedDetailView):
self
.
object
.
profile
,
self
.
request
.
user
,
'dashboard.views.group-acl'
)
context
[
'aclform'
]
=
AclUserOrGroupAddForm
()
context
[
'addmemberform'
]
=
AddGroupMemberForm
()
context
[
'group_profile_form'
]
=
GroupProfileUpdate
.
get_form_object
(
self
.
request
,
self
.
object
.
profile
)
...
...
@@ -1299,17 +1301,15 @@ class GroupDetailView(CheckedDetailView):
if
request
.
POST
.
get
(
'new_name'
):
return
self
.
__set_name
(
request
)
if
request
.
POST
.
get
(
'
list-new-name
'
):
if
request
.
POST
.
get
(
'
new_member
'
):
return
self
.
__add_user
(
request
)
if
request
.
POST
.
get
(
'
list-new-namelist
'
):
if
request
.
POST
.
get
(
'
new_members
'
):
return
self
.
__add_list
(
request
)
if
(
request
.
POST
.
get
(
'list-new-name'
)
is
not
None
)
and
\
(
request
.
POST
.
get
(
'list-new-namelist'
)
is
not
None
):
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
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
):
name
=
request
.
POST
[
'
list-new-name
'
]
name
=
request
.
POST
[
'
new_member
'
]
self
.
__add_username
(
request
,
name
)
return
redirect
(
reverse_lazy
(
"dashboard.views.group-detail"
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
...
...
@@ -1328,9 +1328,7 @@ class GroupDetailView(CheckedDetailView):
messages
.
warning
(
request
,
_
(
'User "
%
s" not found.'
)
%
name
)
def
__add_list
(
self
,
request
):
if
not
self
.
get_has_level
()(
request
.
user
,
'operator'
):
raise
PermissionDenied
()
userlist
=
request
.
POST
.
get
(
'list-new-namelist'
)
.
split
(
'
\r\n
'
)
userlist
=
request
.
POST
.
get
(
'new_members'
)
.
split
(
'
\r\n
'
)
for
line
in
userlist
:
self
.
__add_username
(
request
,
line
)
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