Skip to content
Snippets Groups Projects
Commit f6480d01 authored by Andrea Callia D'Iddio's avatar Andrea Callia D'Iddio
Browse files

Feat: show projects from other staff members in the staff project page.

parent 85a0d6cc
No related branches found
No related tags found
No related merge requests found
Pipeline #360851 failed
{% extends "components/layout.html" %}
{% block content %}
{% macro project_list(header, projects, allow_edit) %}
<div class="w3-content">
<div class="w3-container">
<h1 class="w3-center w3-text-teal">Your current project proposals</h1>
<h1 class="w3-center w3-text-teal">{{ header }}</h1>
{% if projects %}
<section class="w3-section">
<ul class="w3-ul">
......@@ -29,11 +28,22 @@
{% else %}
{{ utils.placeholder_text("No projects to show yet.") }}
{% endif %}
{% if allow_edit %}
<section class="w3-section">
<a href="{{ url_for("staff.create_project") }}" class="w3-btn w3-{{ theme_colour }}">Add new
proposal</a>
</section>
{% endif %}
</div>
</div>
{% endmacro %}
{% block content %}
{{ project_list('Your current project proposals', own_projects,allow_edit) }}
<hr>
{{ project_list('Other projects', other_projects, False) }}
{% endblock %}
\ No newline at end of file
......@@ -38,13 +38,21 @@ def unshortlist_old_proposer(project: Project):
@staff_only
def projects():
allow_edit = True if datetime.utcnow() <= DEADLINE_FOR_STAFF_CHANGES else False
active_projects: list[Project] = (
own_projects: list[Project] = (
Project.query.filter_by(proposer=current_user.username)
.filter(Project.deleted.is_(None))
.all()
)
other_projects: list[Project] = (
Project.query.filter(Project.proposer != current_user.username)
.filter(Project.deleted.is_(None))
.all()
)
return render_template(
"pages/staff/projects.html", projects=active_projects, allow_edit=allow_edit
"pages/staff/projects.html",
own_projects=own_projects,
other_projects=other_projects,
allow_edit=allow_edit,
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment