Commit 0d86605b authored by Okhin's avatar Okhin

New workflow for the form

parent 28f9ce4a
......@@ -24,12 +24,15 @@ function empty(node) {
// This fucntiosn check the first four forms
function check1st4() {
console.log('Check 1st4');
var resource=$('#id_resource_name').val();
var country=$('#id_country').val();
var op=$('#id_operator').val();
var contract=$('#id_contract').val();
var media=$('#id_media').val();
var contractual=$('#id_contractual').val();
var div=$('#similar_cases');
if(country && op && contract && media) {
if(country && op && contract && media && contractual && resource) {
$.getJSON('/lookup/?country='+country+'&contract='+contract+'&operator='+op+'&media='+media, function(data) {
if (data.length>0) {
div.parent().removeClass('hidden');
......@@ -40,6 +43,7 @@ function check1st4() {
var val=data.pop();
div.append('<li><a href="/view/'+val[0]+'">'+(val[1] || "no resource given")+'</a></li>');
};
console.log("Lookup : " + data);
});
$('#id_comment').parent().parent().show().focus();
$('#id_comment_ifr').focus();
......
......@@ -8,45 +8,31 @@
{% endblock %}
{% block scripts %}
<script type="text/javascript">
function focushandlers(ed) {
var s = ed.settings;
var realID = $('#'+ed.id+'_tbl');
tinymce.dom.EventUtils.bind(ed.getWin(), 'focus', function(e) {
if($(realID)) {
/console.log(realID);
realID.parents('.fieldWrapper').find('.help_text').show();
}
<script type="text/javascript">
$("#lookup_btn").click(function(event) {
event.preventDefault();
$.getJSON(
url="/lookup/",
data={
country:
q:
operator:
type:
}
success=function(data){
console.log(data);
$('#similar_modal').modal('show');
}
);
});
tinymce.dom.EventUtils.bind(ed.getWin(), 'blur', function(e) {
if($(realID)) {
/console.log(realID);
realID.parents('.fieldWrapper').find('.help_text').hide();
}
$("#btn_dismiss").click(function(event) {
event.preventDefault();
$("#similar_modal").modal('hide');
$("#lookup_btn").hide();
$("#collapseField").collapse('show');
});
}
$(document).ready(function(){
{% if not form.is_bound %}
$(".fieldWrapper").hide();
$("#id_resource_name").parent().parent().show();
$("#id_country").parent().parent().show();
$("#id_operator").parent().parent().show();
$("#id_contract").parent().parent().show();
$("#id_media").parent().parent().show();
$("#save_button").hide();
{% else %}
if($("#id_contractual").attr('checked')==false) {
$("#id_contract_excerpt").parent().parent().hide();
}
$("#show_optionals").show();
$("#optional .fieldWrapper").hide();
if ($('#id_email').val().length>0) {
$('#id_captcha_0').parent().parent().show();
$('#save_button').removeAttr('disabled');
$("#show_optionals").show();
}
{% endif %}
</script>
</script>
{% endblock %}
{%block content%}
......@@ -134,7 +120,6 @@ $(document).ready(function(){
{% bootstrap_field form.contract %}
{% bootstrap_field form.media %}
{% bootstrap_field form.contractual %}
<button class="btn btn-default" type="button" data-toggle="collapse" data-target="#collapseField" aria-expanded="false" aria-controls="collapseField">...</button>
<div class="collapse" id="collapseField">
{% bootstrap_field form.temporary %}
{% bootstrap_field form.loophole %}
......@@ -152,6 +137,25 @@ $(document).ready(function(){
{% endbuttons %}
</div>
</form>
{% buttons %}
<button id="lookup_btn" class="btn btn-default" type="button">...</button>
{% endbuttons %}
</div>
</div>
</div>
</div>
<div class="modal fade" id="similar_modal" tabindex="-1" role="dialog" aria-labelledby="SimilarModalLabel">
<div class="modal-dialog">
<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>
<h4 class="modal-title" id="SimilarModalLabel">{% trans "Similar cases" %}</h4>
</div>
<div class="modal-body">
<p>{% trans "Those are cases that might be similar to yours, please feel free to add your input on those cases instead of adding yours if they overlap." %}</p>
</div>
<div class="modal-footer">
<button type="button" id="btn_dismiss" class="btn btn-default" data-dismiss="modal">{% trans "Dismiss" %}</button>
</div>
</div>
</div>
......
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