arg_realization_form.html 2.64 KB
<form class="argument-add-form" method="post"> {% csrf_token %}
  <div class="argument-type">
    {{type_form.as_p}}
    {% for sheet in attr_sheets %}
    	<div id="subform">
    	{% for field in sheet.form %}
    	 	{% if "value_positions" == field.html_name %}
   	 			{{ field.label_tag }}: {{ field }} 
   	 			{% if sheet.is_empty_selection_mode %}
   	 			{% else %}
    	 			<button type="button" id="{{ field.id_for_label }}-add_position_button">Dodaj pozycję</button>
    	 			<div id="{{ field.id_for_label }}-positions">
    	 			  {% for position in sheet.positions %}
    	 			    <p id="position">
    	 			      {{ position.text_rep }}
    	 			      <input id="id_value" type="hidden" name="value" value="{{ position.id }}"/>
    	 			      <button type="button" id="edit-position">Edytuj</button>
    	 			      <button type="button" id="remove-position">Usuń</button>
    	 			    </p>
    	 			  {% endfor %}
    	 			</div>
   	 			{% endif %}
    	 	{% elif "value_arguments" == field.html_name %}
   	 			{{ field.label_tag }}: {{ field }} 
   	 			{% if sheet.is_empty_selection_mode %}
   	 			{% else %}
   	 				{% if main_argument or sheet.hide_add_arg_button %}
   	 				{% else %}
	    	 			<button type="button" id="{{ field.id_for_label }}-add_argument_button">Dodaj typ frazy</button>
	    	 			<div id="{{ field.id_for_label }}-arguments">
	    	 			  {% for argument in sheet.arguments %}
	    	 			    <p id="argument">
	    	 			      {{ argument.text_rep }}
	    	 			      <input id="id_value" type="hidden" name="value" value="{{ argument.id }}"/>
	    	 			      <button type="button" id="edit-argument">Edytuj</button>
	    	 			      <button type="button" id="remove-argument">Usuń</button>
	    	 			    </p>
	    	 			  {% endfor %}
	    	 			</div>
    	 			{% endif %}
   	 			{% endif %}
    	 	{% elif "argument" == field.html_name %}
   	 			{{ field.label_tag }}: <strong id="{{ field.id_for_label }}-argument">{{ sheet.arguments.0.text_rep }}<input id='id_value' type='hidden'  name='value' value='{{ sheet.arguments.0.id }}'/></strong> 
   	 			<button type="button" id="{{ field.id_for_label }}-select_argument_button">Wybierz typ frazy</button>
    	 	{% else %}
    			{{ field.label_tag }}: {{ field }}
    		{% endif %}
    	{% endfor %}
    	</div>
    {% endfor %}
  </div>
  {% if main_argument %}
  {% else %}
    <div class="opinion">
      {{opinion_form.as_p}}
    </div>
  {% endif %}
  <p class="lexeme-save">
    {% if main_argument %}
    {% else %}
      <button type="submit" id="add-realization">
        Zapisz	  
	  </button>
    {% endif %}
  </p>
</form>