Commit 7cb3580e authored by Administrator's avatar Administrator

Merge branch 'samuel' into unstable

parents 3244f65e 6ca2ff29
/*
* jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010
* http://benalman.com/projects/jquery-dotimeout-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){var a={},c="doTimeout",d=Array.prototype.slice;$[c]=function(){return b.apply(window,[0].concat(d.call(arguments)))};$.fn[c]=function(){var f=d.call(arguments),e=b.apply(this,[c+f[0]].concat(f));return typeof f[0]==="number"||typeof f[1]==="number"?this:e};function b(l){var m=this,h,k={},g=l?$.fn:$,n=arguments,i=4,f=n[1],j=n[2],p=n[3];if(typeof f!=="string"){i--;f=l=0;j=n[1];p=n[2]}if(l){h=m.eq(0);h.data(l,k=h.data(l)||{})}else{if(f){k=a[f]||(a[f]={})}}k.id&&clearTimeout(k.id);delete k.id;function e(){if(l){h.removeData(l)}else{if(f){delete a[f]}}}function o(){k.id=setTimeout(function(){k.fn()},j)}if(p){k.fn=function(q){if(typeof p==="string"){p=g[p]}p.apply(m,d.call(n,i))===true&&!q?o():e()};o()}else{if(k.fn){j===undefined?e():k.fn(j===false);return true}else{e()}}}})(jQuery);
\ No newline at end of file
......@@ -196,6 +196,7 @@ function updateDocuments(pagenumber,pagenav) {
success: function(data) {
// console.log(data)
$('#subcorpusdiv').html(data);
return true;
}
});
}
......@@ -234,8 +235,8 @@ $.ajax({
success: function(data) {
bisarray = data.data
for(var i in bisarray) {
onebis = bisarray[i].values
BIS_dict[onebis[0]] = [bisarray[i].count , 0];// [ total amount , removed ]
untitlebis = bisarray[i].values
BIS_dict[untitlebis[0]] = [bisarray[i].count , 0];// [ total amount , removed ]
}
pr(BIS_dict)
}
......@@ -385,5 +386,6 @@ d3.csv("/chart/corpus/{{ corpus.id }}/data.csv", function (data) {
</script>
<script type="text/javascript" src="{% static "js/jquery/jquery.ba-dotimeout.min.js"%}"></script>
{% endblock %}
......@@ -6,6 +6,7 @@
<a style="cursor: pointer;" onclick="updateDocuments({{ documents.previous_page_number }},true);">previous</a>
{% endif %}
<div id="currentpage" style="display: none;">{{ documents.number }}</div>
<span class="current">
<strong>Page {{ documents.number }}</strong> of {{ documents.paginator.num_pages }}.
</span>
......@@ -45,7 +46,7 @@ function getCookie(name) {
}
function deleteNode(node_id) {
function deleteNode(node_id,title) {
$.ajax({
url: '/api/nodes/'+node_id,
type: 'DELETE',
......@@ -54,7 +55,19 @@ function deleteNode(node_id) {
},
success: function(result) {
console.log(result)
location.reload();
var currentpage = $("#currentpage").html()
console.log("vaciando div de subcorpus")
$("#divsubcorpus").html("")
console.log("before:")
console.log(BIS_dict[title])
BIS_dict[title][0]--;
BIS_dict[title][1]++;
console.log("after:")
console.log(BIS_dict[title])
// updateDocuments( currentpage , true );
console.log("after delete: updateDocuments( "+currentpage+" , true )")
updateDocuments( currentpage , true )
},
error: function(result) {
console.log("Data not found");
......@@ -62,13 +75,12 @@ function deleteNode(node_id) {
}
});
}
current_docs = []
{% for doc in documents %}
id = "doc_{{doc.id}}"
title = "{{doc.name}}"
if(BIS_dict[title]) {
var delimg = '<a title="Delete this document!" style="cursor: pointer;" onclick="deleteNode('+"{{doc.id}}"+')"><img width="20px" src="/static/img/delete-big.png"></img></a>'
$("#"+id).prepend( delimg )
if(BIS_dict[title] && BIS_dict[title][0] > BIS_dict[title][1]) {
var del_img = '<span id="delete_{{doc.id}}"><a title="Delete this document!" style="cursor: pointer;" onclick="deleteNode('+"{{doc.id}}"+',\''+title+'\')"><img width="20px" src="/static/img/delete-big.png"></img></a><span>'
$("#"+id).prepend( del_img )
}
{% endfor %}
......
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