Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3dda2ca0
authored
Mar 07, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix group-details member-removing ajax
parent
86c09737
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
12 deletions
+74
-12
circle/dashboard/static/dashboard/group-details.js
+41
-1
circle/dashboard/templates/dashboard/confirm/ajax-remove.html
+22
-0
circle/dashboard/templates/dashboard/group-detail.html
+3
-3
circle/dashboard/urls.py
+3
-3
circle/dashboard/views.py
+5
-5
No files found.
circle/dashboard/static/dashboard/group-details.js
View file @
3dda2ca0
/* rename */
/* rename */
$
(
"#group-details-h1-name, .group-details-rename-button"
).
click
(
function
()
{
$
(
"#group-details-h1-name, .group-details-rename-button"
).
click
(
function
()
{
$
(
"#group-details-h1-name"
).
hide
();
$
(
"#group-details-h1-name"
).
hide
();
...
@@ -25,3 +24,44 @@
...
@@ -25,3 +24,44 @@
});
});
return
false
;
return
false
;
});
});
/* for Node removes buttons */
$
(
'.delete-from-group'
).
click
(
function
()
{
var
href
=
$
(
this
).
attr
(
'href'
);
var
group
=
$
(
this
).
data
(
'group_pk'
);
var
member
=
$
(
this
).
data
(
'member_pk'
);
var
dir
=
window
.
location
.
pathname
.
indexOf
(
'list'
)
==
-
1
;
addModalConfirmation
(
removeMember
,
{
'url'
:
href
,
'data'
:
[],
'group_pk'
:
group
,
'member_pk'
:
member
,
'type'
:
"user"
,
'redirect'
:
dir
});
return
false
;
});
function
removeMember
(
data
)
{
$
.
ajax
({
type
:
'POST'
,
url
:
data
[
'url'
],
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
re
,
textStatus
,
xhr
)
{
if
(
!
data
[
'redirect'
])
{
selected
=
[];
addMessage
(
re
[
'message'
],
'success'
);
$
(
'a[data-'
+
data
[
'type'
]
+
'-pk="'
+
data
[
'pk'
]
+
'"]'
).
closest
(
'tr'
).
fadeOut
(
function
()
{
$
(
this
).
remove
();
});
}
else
{
window
.
location
.
replace
(
'/dashboard'
);
}
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
'Uh oh :('
,
'danger'
)
}
});
}
circle/dashboard/templates/dashboard/confirm/ajax-remove.html
0 → 100644
View file @
3dda2ca0
{% load i18n %}
<div
class=
"modal fade"
id=
"confirmation-modal"
tabindex=
"-1"
role=
"dialog"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-body"
>
{% if text %}
{{ text }}
{% else %}
{%blocktrans with object=object%}
Are you sure you want to remove
<strong>
{{ member }}
</strong>
from
<strong>
{{ object }}
</strong>
?
{%endblocktrans%}
{% endif %}
<br
/>
<div
class=
"pull-right"
style=
"margin-top: 15px;"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
Cancel
</button>
<button
id=
"confirmation-modal-button"
type=
"button"
class=
"btn btn-warning"
>
Remove
</button>
</div>
<div
class=
"clearfix"
></div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
circle/dashboard/templates/dashboard/group-detail.html
View file @
3dda2ca0
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
<thead><tr><th></th><th>
{% trans "Who" %}
</th><th></th><th></th></tr></thead>
<thead><tr><th></th><th>
{% trans "Who" %}
</th><th></th><th></th></tr></thead>
{% for i in users %}
{% for i in users %}
<tr><td><i
class=
"icon-user"
></i></td><td>
{{i.username}}
</td>
<tr><td><i
class=
"icon-user"
></i></td><td>
{{i.username}}
</td>
<td><a
data-group
member-pk=
"{{i.pk}}"
href=
"{% url "
dashboard
.
views
.
remove-user
"
user_pk=
i.pk
group_pk=
group.pk
%}?
next=
{{
request
.
path
}}"
class=
"real-link groupmember-delete
btn btn-link btn-xs"
><i
class=
"icon-remove"
><span
class=
"sr-only"
>
{% trans "remove" %}
</span></i></a></td></tr>
<td><a
data-group
_pk=
"{{ group.pk }}"
data-member_pk=
"{{i.pk}}"
href=
"{% url "
dashboard
.
views
.
remove-user
"
member_pk=
i.pk
group_pk=
group.pk
%}?
next=
{{
request
.
path
}}"
class=
"real-link delete-from-group
btn btn-link btn-xs"
><i
class=
"icon-remove"
><span
class=
"sr-only"
>
{% trans "remove" %}
</span></i></a></td></tr>
{% endfor %}
{% endfor %}
<tr><td><i
class=
"icon-plus"
></i></td>
<tr><td><i
class=
"icon-plus"
></i></td>
<td><input
type=
"text"
class=
"form-control"
name=
"list-new-name"
<td><input
type=
"text"
class=
"form-control"
name=
"list-new-name"
...
@@ -66,7 +66,7 @@
...
@@ -66,7 +66,7 @@
<option
{%
if
id =
i.level%}
selected=
"selected"
{%
endif
%}
value=
"{{id}}"
>
{{name}}
</option>
<option
{%
if
id =
i.level%}
selected=
"selected"
{%
endif
%}
value=
"{{id}}"
>
{{name}}
</option>
{% endfor %}
{% endfor %}
</select></td>
</select></td>
<td
class=
"user-remove"
><a
data-group
aclmember-pk=
"{{i.user.id}}"
href=
"{% url "
dashboard
.
views
.
remove-acluser
"
user_pk=
i.user.pk
group_pk=
group.pk
%}?
next=
{{
request
.
path
}}"
class=
"real-link groupacl-delete
btn btn-link btn-xs"
><i
class=
"icon-remove"
><span
class=
"sr-only"
>
{% trans "remove" %}
</span></i></a></td></tr>
<td
class=
"user-remove"
><a
data-group
_pk=
"{{ group.pk }}"
data-member_pk=
"{{i.user.pk }}"
href=
"{% url "
dashboard
.
views
.
remove-acluser
"
member_pk=
i.user.pk
group_pk=
group.pk
%}?
next=
{{
request
.
path
}}"
class=
"real-link delete-from-group
btn btn-link btn-xs"
><i
class=
"icon-remove"
><span
class=
"sr-only"
>
{% trans "remove" %}
</span></i></a></td></tr>
{% endfor %}
{% endfor %}
{% for i in acl.groups %}
{% for i in acl.groups %}
<tr><td><i
class=
"icon-user"
></i></td><td>
{{ i.group }}
</td>
<tr><td><i
class=
"icon-user"
></i></td><td>
{{ i.group }}
</td>
...
@@ -75,7 +75,7 @@
...
@@ -75,7 +75,7 @@
<option
{%
if
id =
i.level%}
selected=
"selected"
{%
endif
%}
value=
"{{id}}"
>
{{name}}
</option>
<option
{%
if
id =
i.level%}
selected=
"selected"
{%
endif
%}
value=
"{{id}}"
>
{{name}}
</option>
{% endfor %}
{% endfor %}
</select></td>
</select></td>
<td
class=
"user-remove"
><a
data-group
aclmember-pk=
"{{i.group.pk }}"
href=
"{% url "
dashboard
.
views
.
remove-aclgroup
"
user_pk=
i.group.pk
group_pk=
group.pk
%}?
next=
{{
request
.
path
}}"
class=
"real-link groupacl-delete
btn btn-link btn-xs"
><i
class=
"icon-remove"
><span
class=
"sr-only"
>
{% trans "remove" %}
</span></i></a></td></tr>
<td
class=
"user-remove"
><a
data-group
_pk=
"{{ i.pk }}"
data-member_pk=
"{{i.group.pk }}"
href=
"{% url "
dashboard
.
views
.
remove-aclgroup
"
member_pk=
i.group.pk
group_pk=
group.pk
%}?
next=
{{
request
.
path
}}"
class=
"real-link delete-from-group
btn btn-link btn-xs"
><i
class=
"icon-remove"
><span
class=
"sr-only"
>
{% trans "remove" %}
</span></i></a></td></tr>
{% endfor %}
{% endfor %}
<tr><td><i
class=
"icon-plus"
></i></td>
<tr><td><i
class=
"icon-plus"
></i></td>
<td><input
type=
"text"
class=
"form-control"
name=
"perm-new-name"
<td><input
type=
"text"
class=
"form-control"
name=
"perm-new-name"
...
...
circle/dashboard/urls.py
View file @
3dda2ca0
...
@@ -103,13 +103,13 @@ urlpatterns = patterns(
...
@@ -103,13 +103,13 @@ urlpatterns = patterns(
name
=
"dashboard.views.disk-add"
),
name
=
"dashboard.views.disk-add"
),
url
(
r'^profile/$'
,
MyPreferencesView
.
as_view
(),
url
(
r'^profile/$'
,
MyPreferencesView
.
as_view
(),
name
=
"dashboard.views.profile"
),
name
=
"dashboard.views.profile"
),
url
(
r'^group/(?P<group_pk>\d+)/remove/acl/user/(?P<
us
er_pk>\d+)/$'
,
url
(
r'^group/(?P<group_pk>\d+)/remove/acl/user/(?P<
memb
er_pk>\d+)/$'
,
GroupRemoveAclUserView
.
as_view
(),
GroupRemoveAclUserView
.
as_view
(),
name
=
"dashboard.views.remove-acluser"
),
name
=
"dashboard.views.remove-acluser"
),
url
(
r'^group/(?P<group_pk>\d+)/remove/acl/group/(?P<
us
er_pk>\d+)/$'
,
url
(
r'^group/(?P<group_pk>\d+)/remove/acl/group/(?P<
memb
er_pk>\d+)/$'
,
GroupRemoveAclGroupView
.
as_view
(),
GroupRemoveAclGroupView
.
as_view
(),
name
=
"dashboard.views.remove-aclgroup"
),
name
=
"dashboard.views.remove-aclgroup"
),
url
(
r'^group/(?P<group_pk>\d+)/remove/user/(?P<
us
er_pk>\d+)/$'
,
url
(
r'^group/(?P<group_pk>\d+)/remove/user/(?P<
memb
er_pk>\d+)/$'
,
GroupRemoveUserView
.
as_view
(),
GroupRemoveUserView
.
as_view
(),
name
=
"dashboard.views.remove-user"
),
name
=
"dashboard.views.remove-user"
),
url
(
r'^group/create/$'
,
GroupCreate
.
as_view
(),
url
(
r'^group/create/$'
,
GroupCreate
.
as_view
(),
...
...
circle/dashboard/views.py
View file @
3dda2ca0
...
@@ -1012,7 +1012,7 @@ class GroupRemoveUserView(LoginRequiredMixin, DeleteView):
...
@@ -1012,7 +1012,7 @@ class GroupRemoveUserView(LoginRequiredMixin, DeleteView):
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
GroupRemoveUserView
,
self
)
.
get_context_data
(
**
kwargs
)
context
=
super
(
GroupRemoveUserView
,
self
)
.
get_context_data
(
**
kwargs
)
try
:
try
:
context
[
'member'
]
=
User
.
objects
.
get
(
pk
=
self
.
us
er_pk
)
context
[
'member'
]
=
User
.
objects
.
get
(
pk
=
self
.
memb
er_pk
)
except
User
.
DoesNotExist
:
except
User
.
DoesNotExist
:
raise
Http404
()
raise
Http404
()
return
context
return
context
...
@@ -1024,8 +1024,8 @@ class GroupRemoveUserView(LoginRequiredMixin, DeleteView):
...
@@ -1024,8 +1024,8 @@ class GroupRemoveUserView(LoginRequiredMixin, DeleteView):
else
:
else
:
return
reverse_lazy
(
'dashboard.views.group-list'
)
return
reverse_lazy
(
'dashboard.views.group-list'
)
def
get
(
self
,
request
,
us
er_pk
,
*
args
,
**
kwargs
):
def
get
(
self
,
request
,
memb
er_pk
,
*
args
,
**
kwargs
):
self
.
user_pk
=
us
er_pk
self
.
member_pk
=
memb
er_pk
return
super
(
GroupRemoveUserView
,
self
)
.
get
(
request
,
*
args
,
**
kwargs
)
return
super
(
GroupRemoveUserView
,
self
)
.
get
(
request
,
*
args
,
**
kwargs
)
def
get_template_names
(
self
):
def
get_template_names
(
self
):
...
@@ -1042,7 +1042,7 @@ class GroupRemoveUserView(LoginRequiredMixin, DeleteView):
...
@@ -1042,7 +1042,7 @@ class GroupRemoveUserView(LoginRequiredMixin, DeleteView):
return
_
(
"Member successfully removed from group!"
)
return
_
(
"Member successfully removed from group!"
)
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
self
.
remove_member
(
kwargs
[
"
us
er_pk"
])
self
.
remove_member
(
kwargs
[
"
memb
er_pk"
])
success_url
=
self
.
get_success_url
()
success_url
=
self
.
get_success_url
()
success_message
=
self
.
get_success_message
()
success_message
=
self
.
get_success_message
()
...
@@ -1071,7 +1071,7 @@ class GroupRemoveAclGroupView(GroupRemoveUserView):
...
@@ -1071,7 +1071,7 @@ class GroupRemoveAclGroupView(GroupRemoveUserView):
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
GroupRemoveUserView
,
self
)
.
get_context_data
(
**
kwargs
)
context
=
super
(
GroupRemoveUserView
,
self
)
.
get_context_data
(
**
kwargs
)
try
:
try
:
context
[
'member'
]
=
Group
.
objects
.
get
(
pk
=
self
.
us
er_pk
)
context
[
'member'
]
=
Group
.
objects
.
get
(
pk
=
self
.
memb
er_pk
)
except
User
.
DoesNotExist
:
except
User
.
DoesNotExist
:
raise
Http404
()
raise
Http404
()
return
context
return
context
...
...
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