i18n+filtering fork - fluent-templates v2
at main 8.9 kB view raw
1{% if operation_completed %} 2<article class="message is-success"> 3 <div class="message-header"> 4 {% if create_event %} 5 <p>{{ t("event-created-success") }}</p> 6 {% else %} 7 <p>{{ t("event-updated-success") }}</p> 8 {% endif %} 9 </div> 10 <div class="message-body"> 11 <p class="buttons"> 12 <a class="button" href="{{ event_url }}"> 13 <span class="icon"> 14 <i class="fas fa-file"></i> 15 </span> 16 <span>{{ t("view-event") }}</span> 17 </a> 18 </p> 19 </div> 20</article> 21{% else %} 22 23{% from "form_include.html" import text_input %} 24<form hx-post="{{ submit_url }}" hx-swap="outerHTML" class="my-5"> 25 26 {% if build_event_form.build_state == "Reset" %} 27 <input type="hidden" name="build_state" value="Selecting"> 28 {% elif build_event_form.build_state == "Selecting" %} 29 <input type="hidden" name="build_state" value="Selected"> 30 {% elif build_event_form.build_state == "Selected" %} 31 <input type="hidden" name="build_state" value="Selected"> 32 {% endif %} 33 34 35 <div class="field"> 36 <label class="label" for="createEventNameInput">{{ t("label-name") }} (required)</label> 37 <div class="control {% if build_event_form.name_error %} has-icons-right{% endif %}" 38 data-loading-class="is-loading"> 39 <input type="text" class="input {% if build_event_form.name_error %} is-danger{% endif %}" 40 id="createEventNameInput" name="name" minlength="10" maxlength="500" placeholder="{{ t('placeholder-awesome-event') }}" {% 41 if build_event_form.name %}value="{{ build_event_form.name }}" {% endif %} required 42 data-loading-disable> 43 </div> 44 {% if build_event_form.name_error %} 45 <p class="help is-danger">{{ build_event_form.name_error }}</p> 46 {% else %} 47 <p class="help">{{ t("help-name-length") }}</p> 48 {% endif %} 49 </div> 50 51 <div class="field"> 52 <label class="label" for="createEventTextInput">{{ t("label-description") }} (required)</label> 53 <div class="control"> 54 <textarea class="textarea{% if build_event_form.description_error %} is-danger{% endif %}" 55 id="createEventTextInput" name="description" maxlength="3000" rows="10" 56 placeholder="{{ t('placeholder-event-description') }}" required 57 data-loading-disable>{% if build_event_form.description %}{{ build_event_form.description }}{% endif %}</textarea> 58 </div> 59 {% if build_event_form.description_error %} 60 <p class="help is-danger">{{ build_event_form.description_error }}</p> 61 {% else %} 62 <p class="help">{{ t("help-description-length") }}</p> 63 {% endif %} 64 </div> 65 66 <div class="field"> 67 <div class="field-body"> 68 <div class="field"> 69 <label class="label" for="createEventStatus">{{ t("label-status") }}</label> 70 <div class="control"> 71 <div class="select"> 72 <select id="createEventStatus" name="status" 73 class="{% if build_event_form.status_error %}is-danger{% endif %}"> 74 <option {% if build_event_form.status=='planned' or not build_event_form.status %} 75 selected="selected" {% endif %} value="planned"> 76 {{ t("label-status-planned") }} 77 </option> 78 <option {% if build_event_form.status=='scheduled' %} selected="selected" {% endif %} 79 value="scheduled"> 80 {{ t("label-status-scheduled") }} 81 </option> 82 <option {% if build_event_form.status=='cancelled' %} selected="selected" {% endif %} 83 value="cancelled"> 84 {{ t("label-status-cancelled") }} 85 </option> 86 <option {% if build_event_form.status=='postponed' %} selected="selected" {% endif %} 87 value="postponed"> 88 {{ t("label-status-postponed") }} 89 </option> 90 <option {% if build_event_form.status=='rescheduled' %} selected="selected" {% endif %} 91 value="rescheduled"> 92 {{ t("label-status-rescheduled") }} 93 </option> 94 </select> 95 </div> 96 </div> 97 {% if build_event_form.status_error %} 98 <p class="help is-danger">{{ build_event_form.status_error }}</p> 99 {% endif %} 100 </div> 101 <div class="field pb-5"> 102 <label class="label" for="createEventMode">{{ t("label-mode") }}</label> 103 <div class="control"> 104 <div class="select"> 105 <select id="createEventMode" name="mode" 106 class="{% if build_event_form.mode_error %}is-danger{% endif %}"> 107 <option value="virtual" {% if build_event_form.mode=='virtual' %} selected{% endif %}> 108 {{ t("label-mode-virtual") }} 109 </option> 110 <option value="hybrid" {% if build_event_form.mode=='hybrid' %} selected{% endif %}> 111 {{ t("label-mode-hybrid") }} 112 </option> 113 <option value="inperson" {% if build_event_form.mode=='inperson' or not 114 build_event_form.mode %} selected{% endif %}>{{ t("label-mode-inperson") }}</option> 115 </select> 116 </div> 117 </div> 118 {% if build_event_form.mode_error %} 119 <p class="help is-danger">{{ build_event_form.mode_error }}</p> 120 {% endif %} 121 </div> 122 </div> 123 </div> 124 125 {% include "create_event." + current_locale + ".starts_form.html" %} 126 127 {% if locations_editable or create_event %} 128 {% include "create_event." + current_locale + ".location_form.html" %} 129 {% else %} 130 <div class="field"> 131 <label class="label">{{ t("location") }}</label> 132 <div class="notification is-warning"> 133 <p><strong>{{ t("location-cannot-edit") }}</strong></p> 134 <p>{{ location_edit_reason }}</p> 135 <p>{{ t("location-edit-explanation") }}</p> 136 </div> 137 138 {% if location_display_info %} 139 <!-- Display existing locations in read-only mode --> 140 <div class="content"> 141 <ul> 142 {% for location in location_display_info %} 143 <li> 144 {% if location.type == "uri" %} 145 <strong>{{ t("link-label") }}:</strong> 146 {% if location.name %}{{ location.name }}{% endif %} 147 <a href="{{ location.uri }}" target="_blank">{{ location.uri }}</a> 148 {% elif location.type == "address" %} 149 <strong>{{ t("address-label") }}:</strong> 150 {% if location.name %}<div>{{ location.name }}</div>{% endif %} 151 {% if location.street %}<div>{{ location.street }}</div>{% endif %} 152 {% if location.locality %}{{ location.locality }}{% endif %}{% if location.region %}, {{ location.region }}{% endif %}{% if location.postal_code %} {{ location.postal_code }}{% endif %} 153 {% if location.country %}<div>{{ location.country }}</div>{% endif %} 154 {% else %} 155 <strong>{{ t("other-location-type") }}</strong> 156 {% endif %} 157 </li> 158 {% endfor %} 159 </ul> 160 </div> 161 {% else %} 162 <p>No location information available.</p> 163 {% endif %} 164 </div> 165 {% endif %} 166 167 {% include "create_event." + current_locale + ".link_form.html" %} 168 169 <hr /> 170 <div class="field"> 171 <div class="control"> 172 <button data-loading-disable data-loading-aria-busy type="submit" id="createEventSubmit" 173 class="button is-link" name="submit" value="Submit"> 174 {% if create_event %}{{ t("create-event") }}{% else %}{{ t("update-event") }}{% endif %} 175 </button> 176 {% if cancel_url %} 177 <a href="{{ cancel_url }}" class="button">{{ t("cancel") }}</a> 178 {% endif %} 179 </div> 180 </div> 181 182 {% if is_development %} 183 <pre><code>{{ build_event_form | tojson(indent=2) }}</code></pre> 184 {% endif %} 185</form> 186 187 188{% endif %}