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
33e67bf5
authored
Feb 09, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
school: delete groups
parent
0016478b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
12 deletions
+48
-12
cloud/urls.py
+1
-0
one/static/cloud.js
+34
-12
one/templates/box-grouplist.html
+5
-0
school/views.py
+8
-0
No files found.
cloud/urls.py
View file @
33e67bf5
...
...
@@ -49,4 +49,5 @@ urlpatterns = patterns('',
url
(
r'^group/new/$'
,
'school.views.group_new'
,
name
=
'group_new'
),
url
(
r'^ajax/group/(?P<gid>\d+)/add/$'
,
'school.views.group_ajax_add_new_member'
,
name
=
'group_ajax_add_new_member'
),
url
(
r'^ajax/group/(?P<gid>\d+)/remove/$'
,
'school.views.group_ajax_remove_member'
,
name
=
'group_ajax_remove_member'
),
url
(
r'^ajax/group/delete/$'
,
'school.views.group_ajax_delete'
,
name
=
'group_ajax_delete'
),
)
one/static/cloud.js
View file @
33e67bf5
...
...
@@ -168,34 +168,56 @@ $(function() {
$
(
'#new-member'
).
click
(
function
()
{
$
(
'#new-member-form'
).
toggle
();
});
$
(
'#new-member-form input'
).
click
(
function
(
e
){
$
(
'#new-member-form input'
).
click
(
function
(
e
)
{
e
.
stopPropagation
();
});
$
(
'#new-member-form input[type=submit]'
).
click
(
function
(){
var
neptun
=
$
(
this
).
prev
().
val
();
$
(
'#new-member-form input[type=submit]'
).
click
(
function
()
{
var
neptun
=
$
(
this
).
prev
().
val
();
$
.
ajax
({
type
:
'POST'
,
url
:
'/ajax/group/'
+
$
(
this
).
data
(
'id'
)
+
'/add/'
,
data
:
'neptun='
+
neptun
,
url
:
'/ajax/group/'
+
$
(
this
).
data
(
'id'
)
+
'/add/'
,
data
:
'neptun='
+
neptun
,
dataType
:
'json'
,
success
:
function
(
data
){
success
:
function
(
data
)
{
window
.
location
.
reload
();
}
}).
error
(
function
(
data
){
}).
error
(
function
(
data
)
{
//TODO: fancy modal alert
alert
(
JSON
.
parse
(
data
.
responseText
).
status
);
})
});
$
(
'#group-members .remove'
).
click
(
function
(
e
){
e
.
preventDefault
();
e
.
stopPropagation
();
$
(
'#group-members .remove'
).
click
(
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
$
.
ajax
({
type
:
'POST'
,
url
:
'/ajax/group/'
+
$
(
this
).
data
(
'gid'
)
+
'/remove/'
,
data
:
'neptun='
+
$
(
this
).
data
(
'neptun'
),
success
:
function
(
data
){
url
:
'/ajax/group/'
+
$
(
this
).
data
(
'gid'
)
+
'/remove/'
,
data
:
'neptun='
+
$
(
this
).
data
(
'neptun'
),
success
:
function
(
data
)
{
window
.
location
.
reload
();
}
});
});
$
(
'#groups .delete'
).
click
(
function
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
var
gid
=
$
(
this
).
data
(
'id'
);
var
name
=
$
(
this
).
data
(
'name'
);
vm_confirm_popup
(
interpolate
(
gettext
(
'Are you sure deleting <strong>%s</strong>'
),
[
name
]),
gettext
(
'Delete'
),
function
()
{
$
.
ajax
({
type
:
'POST'
,
url
:
'/ajax/group/delete/'
,
data
:
'gid='
+
gid
,
success
:
function
()
{
window
.
location
.
reload
();
}
}).
error
(
function
()
{
window
.
location
.
reload
();
})
})
})
/**
...
...
one/templates/box-grouplist.html
View file @
33e67bf5
...
...
@@ -12,6 +12,11 @@
<li
class=
"wm"
>
<div
class=
"summary"
>
<div
class=
"name"
>
{{ group.name }}
</div>
<div
class=
"actions"
>
<a
href=
"#"
class=
"delete"
data-id=
"{{group.id}}"
data-name=
"{{group.name}}"
>
<img
src=
"/static/icons/minus-circle.png"
alt=
"{% trans "
Delete
"
%}"
/>
</a>
</div>
<div
class=
"clear"
></div>
</div>
<div
class=
"details"
>
...
...
school/views.py
View file @
33e67bf5
...
...
@@ -199,3 +199,11 @@ def group_ajax_remove_member(request, gid):
return
HttpResponse
(
json
.
dumps
({
'status'
:
'OK'
}))
@login_required
def
group_ajax_delete
(
request
):
group
=
get_object_or_404
(
Group
,
id
=
request
.
POST
[
'gid'
])
group
.
delete
()
return
HttpResponse
(
json
.
dumps
({
'status'
:
'OK'
}))
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