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
b1e90ab8
Commit
b1e90ab8
authored
Apr 01, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix "delete node" in graphexplorer view
parent
ab2c76dd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
142 additions
and
135 deletions
+142
-135
views.py
graphExplorer/views.py
+7
-5
extras_explorerjs.js
static/js/extras_explorerjs.js
+111
-106
explorer.html
templates/graphExplorer/explorer.html
+24
-24
No files found.
graphExplorer/views.py
View file @
b1e90ab8
...
@@ -19,12 +19,15 @@ def explorer(request, project_id, corpus_id):
...
@@ -19,12 +19,15 @@ def explorer(request, project_id, corpus_id):
# we pass our corpus
# we pass our corpus
corpus
=
cache
.
Node
[
corpus_id
]
corpus
=
cache
.
Node
[
corpus_id
]
# get the maplist_id for modifications
maplist_id
=
corpus
.
children
(
typename
=
"MAPLIST"
)
.
first
()
.
id
# and the project just for project.id in corpusBannerTop
# and the project just for project.id in corpusBannerTop
project
=
cache
.
Node
[
project_id
]
project
=
cache
.
Node
[
project_id
]
graphurl
=
"projects/"
+
str
(
project_id
)
+
"/corpora/"
+
str
(
corpus_id
)
+
"/node_link.json"
graphurl
=
"projects/"
+
str
(
project_id
)
+
"/corpora/"
+
str
(
corpus_id
)
+
"/node_link.json"
# rendered page :
journals
.html
# rendered page :
explorer
.html
return
render
(
return
render
(
template_name
=
'graphExplorer/explorer.html'
,
template_name
=
'graphExplorer/explorer.html'
,
request
=
request
,
request
=
request
,
...
@@ -35,9 +38,8 @@ def explorer(request, project_id, corpus_id):
...
@@ -35,9 +38,8 @@ def explorer(request, project_id, corpus_id):
'date'
:
datetime
.
now
(),
'date'
:
datetime
.
now
(),
'project'
:
project
,
'project'
:
project
,
'corpus'
:
corpus
,
'corpus'
:
corpus
,
#'list_id' : maplist.id,\
'maplist_id'
:
maplist_id
,
'graphfile'
:
graphurl
,
\
'graphfile'
:
graphurl
,
'view'
:
'graph'
'view'
:
'graph'
},
},
)
)
static/js/extras_explorerjs.js
View file @
b1e90ab8
...
@@ -23,15 +23,11 @@ function modify_ngrams( classname ) {
...
@@ -23,15 +23,11 @@ function modify_ngrams( classname ) {
console
.
clear
()
console
.
clear
()
var
corpus_id
=
getIDFromURL
(
"corpora"
)
// not used
var
corpus_id
=
getIDFromURL
(
"corpora"
)
// not used
var
list_id
=
$
(
"#list_id"
).
val
()
var
list_id
=
$
(
"#
map
list_id"
).
val
()
var
selected_ngrams
=
$
.
extend
({},
selections
)
var
selected_ngrams
=
$
.
extend
({},
selections
)
console
.
log
(
selected_ngrams
)
if
(
classname
==
"delete"
)
{
if
(
classname
==
"delete"
)
{
CRUD
(
corpus_id
,
"/keep"
,
[]
,
selected_ngrams
,
"DELETE"
,
function
(
result
)
{
CRUD
(
list_id
,
Object
.
keys
(
selected_ngrams
),
"DELETE"
,
function
(
success
)
{
console
.
log
(
" Delete from Map-list: "
+
result
)
CRUD
(
list_id
,
""
,
Object
.
keys
(
selected_ngrams
).
map
(
Number
)
,
[]
,
"DELETE"
,
function
(
result
)
{
console
.
log
(
" Add to Stop-list "
+
result
)
cancelSelection
(
false
)
cancelSelection
(
false
)
for
(
var
i
in
selected_ngrams
)
{
for
(
var
i
in
selected_ngrams
)
{
partialGraph
.
dropNode
(
i
)
partialGraph
.
dropNode
(
i
)
...
@@ -40,8 +36,7 @@ function modify_ngrams( classname ) {
...
@@ -40,8 +36,7 @@ function modify_ngrams( classname ) {
}
}
partialGraph
.
refresh
()
partialGraph
.
refresh
()
$
(
"#lensButton"
).
click
()
$
(
"#lensButton"
).
click
()
});
})
;
});
}
}
// if(classname=="group") {
// if(classname=="group") {
...
@@ -53,33 +48,43 @@ function modify_ngrams( classname ) {
...
@@ -53,33 +48,43 @@ function modify_ngrams( classname ) {
// }
// }
}
}
function
CRUD
(
parent_id
,
action
,
nodes
,
args
,
http_method
,
callback
)
{
function
CRUD
(
list_id
,
ngram_ids
,
http_method
,
callback
)
{
var
the_url
=
window
.
location
.
origin
+
"/api/node/"
+
parent_id
+
"/ngrams"
+
action
+
"/"
+
nodes
.
join
(
"+"
);
// ngramlists/change?node_id=42&ngram_ids=1,2
the_url
=
the_url
.
replace
(
/
\/
$/
,
""
);
//remove trailing slash
var
the_url
=
window
.
location
.
origin
+
"/api/ngramlists/change?list="
+
list_id
+
"&ngrams="
+
ngram_ids
.
join
(
","
);
console
.
log
(
the_url
)
console
.
log
(
args
)
// debug
if
(
nodes
.
length
>
0
||
Object
.
keys
(
args
).
length
>
0
)
{
// console.log("starting CRUD AJAX => URL: " + the_url + " (" + http_method + ")")
if
(
ngram_ids
.
length
>
0
)
{
$
.
ajax
({
$
.
ajax
({
method
:
http_method
,
method
:
http_method
,
url
:
the_url
,
url
:
the_url
,
data
:
args
,
// data: args, // currently all data explicitly in the url (like a GET)
beforeSend
:
function
(
xhr
)
{
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"X-CSRFToken"
,
getCookie
(
"csrftoken"
));
xhr
.
setRequestHeader
(
"X-CSRFToken"
,
getCookie
(
"csrftoken"
));
},
},
success
:
function
(
data
){
success
:
function
(
data
){
console
.
log
(
"-- CRUD ----------"
)
console
.
log
(
http_method
+
" ok!!"
)
console
.
log
(
http_method
+
" ok!!"
)
console
.
log
(
nodes
)
console
.
log
(
JSON
.
stringify
(
data
)
)
console
.
log
(
data
)
console
.
log
(
"------------------"
)
callback
(
"Success"
);
callback
(
true
);
},
},
error
:
function
(
result
)
{
error
:
function
(
result
)
{
console
.
log
(
"-- CRUD ----------"
)
console
.
log
(
"Data not found in #Save_All"
);
console
.
log
(
result
)
console
.
log
(
result
)
callback
(
"Fail"
);
console
.
log
(
"------------------"
)
callback
(
false
);
}
}
});
});
}
else
callback
(
false
);
}
else
callback
(
false
);
}
}
// = = = = = = = = = = = [ Clusters Plugin ] = = = = = = = = = = = //
// = = = = = = = = = = = [ Clusters Plugin ] = = = = = = = = = = = //
// Execution: ChangeGraphAppearanceByAtt( true )
// Execution: ChangeGraphAppearanceByAtt( true )
...
...
templates/graphExplorer/explorer.html
View file @
b1e90ab8
...
@@ -136,7 +136,7 @@
...
@@ -136,7 +136,7 @@
<li>
<li>
<a>
<a>
<div
id=
"graphid"
style=
"visibility: hidden;"
>
{{graphfile}}
</div>
<div
id=
"graphid"
style=
"visibility: hidden;"
>
{{graphfile}}
</div>
<input
type=
"hidden"
id=
"
list_id"
value=
"{{
list_id }}"
></input>
<input
type=
"hidden"
id=
"
maplist_id"
value=
"{{ map
list_id }}"
></input>
<div
id=
"jquerytemplatenb"
style=
"visibility: hidden;"
>
{{user.id}}
</div>
<div
id=
"jquerytemplatenb"
style=
"visibility: hidden;"
>
{{user.id}}
</div>
</a>
</a>
</li>
</li>
...
...
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