Spaces:
Sleeping
Sleeping
Download app/templates/_content_fields.html from stevafernandes/CURAS: direct link, hf CLI and curl.
- Browser
- Download file 2.57 kB
-
https://huggingface.co/spaces/stevafernandes/CURAS/resolve/main/app/templates/_content_fields.html
- Command line
-
hf download hf://spaces/stevafernandes/CURAS/app/templates/_content_fields.html
-
curl -L -o _content_fields.html https://huggingface.co/spaces/stevafernandes/CURAS/resolve/main/app/templates/_content_fields.html
2.57 kB
| {# Renders every listing content field. Expects `values` and `errors`. #} | |
| {% for f in CONTENT_FIELDS %} | |
| {% set err = errors.get(f.key) %} | |
| {% set described = [] %} | |
| {% if f.help %}{% do described.append('help-' ~ f.key) %}{% endif %} | |
| {% if err %}{% do described.append('err-' ~ f.key) %}{% endif %} | |
| <div class="form-row {% if err %}has-error{% endif %}"> | |
| {% if f.kind == 'choices' %} | |
| <fieldset class="choice-group" id="{{ f.key }}" tabindex="-1" {% if described %}aria-describedby="{{ described|join(' ') }}"{% endif %} {% if err %}aria-invalid="true"{% endif %}> | |
| <legend class="group-label">{{ f.label }}{% if f.required %} <span class="req">(required)</span>{% endif %}</legend> | |
| {% if f.help %}<p class="help" id="help-{{ f.key }}">{{ f.help }}</p>{% endif %} | |
| {% set state = values.get(f.key ~ '__selected') %} | |
| {% if state is none %} | |
| {% set known, other = split_known(values.get(f.key), f.choices) %} | |
| {% else %} | |
| {% set known = state %}{% set other = values.get(f.key ~ '__other', '') %} | |
| {% endif %} | |
| <div class="choices"> | |
| {% for option in f.choices %} | |
| <label><input type="checkbox" name="{{ f.key }}" value="{{ option }}" {% if option in known %}checked{% endif %}> {{ option }}</label> | |
| {% endfor %} | |
| </div> | |
| <div class="other-row"> | |
| <label for="{{ f.key }}_other">Other (describe)</label> | |
| <input type="text" id="{{ f.key }}_other" name="{{ f.key }}_other" value="{{ other }}" maxlength="{{ f.maxlen }}"> | |
| </div> | |
| </fieldset> | |
| {% else %} | |
| <label for="{{ f.key }}">{{ f.label }}{% if f.required %} <span class="req">(required)</span>{% endif %}</label> | |
| {% if f.help %}<p class="help" id="help-{{ f.key }}">{{ f.help }}</p>{% endif %} | |
| {% if f.kind == 'textarea' %} | |
| <textarea id="{{ f.key }}" name="{{ f.key }}" maxlength="{{ f.maxlen }}" {% if described %}aria-describedby="{{ described|join(' ') }}"{% endif %} {% if err %}aria-invalid="true"{% endif %}>{{ values.get(f.key) or '' }}</textarea> | |
| {% else %} | |
| <input type="text" id="{{ f.key }}" name="{{ f.key }}" value="{{ values.get(f.key) or '' }}" maxlength="{{ f.maxlen }}" {% if f.placeholder %}placeholder="{{ f.placeholder }}"{% endif %} {% if described %}aria-describedby="{{ described|join(' ') }}"{% endif %} {% if err %}aria-invalid="true"{% endif %}> | |
| {% endif %} | |
| {% endif %} | |
| {% if err %}<p class="field-error" id="err-{{ f.key }}">{{ err }}</p>{% endif %} | |
| </div> | |
| {% endfor %} | |