CURAS / app /templates /submit.html
stevafernandes's picture
Multi-select areas, colour-coded area tags, Creighton students only, titles removed, Creighton blue
4f5fdec verified
Raw History Blame Contribute Delete
3.75 kB
{% extends "base.html" %}
{% set nav = 'submit' %}
{% block title %}Submit or update a listing - {{ APP_TITLE }}{% endblock %}
{% block content %}
<h1>{% if update_of %}Update a listing{% else %}Submit a listing{% endif %}</h1>
<p>Use this form to add a research opportunity to the CURAS Research Database or to update one that is already listed. CURAS reviews every submission before it appears publicly.</p>
{% if update_of %}
<div class="notice">
<p><strong>You are proposing changes to the listing for:</strong> {{ update_of.faculty_name }}{% if update_of.keywords %} ({{ update_of.keywords }}){% endif %}. The current listing stays public until CURAS approves your changes.</p>
<p><a href="/submit">Start a new listing instead</a></p>
</div>
{% else %}
<form class="form-section" method="get" action="/submit">
<h2>Updating an existing listing?</h2>
<p>Choose the listing and load it to fill the form with its current details.</p>
<div class="form-row">
<label for="listing-picker">Existing listing</label>
<select id="listing-picker" name="listing">
<option value="">Choose a listing</option>
{% for item in listings_for_update %}<option value="{{ item.id }}">{{ item.label }}</option>{% endfor %}
</select>
</div>
<button class="btn" type="submit">Load listing</button>
</form>
{% endif %}
{% if errors %}
<div class="error-summary" role="alert">
{% if errors.get('form_token') %}<p>{{ errors['form_token'] }}</p>{% endif %}
{% if errors.get('listing') %}<p>{{ errors['listing'] }}</p>{% endif %}
{% set field_errors = [] %}
{% for f in SUBMITTER_FIELDS + CONTENT_FIELDS %}{% if errors.get(f.key) %}{% do field_errors.append(f) %}{% endif %}{% endfor %}
{% if field_errors %}
<strong>Please correct the following before submitting:</strong>
<ul>
{% for f in field_errors %}<li><a href="#{{ f.key }}">{{ f.label }}</a>: {{ errors[f.key] }}</li>{% endfor %}
</ul>
{% endif %}
</div>
{% endif %}
<form method="post" action="/submit" novalidate>
<input type="hidden" name="form_token" value="{{ form_token }}">
{% if update_of %}<input type="hidden" name="listing_id" value="{{ update_of.id }}">{% endif %}
<div class="hp" aria-hidden="true"><label>Leave this field empty <input type="text" name="website" tabindex="-1" autocomplete="off"></label></div>
<section class="form-section">
<h2>About you</h2>
{% for f in SUBMITTER_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 %}">
<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 %}
<input type="text" id="{{ f.key }}" name="{{ f.key }}" value="{{ values.get(f.key) or '' }}" maxlength="{{ f.maxlen }}" {% if f.key == 'submitter_email' %}inputmode="email"{% endif %} {% if described %}aria-describedby="{{ described|join(' ') }}"{% endif %} {% if err %}aria-invalid="true"{% endif %}>
{% if err %}<p class="field-error" id="err-{{ f.key }}">{{ err }}</p>{% endif %}
</div>
{% endfor %}
</section>
<section class="form-section">
<h2>Listing details</h2>
{% include "_content_fields.html" %}
</section>
<div class="form-actions">
<button class="btn btn-primary" type="submit">{% if update_of %}Submit changes for review{% else %}Submit for review{% endif %}</button>
<a href="/">Cancel</a>
</div>
</form>
{% endblock %}