add.html 1.61 KB
Newer Older
Okhin's avatar
Okhin committed
1 2 3 4
{% extends "base.html" %}
{% load bt %}
{% load i18n %}
{% block styles %}
Okhin's avatar
Okhin committed
5
  <link rel="stylesheet" type="text/css" media="all" href="{% static_url %}/css/jquery.autocomplete.css" />
Okhin's avatar
Okhin committed
6 7
{% endblock %}
{% block scripts %}
Okhin's avatar
Okhin committed
8 9 10 11 12
<script type="text/javascript" src="{%static_url%}/js/tinymce/tiny_mce.js"></script>
<script type="text/javascript" src="{%static_url%}/js/editor.js"></script>
<script type="text/javascript" src="{%static_url%}/js/jquery.min.js"></script>
<script type="text/javascript" src="{%static_url%}/js/jquery.autocomplete.js"></script>
<script type="text/javascript" src="{%static_url%}/js/form.js"></script>
Okhin's avatar
Okhin committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
<script type="text/javascript">
$(document).ready(function(){
  init_form();
  {% if not form.is_bound %}
  $(".fieldWrapper").hide();
  $("#id_country").parent().show();
  $("#save_button").hide();
  {% else %}
  if($("#id_contractual").attr('checked')==false) {
    $("#id_contract_excerpt").parent().hide();
  }
  {% endif %}
});
</script>
{% endblock %}

{%block content%}
  <h2>{% trans "New Violation" %}</h2>
<form id='addForm' name="addForm" enctype="multipart/form-data" action="{% url add_violation %}" method="post">
  {% for field in form %}
      {% if field.label = 'Resource' %}<div id="show_optionals">{% trans "Provide optional details" %}</div><div id="optional">{%endif%}
      <div class="fieldWrapper">
          <p>
          {{ field.errors }}
          <div class="help_text">{{ field.help_text }}</div>
          {{ field.label_tag }} {{ field }}
          </p>
      </div>
  {% endfor %}
  </div>
  {% csrf_token %}
  <input id="save_button" type="submit" value="{% trans "save" %}" />
</form>
{%endblock%}