Sections: prevent parent/child loop & force unqiue name/shortname

This commit is contained in:
William Bouzourène 2025-01-07 15:47:29 +01:00
parent 360ed9acd4
commit 1cdbc1cbb6
2 changed files with 52 additions and 16 deletions

View file

@ -68,16 +68,19 @@
id="parent_section"
class="form-control"
name="parent_section"
{% if IsParent %}disabled{% endif %}
>
<option value="0">--- Pas de section parente ---</option>
{% for ParentSection in Sections %}
<option
value="{{ ParentSection.ID }}"
{% if Section.ParentSectionID == ParentSection.ID %}selected{% endif %}
>
{{ ParentSection.Name }}
</option>
{% endfor %}
{% if !IsParent %}
{% for ParentSection in Sections %}
<option
value="{{ ParentSection.ID }}"
{% if Section.ParentSectionID == ParentSection.ID %}selected{% endif %}
>
{{ ParentSection.Name }}
</option>
{% endfor %}
{% endif %}
</select>
</div>