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
3679278f
Commit
3679278f
authored
Sep 19, 2016
by
delanoe
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/c24b-testing' into testing
parents
a664c5d2
6aae030e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
28 deletions
+137
-28
garganrest_projects.js
static/lib/gargantext/garganrest_projects.js
+28
-10
add_corpus_form.html
templates/pages/projects/add_corpus_form.html
+90
-0
overview.html
templates/pages/projects/overview.html
+19
-18
No files found.
static/lib/gargantext/garganrest_projects.js
View file @
3679278f
...
...
@@ -99,6 +99,7 @@ function addPageStatus(status, msg){
}
function
selectedUrls
(){
var
selected
=
[];
$
(
'input:checked'
).
each
(
function
()
{
selected
.
push
(
$
(
this
).
val
());
...
...
@@ -194,7 +195,7 @@ function getCorpora(){
function
getRessources
(){
var
pathname
=
window
.
location
.
pathname
;
url_
=
"/api"
+
pathname
+
"/resources"
alert
(
url_
)
//
alert(url_)
}
//// POST TO API
...
...
@@ -285,6 +286,22 @@ $(document).on("hover", "button", function(){
});
//MULTIPLE SELECTION ACTION
// checkbox with BUTTON #delete, #edit #refresh
//Activate editor bar
$
(
document
).
on
(
'change'
,
'input[type=checkbox]'
,
function
()
{
if
(
$
(
"input:checkbox:checked"
).
length
>
0
){
if
(
!
$
(
"#editor"
).
hasClass
(
"collapse in"
)){
$
(
"#editor"
).
collapse
(
"show"
);
}
}
else
{
if
(
$
(
"#editor"
).
hasClass
(
"collapse in"
)){
$
(
"#editor"
).
collapse
(
"hide"
);
}
}});
//DELETE MULTI
$
(
document
).
on
(
"click"
,
"#delete"
,
function
(){
var
selected
=
selectedUrls
();
...
...
@@ -331,11 +348,11 @@ $(document).on("click",".edit", function(){
//newform.collapse("show");
$
(
'#editForm-'
+
id
).
collapse
(
'toggle'
)
$
(
document
).
bind
(
'keypress'
,
function
(
e
)
{
if
(
e
.
keyCode
==
13
){
$
(
'#edit-submit-'
+
id
).
trigger
(
'click'
);
}
});
//
$(document).bind('keypress', function(e) {
//
if(e.keyCode==13){
//
$('#edit-submit-'+id).trigger('click');
//
}
//
});
$
(
"#edit-submit-"
+
id
).
on
(
'click'
,
function
(){
//alert(url)
...
...
@@ -361,7 +378,7 @@ $(document).on("click",".edit", function(){
//UNIQUE RECALC
$
(
document
).
on
(
"click"
,
".refresh"
,
function
(){
alert
(
refresh
)
//
alert(refresh)
//console.log( $(this))
var
id
=
$
(
this
).
data
(
"id"
)
//var url = $( this ).data("url")
...
...
@@ -393,6 +410,7 @@ function createProject() {
location
.
reload
();
},
error
:
function
(
data
)
{
//alert(data)
console
.
log
(
data
)
status
=
data
.
status
;
info
=
data
.
responseJSON
[
"detail"
];
...
...
@@ -403,8 +421,8 @@ function createProject() {
};
function
createCorpus
(
url
,
method
,
form
){
alert
(
method
)
alert
(
url
)
//
alert(method)
//
alert(url)
console
.
log
(
form
)
console
.
log
(
"POST corpus"
)
$
.
ajax
({
...
...
@@ -437,7 +455,7 @@ function createCorpus(url, method, form){
status
=
data
.
status
;
info
=
data
.
responseJSON
[
"detail"
];
msg
=
"<strong>ERROR ["
+
status
+
"]:</strong>"
+
"<p>"
+
info
+
"</p>"
alert
(
msg
)
//
alert(msg)
addFormStatus
(
"error"
,
"form#formCorpus"
,
msg
);
//$(".collapse").collapse("hide");
//_content = '<h2><span class="glyphicon glyphicon-remove-circle" aria-hidden="true"></span>Error while creating the corpus.</h2>'
...
...
templates/pages/projects/add_corpus_form.html
0 → 100644
View file @
3679278f
<div
class =
"container"
>
<div
id=
"addform"
class=
"row collapse"
>
<div
class=
"col-md-3"
></div>
<div
class=
"col-md-6"
>
<center>
<div
class=
"panel panel-info"
>
<div
class=
"panel-heading"
>
Add a corpus
</div>
<div
class=
"panel-body"
>
<form
id=
"form"
class=
"add"
role=
"form"
action=
"/project/{{ project_id }}/"
method=
"post"
enctype=
"multipart/form-data"
>
{% csrf_token %}
<div
id=
"radioBtn"
class=
"btn-group"
>
<a
id=
"parse"
class=
"btn btn-info active"
data-toggle=
"method"
data-title=
"parse"
>
<span
class=
"glyphicon glyphicon-download-alt"
aria-hidden=
"true"
>
UPLOAD
</span>
</a>
<div
class=
"btn"
>
OR
</div>
<a
id=
"scan"
class=
"btn btn-info notActive"
data-toggle=
"method"
data-title=
"scan"
>
<span
class=
"glyphicon glyphicon-search"
aria-hidden=
"true"
>
SEARCH
</span>
</a>
</div>
<br
/>
<br
/>
<div
class=
"form-group"
for=
"corpus_name"
>
<label
for=
"name"
>
Name:
</label>
<input
type=
"text"
id=
"name"
/>
<span
class=
"help-block collapse"
for=
"name"
>
This field is required.
</span>
</div>
<div
id=
"source-group"
>
<label
for=
"source"
>
Select a database
</label>
<select
id=
"source"
name=
"source"
required
>
<option
value=
""
>
Select a database
⇓
</option>
{% for element in ressources %}
{% if element.parser != None and element.crawler != None %}
<option
value=
"{{element.type}}"
data-parser =
"true"
data-crawler=
"true"
data-format=
{{element.file_formats|join:","}}
>
{{element.name}}
</option>
{% elif element.parser != None and element.crawler == None %}
<option
value=
"{{element.type}}"
data-parser =
"true"
data-crawler=
"false"
data-format =
{{element.file_formats|
join:
","}}
>
{{element.name}}
</option>
{% elif element.parser == None and element.crawler != None %}
<option
value=
"{{element.type}}"
data-parser =
"false"
data-crawler=
"true"
data-format =
{{element.file_formats|join:","}}
>
{{element.name}}
</option>
{%else%}
<option
value=
"{{element.type}}"
data-parser =
"false"
data-crawler=
"false"
data-format =
{{element.file_formats|join:","}}
>
{{element.name}}
</option>
{% endif %}
{% endfor %}
</select>
<span
class=
"help-block collapse"
for=
"source"
>
This field is required
</span>
</div>
<br
/>
<div
id=
"parser"
class=
"form-group"
>
<input
type=
"file"
id=
"file"
data-validation=
"mime size"
data-validation-allowing=
"csv, txt, xml, zip"
data-validation-max-size=
"1M"
name=
"file"
class=
"form-control-file"
accept=
"text/*,application/xml, application/zip"
>
<span
class=
"help-block collapse"
for=
"file"
class=
"danger"
>
This field is required
</span>
</div>
<br
/>
<div
id=
"crawler"
class=
"form-group"
>
<label
for=
"query"
>
Query:
</label>
<textarea
id=
"query"
type=
"input"
name=
"query"
class=
"form-control col-xs-12"
></textarea>
<span
class=
"help-block collapse"
for=
"id_query"
class=
"danger"
>
This field is required
</span>
<br>
</div>
<br
/>
<div
class=
"form-group"
id=
"btnsubmit"
>
<button
type=
"button"
id=
"create"
class=
"btn btn-info"
>
Add corpus
</button>
</div>
</form>
<span
id=
"simpleloader"
></span>
</div>
</div>
</center>
</div>
<div
class=
"col-md-3"
></div>
</div>
</div>
templates/pages/projects/overview.html
View file @
3679278f
...
...
@@ -74,7 +74,7 @@
</div>
<!-- CHECKBOX EDITION -->
<div
class=
"row"
id=
"editor"
>
<div
class=
"row
collapse
"
id=
"editor"
>
<button
title=
"delete selected project"
type=
"button"
class=
"btn btn-danger"
id=
"delete"
>
<span
class=
"glyphicon glyphicon-trash "
aria-hidden=
"true"
></span>
</button>
...
...
@@ -104,7 +104,7 @@
<
div
id
=
"{url}"
class
=
"item row"
>
<
h3
>
<
div
class
=
"col-md-6 content"
>
<
input
id
=
"checkbox"
type
=
"checkbox"
value
=
"{url}"
data
-
id
=
"{id}"
>
<
input
type
=
"checkbox"
value
=
"{url}"
data
-
id
=
"{id}"
>
<
a
href
=
"{url}"
>
<
span
class
=
"glyphicon glyphicon-book"
aria
-
hidden
=
"true"
><
/span
>
<
span
class
=
"item_name"
>
{
name
}
<
/span
>
...
...
@@ -113,28 +113,30 @@
<
/h3
>
<
div
id
=
"project_detail"
class
=
"col-md-4 content"
>
<
div
id
=
"item-editor"
>
<!--
GET
Project
-->
<
a
href
=
"{url}"
>
<
button
type
=
"button"
title
=
"see project"
class
=
"btn btn-default show pull-right"
aria
-
label
=
"Left Align"
>
<
span
class
=
"glyphicon glyphicon-eye-open"
aria
-
hidden
=
"true"
><
/span
>
<
/button
>
<
/a
>
<!--
DELETE
PROJECT
-->
<
button
type
=
"button"
class
=
"btn btn-default delete pull-right"
data
-
url
=
"{url}"
>
<
span
class
=
"glyphicon glyphicon-trash pull-right"
aria
-
hidden
=
"true"
><
/span
>
<
/button
>
<!--
EDIT
PROJECT
-->
<
button
class
=
"btn btn-default edit pull-right"
data
-
id
=
"{id}"
data
-
url
=
"{url}"
data
-
toggle
=
"collapse"
>
<
span
class
=
"glyphicon glyphicon-pencil"
aria
-
hidden
=
"true"
><
/span
>
<
/button
>
<!--
DELETE
PROJECT
-->
<
button
type
=
"button"
class
=
"btn btn-default delete pull-right"
data
-
url
=
"{url}"
>
<
span
class
=
"glyphicon glyphicon-trash pull-right"
aria
-
hidden
=
"true"
><
/span
>
<
/button
>
<!--
REFRESH
PROJECT
-->
<!--
<
button
type
=
"button"
class
=
"btn btn-default refresh pull-right"
data
-
id
=
"{id}"
>
<
span
class
=
"glyphicon glyphicon-refresh pull-right"
aria
-
hidden
=
"true"
><
/span
>
<
/button
>
-->
<!--
GET
Project
-->
<
a
href
=
"{url}"
>
<
button
type
=
"button"
title
=
"see project"
class
=
"btn btn-default show pull-right"
aria
-
label
=
"Left Align"
>
<
span
class
=
"glyphicon glyphicon-eye-open"
aria
-
hidden
=
"true"
><
/span
>
<
/button
>
<
/a
>
<
/div
>
...
...
@@ -169,12 +171,11 @@
<script
type=
"text/javascript"
src=
"{% static "
lib
/
gargantext
/
garganrest_projects
.
js
"
%}"
></script>
<script
type=
"text/javascript"
>
getProjects
();
$
(
document
).
bind
(
'keypress'
,
function
(
e
)
{
if
(
e
.
keyCode
==
13
){
$
(
'#createProject'
).
trigger
(
'click'
);
}
});
// $(document).on("input#inoutName").bind('keypress', function(e) {
// if(e.keyCode==13){
// $('#createProject').trigger('click');
// }
// });
$
(
document
).
on
(
"click"
,
"#createProject"
,
function
(
e
){
//alert("clicked");
//
...
...
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