Skip to content

Commit

Permalink
Improve layout of faculty dashboard while selections are open
Browse files Browse the repository at this point in the history
  • Loading branch information
ds283 committed Apr 15, 2024
1 parent d91522c commit 073b511
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 24 deletions.
8 changes: 2 additions & 6 deletions app/ajax/faculty/past_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,8 @@

# language=jinja2
_metadata = """
<div>
{{ project_selection_data(p) }}
</div>
<div class="mt-1">
{{ project_metadata(p) }}
</div>
{{ project_selection_data(p) }}
{{ project_metadata(p) }}
"""


Expand Down
13 changes: 4 additions & 9 deletions app/templates/faculty/dashboard/selector_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,34 +183,29 @@
</div>
<div class="container-fluid">
<div class="row fac-project-table">
<div class="col-3"><strong>Name</strong></div>
<div class="col-3"><strong>Info</strong></div>
<div class="col-6"><strong>Name</strong></div>
<div class="col-3"><strong>Meeting requests</strong></div>
<div class="col-3"><strong>Meetings confirmed</strong></div>
</div>
{% for project in live_projects %}
<div class="row mb-3">
<div class="col-3">
<div class="col-6">
<div>
<a class="text-decoration-none fw-semibold"
href="{{ url_for('faculty.live_project', pid=project.id, text='home dashboard', url=home_dashboard_url) }}">
{{ project.name }}
</a>
</div>
<div class="mt-1">
{{ project_metadata(project) }}
{{ project_metadata(project, user_classes="mt-2") }}
{{ project_selection_data(project) }}
</div>
<div class="mt-2">
<a class="link-secondary text-decoration-none small"
href="{{ url_for('reports.liveproject_analytics', proj_id=project.id, text='home dashboard', url=home_dashboard_url) }}">View
analytics...</a>
</div>
</div>
<div class="col-3">
<div>
{{ project_selection_data(project) }}
</div>
</div>
<div class="col-3">
<div class="d-flex flex-row justify-content-start align-items-start flex-wrap gap-2">
{% for req in project.requests_waiting %}
Expand Down
53 changes: 44 additions & 9 deletions app/templates/faculty/macros.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,60 @@
{% from "labels.html" import simple_label, unformatted_label %}

{% macro project_metadata(project) %}
{% macro project_metadata(project, user_classes=none) %}
{% if project is not none %}
<div class="d-flex flex-column justify-content-start align-items-start gap-1 mt-2">
<div class="d-flex flex-column justify-content-start align-items-start gap-1
{% if user_classes is not none %}{{ user_classes }}{% endif %}">
{% if project.last_view %}
<div class="text-muted small">last view {{ project.last_view.strftime("%a %d %b %Y %H:%M:%S") }}</div>
{% endif %}
</div>
{% else %}
<span class="badge bg-danger">Missing project data</span>
<span class="badge bg-danger {% if user_classes is not none %}{{ user_classes }}{% endif %}">Missing project data</span>
{% endif %}
{% endmacro %}

{% macro project_selection_data(project) %}
{% macro project_selection_data(project, user_classes=none) %}
{% if project is not none %}
<div class="d-flex flex-column justify-content-start align-items-start">
<div class="text-secondary small">{{ unformatted_label(project.selections_label(popover=True), prefix='<i class="fas fa-arrow-right"></i>') }}</div>
<div class="text-secondary small">{{ unformatted_label(project.bookmarks_label(popover=True), prefix='<i class="fas fa-arrow-right"></i>') }}</div>
<div class="text-secondary small">{{ unformatted_label(project.views_label(), prefix='<i class="fas fa-arrow-right"></i>') }}</div>
{% set select_label = project.selections_label(popover=True) %}
{% set bookmark_label = project.bookmarks_label(popover=True) %}
{% set view_label = project.views_label() %}
<div class="d-flex flex-row justify-content-start align-items-start gap-1
{% if user_classes is not none %}{{ user_classes }}{% endif %}">
{% if 'label' in select_label %}
<span class="small text-secondary">{{ select_label['label'] }},</span>
{% else %}
<span class="small text-danger">selection data missing,</span>
{% endif %}
{% if 'label' in bookmark_label %}
<span class="small text-secondary">{{ bookmark_label['label'] }},</span>
{% else %}
<span class="small text-danger">bookmark data missing,</span>
{% endif %}
{% if 'label' in view_label %}
<span class="small text-secondary">{{ view_label['label'] }},</span>
{% else %}
<span class="small text-danger">views data missing,</span>
{% endif %}
</div>
{% if 'popover' in select_label %}
{%- set popover_str = select_label['popover'] %}
{%- if popover_str is iterable and popover_str is not string %}
{%- set popover_str = popover_str|wrap_list('<div>', '</div>')|join -%}
{%- endif -%}
<div><span class="small text-secondary" tabindex="0" data-bs-toggle="popover" data-bs-container="body"
data-bs-trigger="focus" data-bs-content="{{ popover_str }}">View selections <i
class="fas fa-chevron-right"></i></span></div>
{% endif %}
{% if 'popover' in bookmark_label %}
{%- set popover_str = bookmark_label['popover'] %}
{%- if popover_str is iterable and popover_str is not string %}
{%- set popover_str = popover_str|wrap_list('<div>', '</div>')|join -%}
{%- endif -%}
<div><span class="small text-secondary" tabindex="0" data-bs-toggle="popover" data-bs-container="body"
data-bs-trigger="focus" data-bs-content="{{ popover_str }}">View bookmarks <i
class="fas fa-chevron-right"></i></span></div>
{% endif %}
{% else %}
<span class="badge bg-danger">Missing project data</span>
<span class="badge bg-danger {% if user_classes is not none %}{{ user_classes }}{% endif %}">Missing project data</span>
{% endif %}
{% endmacro %}

0 comments on commit 073b511

Please sign in to comment.