Commit e920cbb4 authored by PkSM3's avatar PkSM3

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

parent ad2a480e
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
{% block content %} {% block content %}
<div id="loading" style="position:absolute; top:50%; left:40%; width:80px; display: none;" > <div id="loading" style="position:absolute; top:50%; left:40%; width:80px; display: none;" >
<img src="{% static "img/ajax-loader.gif" %}" alt="" /> <img src="{% static "img/ajax-loader.gif" %}" alt="" />
</div> </div>
...@@ -29,11 +28,5 @@ ...@@ -29,11 +28,5 @@
</div> </div>
</div> </div>
<script>
function showLoader(){
$('#loading').setStyle('display', 'block');
$('submit_btn').disabled = true;
};
</script>
{% endblock %} {% endblock %}
...@@ -24,5 +24,4 @@ ...@@ -24,5 +24,4 @@
</form> </form>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
{% endblock %} {% 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 %} {% block content %}
...@@ -44,15 +47,15 @@ ...@@ -44,15 +47,15 @@
>Add a corpus</button> >Add a corpus</button>
<div id="popover-content" class="hide"> <div id="popover-content" class="hide">
<form enctype="multipart/form-data" action="/project/{{project.id}}/" method="post"> <form id="uploadcorpusform" enctype="multipart/form-data" action="/project/{{project.id}}/" method="post">
{% csrf_token %} {% csrf_token %}
{{ form.non_field_errors }} {{ form.non_field_errors }}
{{ form.as_p}} {{ form.as_p}}
{{ formResource.non_field_errors }} {{ formResource.non_field_errors }}
{{ formResource.as_p}} {{ formResource.as_p}}
<input type="submit" class="btn" value="Add this corpus" /> <input type="submit" class="btn" value="Add this corpus" />
</form> </form>
</center> </center>
</p> </p>
...@@ -65,102 +68,35 @@ ...@@ -65,102 +68,35 @@
</div> </div>
</div> </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> <script>
// Morris Donut Chart function showLoader(flag){
Morris.Donut({ flag = !flag;
element: 'hero-donut', $('#loading').setStyle('display', 'block');
data: [ $('submit_btn').disabled = flag;
{% if donut %} };
{% for part in donut %}
{label: '{{ part.source }}', value: {{ part.part }} }, console.log("i am hereasdasd")
{% endfor %}
{% endif %} // $('#uploadcorpusform').on("submit", function (event) {
// event.preventDefault();
], // console.log("i am submitting the mofo")
colors: ["@white", "@white"], // showLoader(true);
//colors: ["#30a1ec", "#76bdee"], // $.ajax({
formatter: function (y) { return y + "%" } // 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> </script>
{% endblock %} {% 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