|
| 1 | +{% extends "orga/generic/_form.html" %} |
| 2 | + |
| 3 | +{% load compress %} |
| 4 | +{% load formset_tags %} |
| 5 | +{% load i18n %} |
| 6 | +{% load static %} |
| 7 | + |
| 8 | +{% block stylesheets %} |
| 9 | + {% compress css %} |
| 10 | + <link rel="stylesheet" href="{% static "orga/css/dragsort.css" %}"> |
| 11 | + {% endcompress %} |
| 12 | +{% endblock stylesheets %} |
| 13 | + |
| 14 | +{% block scripts %} |
| 15 | + {% compress js %} |
| 16 | + <script defer src="{% static "js/jquery.js" %}"></script> |
| 17 | + <script defer src="{% static "js/jquery.formset.js" %}"></script> |
| 18 | + <script defer src="{% static "cfp/js/animateFormset.js" %}"></script> |
| 19 | + <script defer src="{% static "orga/js/questionForm.js" %}"></script> |
| 20 | + <script defer src="{% static "orga/js/dragsort.js" %}"></script> |
| 21 | + {% endcompress %} |
| 22 | +{% endblock scripts %} |
| 23 | + |
| 24 | +{% block form %} |
| 25 | + <form method="post" enctype="multipart/form-data"> |
| 26 | + {% csrf_token %} |
| 27 | + {% include "common/forms/errors.html" %} |
| 28 | + |
| 29 | + {% block warnings %}{% endblock warnings %} |
| 30 | + |
| 31 | + {{ form.target.as_field_group }} |
| 32 | + {{ form.variant.as_field_group }} |
| 33 | + {{ form.question.as_field_group }} |
| 34 | + {{ form.help_text.as_field_group }} |
| 35 | + {{ form.is_public.as_field_group }} |
| 36 | + {{ form.contains_personal_data.as_field_group }} |
| 37 | + <span id="is-visible-to-reviewers">{{ form.is_visible_to_reviewers.as_field_group }}</span> |
| 38 | + <fieldset class="limit-submission"> |
| 39 | + <legend id="limit">{% translate "Limit to specific proposals" %}</legend> |
| 40 | + {% if form.tracks %} |
| 41 | + <span class="limit-submission">{{ form.tracks.as_field_group }}</span> |
| 42 | + {% endif %} |
| 43 | + {% if form.submission_types %} |
| 44 | + <span class="limit-submission">{{ form.submission_types.as_field_group }}</span> |
| 45 | + {% endif %} |
| 46 | + </fieldset> |
| 47 | + <fieldset> |
| 48 | + <legend id="validation">{% translate "Input validation" %}</legend> |
| 49 | + <div class="form-group row"> |
| 50 | + <label class="col-md-3 col-form-label">{{ form.question_required.label }}</label> |
| 51 | + <div class="col-md-9"> |
| 52 | + <div class="form-check form-check-inline" style="display: inline-block; margin-right: 1.5rem;"> |
| 53 | + {% for choice in form.question_required %} |
| 54 | + <div class="form-check" style="display: inline-block; margin-right: 1.5rem;"> |
| 55 | + {{ choice.tag }} |
| 56 | + <label class="form-check-label" for="{{ choice.id_for_label }}" style="margin-left: 0.25rem;"> |
| 57 | + {{ choice.choice_label }} |
| 58 | + </label> |
| 59 | + </div> |
| 60 | + {% endfor %} |
| 61 | + </div> |
| 62 | + </div> |
| 63 | + </div> |
| 64 | + <div class="alert alert-info col-md-9 offset-md-3" id="alert-required-boolean"> |
| 65 | + {% blocktranslate trimmed %} |
| 66 | + If you mark a Yes/No field as required, it means that the user has to select Yes and No is not |
| 67 | + accepted. If you want to allow both options, do not make this field required. |
| 68 | + {% endblocktranslate %} |
| 69 | + </div> |
| 70 | + {{ form.deadline.as_field_group }} |
| 71 | + {{ form.freeze_after.as_field_group }} |
| 72 | + <span id="limit-length"> |
| 73 | + {{ form.min_length.as_field_group }} |
| 74 | + {{ form.max_length.as_field_group }} |
| 75 | + </span> |
| 76 | + <span id="limit-number"> |
| 77 | + {{ form.min_number.as_field_group }} |
| 78 | + {{ form.max_number.as_field_group }} |
| 79 | + </span> |
| 80 | + <span id="limit-date"> |
| 81 | + {{ form.min_date.as_field_group }} |
| 82 | + {{ form.max_date.as_field_group }} |
| 83 | + </span> |
| 84 | + <span id="limit-datetime"> |
| 85 | + {{ form.min_datetime.as_field_group }} |
| 86 | + {{ form.max_datetime.as_field_group }} |
| 87 | + </span> |
| 88 | + </fieldset> |
| 89 | + |
| 90 | + <fieldset id="answer-options" class="d-none"> |
| 91 | + <legend id="options">{% translate "Response options" %}</legend> |
| 92 | + {% if formset %} |
| 93 | + <details class="col-md-9 offset-md-3 mb-3 hide-label" {% if form.errors.options or form.errors.options_replace %}open{% endif %}> |
| 94 | + <summary>{% translate "Upload options" %}</summary> |
| 95 | + <div class="pt-3"></div> |
| 96 | + {{ form.options.as_field_group }} |
| 97 | + {{ form.options_replace.as_field_group }} |
| 98 | + <hr> |
| 99 | + </details> |
| 100 | + <div class="formset" data-formset data-formset-prefix="{{ formset.prefix }}"> |
| 101 | + {{ formset.management_form }} |
| 102 | + {{ formset.non_form_errors }} |
| 103 | + <div data-formset-body dragsort-url="{{ form.instance.urls.base }}"> |
| 104 | + {% for form in formset %} |
| 105 | + <div data-formset-form dragsort-id="{{ form.instance.id }}"> |
| 106 | + <div class="sr-only"> |
| 107 | + {{ form.id }} |
| 108 | + {{ form.DELETE }} |
| 109 | + </div> |
| 110 | + <div class="question-option-row flip ml-auto col-md-9 mb-2 d-flex hide-label"> |
| 111 | + <div class="question-option-input w-100{% if action == "view" %} disabled{% endif %}"> |
| 112 | + {% include "common/forms/errors.html" %} |
| 113 | + {{ form.answer.as_field_group }} |
| 114 | + </div> |
| 115 | + {% if action != "view" %} |
| 116 | + <div class="question-option-delete d-flex align-items-start"> |
| 117 | + <button draggable="true" type="button" class="btn btn-primary ml-1 mr-1 dragsort-button" title="{% translate "Move item" %}"> |
| 118 | + <i class="fa fa-arrows"></i> |
| 119 | + </button> |
| 120 | + |
| 121 | + <button type="button" class="btn btn-danger" data-formset-delete-button> |
| 122 | + <i class="fa fa-trash"></i> |
| 123 | + </button> |
| 124 | + </div> |
| 125 | + {% endif %} |
| 126 | + </div> |
| 127 | + </div> |
| 128 | + {% endfor %} |
| 129 | + </div> |
| 130 | + <script type="form-template" data-formset-empty-form> |
| 131 | + {% escapescript %} |
| 132 | + <div data-formset-form> |
| 133 | + <div class="sr-only"> |
| 134 | + {{ formset.empty_form.id }} |
| 135 | + {{ formset.empty_form.DELETE }} |
| 136 | + </div> |
| 137 | + <div class="question-option-row flip ml-auto col-md-9 mb-2 d-flex hide-label"> |
| 138 | + <div class="question-option-input w-100"> |
| 139 | + {{ formset.empty_form.answer.as_field_group }} |
| 140 | + </div> |
| 141 | + <div class="question-option-delete ml-2"> |
| 142 | + <button type="button" class="btn btn-danger" data-formset-delete-button> |
| 143 | + <i class="fa fa-trash"></i></button> |
| 144 | + </div> |
| 145 | + </div> |
| 146 | + </div> |
| 147 | + {% endescapescript %} |
| 148 | + </script> |
| 149 | + {% if action != "view" %} |
| 150 | + <p class="col-md-9 flip ml-auto"> |
| 151 | + <button type="button" class="btn btn-info" data-formset-add> |
| 152 | + <i class="fa fa-plus"></i> {% translate "Add a new option" %} |
| 153 | + </button> |
| 154 | + </p> |
| 155 | + {% endif %} |
| 156 | + </div> |
| 157 | + {% endif %} |
| 158 | + </fieldset> |
| 159 | + |
| 160 | + {% include "orga/includes/submit_row.html" %} |
| 161 | + |
| 162 | + </form> |
| 163 | +{% endblock form %} |
0 commit comments