Slowly moving the job board to discuss.afpy.org.

This commit is contained in:
Julien Palard 2022-02-08 10:50:39 +01:00
parent 4c8a05fe12
commit 45ec746364
2 changed files with 15 additions and 84 deletions

View File

@ -45,37 +45,6 @@ def jobs_page(current_page: int = 1):
)
@jobs_bp.route("/emplois/new", methods=["GET", "POST"])
@jobs_bp.route("/emplois/new", methods=["GET"])
def new_job():
form = JobPostForm()
if form.validate_on_submit():
title = form.title.data
content = form.content.data
company = form.company.data
location = form.location.data
contact_info = form.contact_info.data
email = form.email.data
phone = form.phone.data
summary = form.summary.data
new_job = JobPost.create(
title=title,
content=content,
company=company,
location=location,
contact_info=contact_info,
email=email,
phone=phone,
summary=summary,
)
flash("Merci ! Votre offre d'emploi apparaîtra après validation par un des administrateurs.", "success")
if form.image.data:
extension = secure_filename(form.image.data.filename).split(".")[-1].lower()
filename = f"emplois.{new_job.id}.{extension}"
filepath = f"{config.IMAGES_PATH}/{filename}"
request.files[form.image.name].save(filepath)
new_job.image_path = filename
new_job.save()
return redirect(url_for("jobs.jobs_page", current_page=1))
return render_template("pages/edit_job.html", form=form, post=None, body_id="edit-post")
return render_template("pages/edit_job.html")

View File

@ -1,61 +1,23 @@
{% extends '_parts/base.jinja2' %}
{% block header %}
<h1>
{% if post %}
Modification d'un job
{% else %}
Création d'un job
{% endif %}
</h1>
<h1>Création d'un job</h1>
{% endblock header %}
{% block main %}
<article>
<form method="POST" action="{{ url_for("jobs.new_job") }}" enctype="multipart/form-data">
{{ form.hidden_tag() }}
{% for field, errors in form.errors.items() %}
<div class="alert alert-error">
{{ form[field].label }}: {{ ', '.join(errors) }}
</div>
{% endfor %}
<label>{{ form.title.label }}
{{ form.title(size=40) }}
</label>
<label>{{ form.summary.label }}
{{ form.summary(size=100) }}
</label>
<label>{{ form.content.label }}
<div class="pagedown-row">
<div class="pagedown-column">
{{ form.content(only_input=True, rows=30) }}
</div>
<div class="pagedown-column" style="margin-left: 40px;">
Prévisualisation:
{{ form.content(only_preview=True) }}
</div>
</div> </label>
<label>{{ form.company.label }}
{{ form.company(size=40) }}
</label>
<label>{{ form.location.label }}
{{ form.location(size=40) }}
</label>
<label>{{ form.contact_info.label }}
{{ form.contact_info(size=40) }}
</label>
<label>{{ form.email.label }}
{{ form.email(size=40) }}
</label>
<label>{{ form.phone.label }}
{{ form.phone(size=40) }}
</label>
<label>{{ form.image.label }}
{{ form.image }}
</label>
<input type="submit" name="submit" value="Enregistrer" />
</form>
<h2>Pour plus de visibilité, la job board de l'AFPy bouge ici : <a href="https://discuss.afpy.org/c/emplois/14">https://discuss.afpy.org/c/emplois</a> !</h2>
<p>
Pour créer une offre d'emploi là bas, deux solutions :<br/>
<ul>
<li>Envoyer un email à jobs at afpy point org, le titre de votre offre en sujet, le message de votre offre en corps de message, c'est tout.</li>
<li>Publier l'offre directement sur <a href="https://discuss.afpy.org">là bas</a>, dans la catégorie « <a href="https://discuss.afpy.org/c/emplois/14">Offres d'emploi</a> » en cliquant sur le bouton « Créer un sujet »</li>
</ul>
</p>
<h2>C'est quoi https://discuss.afpy.org?</h2>
<p>
C'est une instance de <a href="https://discourse.org">Discourse</a>, un forum <a href="https://github.com/discourse/discourse">open source</a> qu'on héberge en france chez <a href="https://www.gandi.net/fr">Gandi</a>.
</p>
</article>
{% endblock main %}