Commit d4fe6e84 authored by c24b's avatar c24b

Remobve include with

parent 97ca8f84
{% extends "pages/menu.html" with user_parameters%}
{% extends "pages/menu.html" with user_parameters=user_parameters%}
{% block css %}
......
{% extends "pages/menu.html" with user_parameters%}
{% extends "pages/menu.html" with user_parameters=user_parameters%}
{% block css %}
{% load staticfiles %}
......
{% extends "pages/menu.html" with user_parameters%}
{% extends "pages/menu.html" with user_parameters=user_parameters%}
{% load staticfiles %}
{% block css %}
......
{% extends "pages/menu.html" with user_parameters%}
{% extends "pages/menu.html" with user_parameters=user_parameters%}
{% load staticfiles %}
{% block css %}
......
......@@ -68,6 +68,8 @@
{% endif %}
</ul>
<ul class="nav navbar-nav pull-right">
<li class="dropdown">
<a href="#" role="button" class="dropdown-toggle navbar-text" data-toggle="dropdown" title="That is your username">
......@@ -102,10 +104,21 @@
{% endif %}
</ul>
</li>
<li class="lang">
<a href="#" role="button" class="dropdown-toggle navbar-text">
{% if user_parameters.language == "fr" %}
<img value="{{user_parameters.language}}" src= "{% static "img/fr.png"%}" width="45%"/>
{%else %}
<img value="{{user_parameters.language}}" src= "{% static "img/en.png"%}" width="45%"/>
{%endif%}
{{user_parameters.language}}
</a>
</li>
</ul>
<ul class="nav navbar-nav pull-right">
<button class="btn primary_keylang">{{user_parameters["language"]}}</button>
</ul>
</div>
</div>
{% if corpus %}
......
{% if list_corpora %}
{% for key, corpora in list_corpora.items %}
<h2>
<div class="row">
<div class="col-md-1 content"></div>
<span class="glyphicon glyphicon-cd" aria-hidden="true"></span>
{{ key }}
</h2>
{% for corpus in corpora %}
<div id="corpus_{{corpus.id}}">
<div class="row">
<h4>
<div class="col-md-1 content"></div>
<div class="col-md-5 content">
<a href="/projects/{{project.id}}/corpora/{{corpus.id}}">
<span class="glyphicon glyphicon-file" aria-hidden="true"></span>
{{corpus.name}}, {{ corpus.count }} documents {{ corpus.status_message }}
</a>
</div>
<div class="col-md-3 content">
<!-- -->
{% for state in corpus.hyperdata.statuses %}
{% ifequal state.action "Workflow" %}
{% if state.complete %}
<a href="/projects/{{project.id}}/corpora/{{corpus.id}}" title="View the corpus">
<button type="button" class="btn btn-default" aria-label="Left Align">
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
</button>
</a>
<button type="button" class="btn btn-default yopla" data-container="body" data-toggle="popover" data-placement="bottom" data-trigger="focus"
data-content="
<ul>
<li
onclick=&quot;
garganrest.metrics.update({{corpus.id}}, function(){alert('The corpus ({{corpus.name|escapejs}}) was updated')});
&quot;>
<a href='#'>Recalculate ngram metrics</a> <br/> (can take a little while)
</li>
</ul>
">
<span class="glyphicon glyphicon-repeat" aria-hidden="true"
title='Recalculate ngram scores and similarities'></span>
</button>
{% endif %}
<!-- TODO: delete non seulement si state.complete mais aussi si state.error -->
<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom"
data-content="
<ul>
<li
onclick=&quot;
garganrest.nodes.delete({{corpus.id}}, function(){$('#corpus_'+{{corpus.id}}).remove()});
$(this).parent().parent().remove();
&quot;>
<a href='#'>Delete this</a>
</li>
</ul>
">
<span class="glyphicon glyphicon-trash" aria-hidden="true"
title='Delete this corpus'></span>
</button>
{% endifequal %}
{% endfor %}
</div>
<div class="col-md-3 content">
{% for state in corpus.hyperdata.statuses %}
{% ifequal state.action "Workflow" %}
{% if state.complete %}
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
{% else %}
{% if state.error %}
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
{{ state.error }}
{% else %}
<div class="progress">
<div class=" progress-bar progress-bar-striped
progress-bar-success
"
role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 20%">
<span>
Upload
</span>
</div>
{% for state in corpus.hyperdata.statuses %}
<div class=" progress-bar progress-bar-striped
{% if state.complete %}
progress-bar-success
{% else %}
active
{% endif %}
"
role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 20%">
<span>
{{ state.action }}
{% if not state.complete %}
Processing
{% endif %}
</span>
</div>
{% endfor %}
</div>
{% endif %}
{% endif %}
{% endifequal %}
{% endfor %}
</div>
<div class="col-md-1 content"></div>
</h4>
</div>
</div>
{% endfor %}
{% endfor %}
{% endif %}
<div class="modal fade" id="stack1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Query to PubMed</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
<input id="daquery" type="text" class="input-lg" data-tabindex="2">
<a onclick="getGlobalResults();" class="btn">Scan</a>
<div id="results"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button onclick="doTheQuery();" disabled id="id_thebutton" type="button" class="btn btn-primary">Explore a sample!</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->
<div class="modal fade" id="addcorpus" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Add a Corpus <a href="https://gogs.iscpif.fr/humanities/faq_gargantext/wiki/FAQ#import--export-a-dataset">
<span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span>
</a>
</h3>
</div>
<div class="modal-body">
<!-- FAQ -->
<form id="id_form" enctype="multipart/form-data" action="/projects/{{project.id}}/" method="post">
{% csrf_token %}
<table cellpadding="5">
{% for field in form %}
<tr>
<th>{{field.label_tag}}</th>
<td>
{{ field.errors }}
{{ field }}
{% if field.name == 'name' %}
<span onclick="getGlobalResults(this);" id="scanpubmed"></span>
<div id="theresults"></div>
{% endif %}
</td>
</tr>
{% endfor %}
<tr>
<th></th>
<td>
<div id="pubmedcrawl" style="visibility: hidden;">
Do you have a file already? &nbsp;
<input type="radio" id="file_yes" name="file1" onclick="FileOrNotFile(this.value);" class="file1" value="true" checked> Yes </input>
<input type="radio" id="file_no" name="file1" onclick="FileOrNotFile(this.value);" class="file1" value="false"> No </input>
</div>
</td>
</tr>
</table>
</form>
<div class="modal-footer">
<!-- <div id="pubmedcrawl" align="right" style="visibility: hidden;"><a data-toggle="modal" href="#stack1">&#10142; Query directly in PubMed</a></div> -->
<button type="button" class="btn btn-default" data-dismiss="modal">
<span class="glyphicon glyphicon-remove" aria-hidden="true" ></span>
Close
</button>
<button onclick='bringDaNoise();' id="submit_thing" disabled class="btn btn-primary" >
<span class="glyphicon glyphicon-ok" aria-hidden="true" ></span>
Process this!
</button><span id="simpleloader"></span>
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->
<div id="wait" class="modal fade">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h2 class="modal-title"><h2><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> Uploading corpus...</h2>
</div>
<div class="modal-body">
<h5>
Your file has been uploaded !
Gargantext need some time to eat it.
Duration depends on the size of the dish.
</h5>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Continue on Gargantext</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
This diff is collapsed.
This diff is collapsed.
{% extends "pages/menu.html" with user_parameters%}
{% extends "pages/menu.html" %}
{% block css %}
{% load staticfiles %}
......
{% extends "pages/menu.html" with user_parameters%}
{% extends "pages/menu.html" %}
{% block css %}
{% load staticfiles %}
......
{% for state in corpus.hyperdata.statuses %}
{% ifequal state.action "Workflow" %}
{% if state.complete %}
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
{% else %}
{% if state.error %}
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
{{ state.error }}
{% else %}
<div class="progress">
{% for state in corpus.hyperdata.statuses %}
{% if state.action != "Workflow" %}
<div class=" progress-bar progress-bar-striped
{% if state.complete %}
progress-bar-success
{% else %}
active
{% endif %}
"
role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 25%">
<span>
{{ state.action }}
{% if state.complete %}
Ok
{% else %}
Processing
{% endif %}
</span>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% endif %}
{% endifequal %}
{% endfor %}
function manageStatus(statuses){
status_bar = ""
status_bar += '<div class="progress">'
statuses.forEach(function (status){
if (status["action"] == "Workflow"){
if (status["complete"]){
status_bar += '<span class="glyphicon glyphicon-ok pull-right" aria-hidden="true"></span></div>'
return status_bar;
};
else if (status["error"]) {
status_bar += '<span class="glyphicon glyphicon-exclamation-sign pull-right" aria-hidden="true"></span></div>'
return status_bar;
};
else{
};
};
else{
status_bar +='<div class=" progress-bar progress-bar-striped'
if (status["complete"]){
status_bar +='progress-bar-sucess'
};
else{
status_bar +='active'
};
status_bar+= '" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 25%"> <span>'
if (status["action"]){
if (status["complete"]){
status_bar+= " OK </span></div>"
};
else{
status_bar+= " Processing </span>"
};
}
});
}
}
})
status_bar+="</div>"
return status_bar
};
console.log(errors)
errors.forEach(function(err) {
div = err[0].split(" ")
logs = []
logs.push(div[0])
if (err[1] == false)
{
alert(div[0])
//$(div[0]).parent().addClass("alert danger error");
$(div[0]).next(div[1]).collapse("show");
//$(div[0]).find(div[1]).collapse("show")
}
else
{
$("<span class='glyphicon glyphicon-ok' aria-hidden='true'>").appendTo(div[0])
}
});
return errors
};
function checkInput(source){
if (source.val().length > 0){
return true
}
else {
return false
}
}
function checkSourceFormat(){
source = $("select#source").find(':selected')
if (source.val() != '') {
console.log(source)
source_data = source.data("format")
alert(source_data)
formats = source_data.split(',');
alert(formats);
extension = $("#file").val().substr( (filename.lastIndexOf('.') +1) );
if ($.inArray(extension, formats) == -1){
//$("span.format").collapse("show");
return false;
}
else{
//$("span.format").collapse("hide");
return true;
}
}
return true
}
function checkFileSize(filesize, max_size){
if (filesize > max_size){
return true
}
else{
return false
}
};
//ADD CORPUS FORM
// //source
// $('#source').change(function() {
// $("#source").next("span.required").collapse("hide");
// source_type = $('#source').find(":selected");
// var formats = source_type.data("format").split(',');
// if (formats.length == 0){
// $("#source").next("span.required").collapse("show");
//
// }
// else{
// $("#source").next("span.required").collapse("hide");
// }
// });
// //file
// var max_size = parseInt($('#file').data("max-size"));
// $('#file').change(function() {
// var filesize = parseInt(this.files[0].size);
// if( filesize > max_size){
// alert("Upload file can't exceed 1 Mo because Gargantext would have an indigestion. Consult the special diet of Gargantext in our FAQ")
// $("#file").empty();
// };
// });
//
//
// });
$("#create").bind("click",function(){
var method = $('#radioBtn').find('a.active').data("title");
errors = checkForm()
if (has_error == "true"){
alert("Invalid Form");
}
else{
alert("OK")
//if (checkFileExtension() == true){
//preparePost(method, form)
//}
}
});
/////////////////FORM VALIDATION
function checkFilename(filename){
if (filename == ""){
$("#filename").next("span.required").collapse("show");
return false;
}
else{
$("#file").next("span.required").collapse("hide");
return true;
}
};
function checkFileSize(filesize, max_size){
if (filesize > max_size){
$("span.size").collapse("show");
}
else{
$("span.size").collapse("hide");
}
};
function checkFileExtension(){
filename = $('#file').val()
source_type = $('#source').find(":selected");
if (filename != "" && source_type.val() !== "0"){
fextension = filename.substr( (filename.lastIndexOf('.') +1) );
var formats = source_type.data("format").split(',');
if ($.inArray(extension, formats) == -1){
$("span.format").collapse("show");
return false;
}
else{
$("span.format").collapse("hide");
return true;
}
}
};
//name
$("span.error").collapse("hide");
$('#name').on('input', function() {
var input=$(this);
var is_name=input.val();
if ( is_name.length < 0){
$("#name").next("span.required").collapse("show");
$("form-group#name").addClass("error");
}
else {
$("#name").next("span").collapse("hide");
}
});
//source
$('#source').change(function() {
$("#source").next("span.required").collapse("hide");
source_type = $('#source').find(":selected");
var formats = source_type.data("format").split(',');
if (formats.length == 0){
$("#source").next("span.required").collapse("show");
}
else{
$("#source").next("span.required").collapse("hide");
}
});
//file
var max_size = parseInt($('#file').data("max-size"));
$('#file').change(function() {
$('#name span').collapse("hide");
var input=$(this);
var filename= input.val()
var filesize = parseInt(this.files[0].size);
checkFileSize(filesize, max_size);
});
//console.log("ERRORS?,)
$("#create").bind("click",function(){
var method = $('#radioBtn').find('a.active').data("title");
has_error = $("span.error").hasClass("collapse in");
if (has_error == "true"){
alert("Invalid Form");
}
else{
if (checkFileExtension() == true){
//preparePost(method, form)
}
}
});
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