Commit e920cbb4 authored by PkSM3's avatar PkSM3

[UPDATE] trying to use ajax form|post : put a loader

parent ad2a480e
......@@ -12,7 +12,6 @@
{% block content %}
<div id="loading" style="position:absolute; top:50%; left:40%; width:80px; display: none;" >
<img src="{% static "img/ajax-loader.gif" %}" alt="" />
</div>
......@@ -29,11 +28,5 @@
</div>
</div>
<script>
function showLoader(){
$('#loading').setStyle('display', 'block');
$('submit_btn').disabled = true;
};
</script>
{% endblock %}
......@@ -24,5 +24,4 @@
</form>
</div>
</div>
{% endblock %}
......@@ -16,6 +16,9 @@
{% endblock %}
<div id="loading" style="position:absolute; top:50%; left:40%; width:80px; display: none;" >
<img src="{% static "img/ajax-loader.gif" %}" alt="" />
</div>
{% block content %}
......@@ -44,15 +47,15 @@
>Add a corpus</button>
<div id="popover-content" class="hide">
<form enctype="multipart/form-data" action="/project/{{project.id}}/" method="post">
{% csrf_token %}
{{ form.non_field_errors }}
{{ form.as_p}}
{{ formResource.non_field_errors }}
{{ formResource.as_p}}
<input type="submit" class="btn" value="Add this corpus" />
</form>
<form id="uploadcorpusform" enctype="multipart/form-data" action="/project/{{project.id}}/" method="post">
{% csrf_token %}
{{ form.non_field_errors }}
{{ form.as_p}}
{{ formResource.non_field_errors }}
{{ formResource.as_p}}
<input type="submit" class="btn" value="Add this corpus" />
</form>
</center>
</p>
......@@ -65,102 +68,35 @@
</div>
</div>
</div>
<!-- Add jumbotron container for each type of corpus (presse, science etc.) --!>
<div class="container">
{% if list_corpora %}
<h1>Resources</h1>
<h2>Corpora</h2>
<ul>
{% for key, corpora in list_corpora.items %}
<li>{{ key }}</li>
<ul>
{% for corpus in corpora %}
<li> {% ifnotequal corpus.count 0 %}
<a href="/project/{{project.id}}/corpus/{{corpus.id}}">{{corpus.name}}</a>
, {{ corpus.count }} Documents
{% else %}
{{corpus.name}} : Processing, drink a cup of tea, and refresh the page :)
{% endifnotequal %}
<button type="button" class="btn btn-xs btn-default" data-container="body" data-toggle="popover" data-placement="bottom"
data-content='
<ul>
<li> Add documents </li>
<li> Rename </li>
<li><a href="/project/{{ project.id }}/corpus/{{ corpus.id}}/delete">Delete</a></li>
</ul>
'>Manage</button>
</li>
{% endfor %}
</ul>
{% endfor %}
</ul>
{% endif %}
{% if list_corporax %}
<div class="col-md-4">
<h3><a href="/project/{{project.id}}/corpus/{{corpus.id}}">{{corpus.name}}</a>
</h3>
<h4>{{ corpus.count }} Documents </h4>
<h5>Activity:</h5>
<div class="chart" data-percent="73">73%</div>
</div>
{% endif %}
{% if whitelists %}
<h2>Lists of Ngrams</h2>
<h3>White Lists</h2>
{% for list in whitelists %}
<ul>
<li> {{list.name }}
</ul>
{% endfor %}
{% endif %}
{% if whitelists %}
<h3>Black Lists</h2>
{% for list in blacklists %}
<ul>
<li> {{list.name }}
</ul>
{% endfor %}
{% endif %}
{% if cooclists %}
<h2>Results (graphs)</h2>
<h3>Cooccurrences Lists</h2>
{% for list in cooclists %}
<ul>
<li> {{list.name }}
</ul>
{% endfor %}
{% endif %}
</div>
<script>
// Morris Donut Chart
Morris.Donut({
element: 'hero-donut',
data: [
{% if donut %}
{% for part in donut %}
{label: '{{ part.source }}', value: {{ part.part }} },
{% endfor %}
{% endif %}
],
colors: ["@white", "@white"],
//colors: ["#30a1ec", "#76bdee"],
formatter: function (y) { return y + "%" }
});
function showLoader(flag){
flag = !flag;
$('#loading').setStyle('display', 'block');
$('submit_btn').disabled = flag;
};
console.log("i am hereasdasd")
// $('#uploadcorpusform').on("submit", function (event) {
// event.preventDefault();
// console.log("i am submitting the mofo")
// showLoader(true);
// $.ajax({
// type: frm.attr('method'),
// url: frm.attr('action'),
// data: frm.serialize(),
// success: function (data) {
// showLoader(false);
// },
// error: function(data) {
// $("#MESSAGE-DIV").html("Something went wrong!");
// }
// });
// return false;
// });
</script>
{% endblock %}
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