i18n+filtering fork - fluent-templates v2
at main 15 kB view raw
1{% from "form_include.html" import text_input, text_input_display %} 2<div id="locationGroup" class="field"> 3 <div class="control"> 4 {% if is_development %} 5 <pre><code>{{ location_form | tojson(indent=2) }}</code></pre> 6 {% endif %} 7 {% if location_form.build_state == "Selecting" %} 8 <div id="locationModal" class="modal is-active" tabindex="-1"> 9 <div class="modal-background"></div> 10 <div class="modal-content"> 11 <div class="box"> 12 <div class="field"> 13 <label class="label" for="createEventLocationCountryInput">{{ t("label-country") }} ({{ t("required-field") }})</label> 14 <div class="control"> 15 <div class="select"> 16 <input class="input" id="createEventLocationCountryInput" name="location_country" 17 list="locations_country_data" {% if location_form.location_country %} 18 value="{{ location_form.location_country }}" {% endif %} autocomplete="off" 19 data-1p-ignore hx-get="/event/location/datalist" hx-target="#locations_country_data" 20 hx-trigger="keyup[checkUserKeydown.call(this, event)] changed delay:50ms, load" /> 21 <datalist id="locations_country_data"> 22 <option value="US">{{ t("country-us") }}</option> 23 <option value="GB">{{ t("country-gb") }}</option> 24 <option value="MX">{{ t("country-mx") }}</option> 25 <option value="CA">{{ t("country-ca") }}</option> 26 <option value="DE">{{ t("country-de") }}</option> 27 </datalist> 28 </div> 29 </div> 30 {% if location_form.location_country_error %} 31 <p class="help is-danger">{{ location_form.location_country_error }}</p> 32 {% endif %} 33 </div> 34 35 {{ text_input(t("label-location-name") + ' (' + t("optional-field") + ')', 'locationAddressName', 'location_name', 36 value=location_form.location_name, error=location_form.location_name_error, 37 extra='autocomplete="off" data-1p-ignore placeholder="' + t("placeholder-location-name") + '"') }} 38 39 {{ text_input(t("label-street-address") + ' (' + t("optional-field") + ')', 'locationAddressStreet', 'location_street', 40 value=location_form.location_street, error=location_form.location_street_error, 41 extra='autocomplete="off" data-1p-ignore placeholder="' + t("placeholder-street-address") + '"') }} 42 43 {{ text_input(t("label-locality") + ' (' + t("optional-field") + ')', 'locationAddressLocality', 'location_locality', 44 value=location_form.location_locality, error=location_form.location_locality_error, 45 extra='autocomplete="off" data-1p-ignore placeholder="' + t("placeholder-locality") + '"') }} 46 47 {{ text_input(t("label-region") + ' (' + t("optional-field") + ')', 'locationAddressRegion', 'location_region', 48 value=location_form.location_region, error=location_form.location_region_error, 49 extra='autocomplete="off" data-1p-ignore placeholder="' + t("placeholder-region") + '"') }} 50 51 {{ text_input(t("label-postal-code") + ' (' + t("optional-field") + ')', 'locationAddressPostalCode', 'location_postal_code', 52 value=location_form.location_postal_code, error=location_form.location_postal_code_error, 53 extra='autocomplete="off" data-1p-ignore placeholder="' + t("placeholder-postal-code") + '"') }} 54 55 <div class="field is-grouped pt-4"> 56 <p class="control"> 57 <button hx-post="/event/location" hx-target="#locationGroup" hx-swap="outerHTML" 58 hx-trigger="click" 59 hx-params="build_state,location_country,location_name,location_street,location_locality,location_region,location_postal_code" 60 hx-vals='{ "build_state": "Selected" }' class="button is-primary">{{ t("button-save") }}</button> 61 </p> 62 </div> 63 </div> 64 </div> 65 <button hx-post="/event/location" hx-target="#locationGroup" hx-swap="outerHTML" hx-trigger="click" 66 hx-params="build_state" hx-vals='{ "build_state": "Reset" }' class="modal-close is-large" 67 aria-label="{{ t('button-close') }}"></button> 68 </div> 69 {% elif (location_form.build_state == "Selected") %} 70 71 {{ text_input_display(t("label-location-name"), 'location_name', value=location_form.location_name) }} 72 73 {{ text_input_display(t("label-street-address"), 'location_street', value=location_form.location_street) }} 74 75 {{ text_input_display(t("label-locality"), 'location_locality', value=location_form.location_locality) }} 76 77 {{ text_input_display(t("label-region"), 'location_region', value=location_form.location_region) }} 78 79 {{ text_input_display(t("label-postal-code"), 'location_postal_code', value=location_form.location_postal_code) }} 80 81 {{ text_input_display(t("label-country"), 'location_country', value=location_form.location_country) }} 82 83 <div class="field is-grouped"> 84 <p class="control"> 85 <button hx-post="/event/location" hx-target="#locationGroup" hx-swap="outerHTML" hx-trigger="click" 86 hx-params="build_state,location_country,location_name,location_street,location_locality,location_region,location_postal_code" 87 hx-vals='{ "build_state": "Selecting" }' data-bs-toggle="modal" data-bs-target="startAtModal" 88 class="button is-link is-outlined">{{ t("button-edit") }}</button> 89 </p> 90 <p class="control"> 91 <button hx-post="/event/location" hx-target="#locationGroup" hx-swap="outerHTML" hx-trigger="click" 92 hx-params="build_state" hx-vals='{ "build_state": "Reset" }' 93 class="button is-danger is-outlined">{{ t("button-clear") }}</button> 94 </p> 95 </div> 96 {% if location_form.location_country %} 97 <input hidden type="text" name="location_country" value="{{ location_form.location_country }}"> 98 {% endif %} 99 {% if location_form.location_name %} 100 <input hidden type="text" name="location_name" value="{{ location_form.location_name }}"> 101 {% endif %} 102 {% if location_form.location_street %} 103 <input hidden type="text" name="location_street" value="{{ location_form.location_street }}"> 104 {% endif %} 105 {% if location_form.location_locality %} 106 <input hidden type="text" name="location_locality" value="{{ location_form.location_locality }}"> 107 {% endif %} 108 {% if location_form.location_region %} 109 <input hidden type="text" name="location_region" value="{{ location_form.location_region }}"> 110 {% endif %} 111 {% if location_form.location_postal_code %} 112 <input hidden type="text" name="location_postal_code" value="{{ location_form.location_postal_code }}"> 113 {% endif %} 114 {% elif location_form.build_state == "Reset" %} 115 <div class="field"> 116 <div class="field-body is-align-items-end"> 117 <div class="field"> 118 <label class="label" for="createEventLocationCountryInput">{{ t("label-location") }}</label> 119 <div class="control"> 120 <input id="createEventLocationCountryInput" type="text" class="input is-static" value="{{ t('not-set') }}" 121 readonly /> 122 </div> 123 </div> 124 <div class="field"> 125 <p class="control"> 126 <button hx-post="/event/location" hx-target="#locationGroup" hx-swap="outerHTML" 127 hx-trigger="click" 128 hx-params="build_state,location_country,location_name,location_street,location_locality,location_region,location_postal_code" 129 hx-vals='{ "build_state": "Selecting" }' class="button is-link is-outlined">{{ t("button-edit") }}</button> 130 </p> 131 </div> 132 </div> 133 </div> 134 {% endif %} 135 </div> 136</div> 137{# {% from "form_include.html" import text_input %} 138<div id="locationsGroup" class="field py-5"> 139 <div class="control"> 140 {% if location_form.build_state == "Selecting" %} 141 <div id="locationsGroupModal" class="modal is-active" tabindex="-1"> 142 <div class="modal-background"></div> 143 <div class="modal-content"> 144 <div class="box"> 145 {{ text_input('Location Name (optional)', 'locationAddressName', 'location_name', 146 value=location_form.location_name, error=location_form.location_name_error, extra='placeholder="The 147 Gem City"') }} 148 149 {{ text_input('Street Address (optional)', 'locationAddressStreet', 'location_street', 150 value=location_form.location_street, error=location_form.location_street_error, 151 extra='placeholder="555 Somewhere"') }} 152 153 <div class="field"> 154 <div class="field-body"> 155 {{ text_input('Locality ("City", optional)', 'locationAddressLocality', 'location_locality', 156 value=location_form.location_locality, error=location_form.location_locality_error, 157 extra='placeholder="Dayton"') }} 158 159 {{ text_input('Region ("State", optional)', 'locationAddressRegion', 'location_region', 160 value=location_form.location_region, error=location_form.location_region_error, 161 extra='placeholder="Ohio"') }} 162 163 {{ text_input('Postal Code (optional)', 'locationAddressPostalCode', 'location_postal_code', 164 value=location_form.location_postal_code, error=location_form.location_postal_code_error, 165 extra='placeholder="11111"') }} 166 </div> 167 </div> 168 169 <div class="field is-grouped pt-4"> 170 <p class="control"> 171 <button hx-post="/event/locations" hx-target="#locationsGroup" hx-swap="outerHTML" 172 hx-trigger="click" 173 hx-params="build_state,location_name,location_street,location_locality,location_region,location_postal_code,location_country" 174 hx-vals='{ "build_state": "Selected" }' class="button is-primary">{{ t("save") }}</button> 175 </p> 176 <p class="control"> 177 <button hx-post="/event/locations" hx-target="#locationsGroup" hx-swap="outerHTML" 178 hx-trigger="click" hx-params="build_state" hx-vals='{ "build_state": "Reset" }' 179 class="button is-danger">{{ t("cancel") }}</button> 180 </p> 181 </div> 182 </div> 183 </div> 184 <button hx-post="/event/locations" hx-target="#locationsGroup" hx-swap="outerHTML" hx-trigger="click" 185 hx-params="build_state" hx-vals='{ "build_state": "Reset" }' class="modal-close is-large" 186 aria-label="close"></button> 187 </div> 188 {% elif (location_form.build_state == "Selected") %} 189 {{ text_input('Location Name', 'locationAddressName', 'location_name', 190 value=(location_form.location_name if location_form.location_name is not none else '--'), 191 error=location_form.location_name_error, class_extra=" is-static", extra=' readonly ') }} 192 193 {{ text_input('Street Address', 'locationAddressStreet', 'location_street', 194 value=(location_form.location_street if location_form.location_street is not none else '--'), 195 error=location_form.location_street_error, class_extra=" is-static", extra=' readonly ') }} 196 197 <div class="field"> 198 <div class="field-body"> 199 {{ text_input('Locality', 'locationAddressLocality', 'location_locality', 200 value=(location_form.location_locality if location_form.location_locality is not none else '--'), 201 error=location_form.location_locality_error, class_extra=" is-static", extra=' readonly ') }} 202 203 {{ text_input('Region', 'locationAddressRegion', 'location_region', 204 value=(location_form.location_region if location_form.location_region is not none else '--'), 205 error=location_form.location_region_error, class_extra=" is-static", extra=' readonly ') }} 206 207 {{ text_input('Postal Code', 'locationAddressPostalCode', 'location_postal_code', 208 value=(location_form.location_postal_code if location_form.location_postal_code is not none else '--'), 209 error=location_form.location_postal_code_error, class_extra=" is-static", extra=' readonly ') }} 210 </div> 211 </div> 212 <div class="field is-grouped"> 213 <p class="control"> 214 <button hx-post="/event/locations" hx-target="#locationsGroup" hx-swap="outerHTML" hx-trigger="click" 215 hx-params="build_state,location_name,location_street,location_locality,location_region,location_postal_code,location_country" 216 hx-vals='{ "build_state": "Selecting" }' class="button is-link is-outlined">{{ t("edit") }}</button> 217 </p> 218 <p class="control"> 219 <button hx-post="/event/locations" hx-target="#locationsGroup" hx-swap="outerHTML" hx-trigger="click" 220 hx-params="build_state" hx-vals='{ "build_state": "Reset" }' class="button is-danger">{{ t("clear") }}</button> 221 </p> 222 </div> 223 {% elif location_form.build_state == "Reset" %} 224 225 {{ text_input('Location', 'locationResetPlaceholder', value='--', class_extra=' is-static', extra=' readonly ') 226 }} 227 228 <div class="field"> 229 <p class="control"> 230 <button hx-post="/event/locations" hx-target="#locationsGroup" hx-swap="outerHTML" hx-trigger="click" 231 hx-params="build_state" hx-vals='{ "build_state": "Selecting" }' 232 class="button is-link is-outlined">{{ t("edit") }}</button> 233 </p> 234 </div> 235 {% endif %} 236 </div> 237</div> #}