Commit 62b7b318 authored by makfire's avatar makfire

deletion flow setupped

parent 10bd2dd3
......@@ -824,6 +824,26 @@
$drContainer.css("opacity", "1");
})
// ---END of search in the data-review
function deleteNode(node_id)
{
a = node_id
alert(a)
$.ajax({
url:"{% url 'delete_resource' groupid %}",
type:'Get',
data:{
'node_id':node_id
},
success:function(data){
alert(data)
}
});
}
// </script>
{% endblock %}
......
......@@ -14,6 +14,7 @@
<th class="text-center right-border" colspan="3">Alignment & Level</th>
<th class="text-center right-border" colspan="7">Curate</th>
<th class="text-center right-border" colspan="3">Advance</th>
<th class="text-center right-border" colspan="2">Admin</th>
{% if title == "moderation" %}
<th class="text-center right-border" colspan="3">Moderation</th>
{% endif %}
......@@ -65,7 +66,10 @@
<th class="expand-width-3">Reading Level</th>
<th>Time Required</th>
<th class="expand-width-3 right-border">Text Complexity</th>
<!-- Admin -->
<th class="expand-width-3"> Purge </th>
<th class="expand-width-3"> Restore </th>
<!-- moderation -->
{% if title == "moderation" %}
<th class="expand-width-2">Discuss</th>
......
......@@ -291,6 +291,12 @@
</option> -->
</select>
</td>
<td class="deletedata">
<div class="button tiny exapnd" id = "{{resource.pk}}" onclick = "deleteNode('{{resource.pk}}')"> Delete </div>
<div class="button tiny exapnd" id = "{{resource.pk}}" onclick = "restoreNode('{{resource.pk}}')"> restore </div>
</td>
{% if title == "moderation" %}
......
from django.conf.urls import patterns, url
urlpatterns = patterns('gnowsys_ndf.ndf.views.trash',
url(r'^/delete/(?P<node_id>[\w-]+)$', 'trash_resource',name='trash_resource'),
)
url(r'^/delete/(?P<node_id>[\w-]+)$', 'trash_resource',name='trash_resource'),
url(r'^/delete$', 'delete_resource',name='delete_resource'),
)
......@@ -4,7 +4,7 @@ from django.shortcuts import render_to_response # , render
from django.template import RequestContext
from gnowsys_ndf.ndf.models import *
from gnowsys_ndf.ndf.views.page import *
from gnowsys_ndf.ndf.views.methods import *
......@@ -20,3 +20,9 @@ def trash_resource(request,group_id,node_id):
print "node",node.group_set
node.save()
return (eval('page')(request, group_id))
def delete_resource(request,group_id):
node_id = request.GET.getlist('node_id','')[0]
delete_node(ObjectId(node_id),deletion_type=1)
return HttpResponse("Deleted Successfully")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment