Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
e9bceac5
Commit
e9bceac5
authored
Jan 13, 2015
by
PkSM3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[UPDATE] delete view in the road
parent
f35498c4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
3 deletions
+61
-3
api.py
gargantext_web/api.py
+24
-0
urls.py
gargantext_web/urls.py
+1
-1
delete-big.png
static/img/delete-big.png
+0
-0
corpus.html
templates/corpus.html
+22
-1
subcorpus.html
templates/subcorpus.html
+14
-1
No files found.
gargantext_web/api.py
View file @
e9bceac5
...
...
@@ -214,6 +214,8 @@ class NodesChildrenDuplicates(APIView):
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
total
=
duplicates
.
count
()
# response building
for
duplicate
in
duplicates
[
offset
:
offset
+
limit
]:
print
(
duplicate
)
return
JsonHttpResponse
({
'pagination'
:
{
'offset'
:
offset
,
...
...
@@ -621,6 +623,28 @@ class Nodes(APIView):
})
def
delete
(
self
,
request
,
node_id
):
session
=
get_session
()
# get the minimum ID for each of the nodes sharing the same metadata
node
=
models
.
Node
.
objects
.
filter
(
id
=
node_id
)
.
first
()
# delete the stuff
delete_query
=
(
session
.
query
(
Node
)
.
filter
(
Node
.
parent_id
==
node_id
)
)
print
(
"in Nodes.delete():"
)
print
(
"node to delete: "
+
node_id
)
print
(
delete_query
)
print
(
"--"
)
count
=
delete_query
.
count
()
# delete_query.delete(synchronize_session=False)
# session.flush()
# # return the result
return
JsonHttpResponse
({
'deleted'
:
count
,
})
# return duplicates_query
class
CorpusController
:
...
...
gargantext_web/urls.py
View file @
e9bceac5
static/img/delete-big.png
0 → 100644
View file @
e9bceac5
9.69 KB
templates/corpus.html
View file @
e9bceac5
...
...
@@ -222,7 +222,28 @@ function updateDocuments(pagenumber,pagenav) {
}
//else: "Read Documents" collapsible is open!, so do nothing
}
$
.
ajax
({
url
:
'http://localhost:8000/api/nodes/44335'
,
type
:
'DELETE'
,
success
:
function
(
result
)
{
console
.
log
(
"Do something with the result"
);
}
});
var
current_docs
=
{}
var
BIS_dict
=
{}
var
corpusid
=
window
.
location
.
href
.
split
(
"corpus"
)[
1
].
replace
(
/
\/
/g
,
''
)
//replace all the slashes
var
theurl
=
"http://localhost:8000/api/nodes/"
+
corpusid
+
"/children/duplicates?keys=title&limit=9999"
$
.
ajax
({
url
:
theurl
,
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 ]
}
pr
(
BIS_dict
)
}
});
// var gainOrLossChart = dc.pieChart("#gain-loss-chart");
// var fluctuationChart = dc.barChart("#fluctuation-chart");
...
...
templates/subcorpus.html
View file @
e9bceac5
...
...
@@ -21,9 +21,22 @@
<ul>
{% for doc in documents %}
{% if doc.date %}
<li>
<b>
{{ doc.date }}
</b>
:
<a
target=
"_blank"
href=
"/nodeinfo/{{doc.id}}"
>
{{ doc.name}}
</a>
, @ {{ doc.metadata.source}}
</li>
<li>
<div
id=
"doc_{{doc.id}}"
>
<b>
{{ doc.date }}
</b>
:
<a
target=
"_blank"
href=
"/nodeinfo/{{doc.id}}"
>
{{ doc.name}}
</a>
, @ {{ doc.metadata.source}}
</div>
</li>
{% endif %}
{% endfor %}
</ul>
<script>
current_docs
=
[]
{
%
for
doc
in
documents
%
}
id
=
"doc_{{doc.id}}"
title
=
"{{doc.name}}"
if
(
BIS_dict
[
title
])
{
var
ahref
=
'here goes the delete url'
var
delimg
=
'<a><img width="20px" src="/static/img/delete-big.png"></img></a>'
$
(
"#"
+
id
).
prepend
(
delimg
)
}
{
%
endfor
%
}
</script>
{% endif %}
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