argument_form.html 3.41 KB
<form class="argument-add-form" method="post"> {% csrf_token %}
  {% if propositions_form  %}
    <div class="argument-propositions">
      {{propositions_form.as_p}}
    </div>
  {% endif %}
  <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 or sheet.hide_add_arg_button %}
   	 			{% elif sheet.add_realization_button %}
    	 			<button type="button" id="{{ field.id_for_label }}-add_realization_button">Dodaj rozwinięcie typu 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-realization">Edytuj</button>
    	 			      <button type="button" id="remove-argument">Usuń</button>
    	 			    </p>
    	 			  {% endfor %}
    	 			</div>
   	 			{% 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 %}
    	 	{% 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>
  <p class="lexeme-save">
    <button type="submit" id="add-argument-submit">
      Zapisz
    </button>    
    {% if has_realizations  %}
      <button type="button" id="show-realizations">
        Pokaż rozwinięcia typu frazy
      </button>
    {% endif %}
    <button type="reset" id="add-argument-cancel">
      Anuluj
    </button>
  </p>
</form>
<div id='realizations'>
</div>