Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indicate Event in progress #1231

Merged
merged 17 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ def load_currentTerm():
session['current_term'] = model_to_dict(term)
g.current_term = term

import datetime
@app.before_request
def load_currentDateTime():
g.currentDateTime = datetime.datetime.now()

from flask import request
@app.context_processor
def load_visibleAccordion():
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/admin/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def eventDisplay(eventId):
eventData['timeEnd'] = event.timeEnd.strftime("%-I:%M %p")
eventData['startDate'] = event.startDate.strftime("%m/%d/%Y")
eventCountdown = getCountdownToEvent(event)


# Identify the next event in a recurring series
if event.recurringId:
Expand All @@ -320,7 +320,8 @@ def eventDisplay(eventId):
filepaths=filepaths,
image=image,
pageViewsCount=pageViewsCount,
eventCountdown=eventCountdown)
eventCountdown=eventCountdown
)



Expand Down
2 changes: 1 addition & 1 deletion app/templates/admin/createEvent.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{% extends "eventNav.html"%}
{% endif %}

{% set eventPast = event.isPastStart if not isNewEvent else False %}
{% set eventPast = event.isPastEnd if not isNewEvent else False %}
{% set tabName = 'edit' %}


Expand Down
19 changes: 13 additions & 6 deletions app/templates/eventNav.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@
{% if g.current_user.isAdmin %}
{{ eventheader(page_title, event, 'large', isNewEvent) }}
{% endif %}
{% set alertClass = "alert-danger" if isPastEnd else "alert-warning"%}
{% set display = "" if isPastEnd or event.isCanceled else "d-none"%}
{% set isInProg = not event.isPastEnd and event.isPastStart %}
{% set display = "" if eventPast or event.isCanceled or isInProg else "d-none"%}
{% set alertClass = ("alert-success" if isInProg else ( "alert-danger" if eventPast else "alert-warning")) %}
{% set event_year = event.endDate.strftime("%Y") | int %}
{% set currentYear = g.currentDateTime.year | int %}
{% set formatted_date = event.endDate.strftime("%B %d %Y") if currentYear > event_year else event.endDate.strftime("%B %d") %}

<div class = "{{alertClass}} {{display}} mb-2 pb-2 pt-2" role="alert">
{% if isPastEnd and event.isCanceled %}
{% if eventPast and event.isCanceled %}
This is a past event and it was canceled.
{% elif isPastEnd %}
This is a past event.
{% elif isInProg %}
This event is in-progress! It started at {{event.timeStart.strftime("%I:%M %p")}}.
{% elif eventPast %}
This event ended on {{ formatted_date }} at {{ event.timeEnd.strftime("%I:%M %p") }}.
{% elif event.isCanceled %}
This event has been canceled.
{% endif %}
Expand Down Expand Up @@ -57,4 +64,4 @@

{% endif %}
{% endblock %}
{% endblock %}
{% endblock %}
6 changes: 4 additions & 2 deletions app/templates/eventView.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{% set isPastEnd = event.isPastEnd %}
{% set tabName = 'view' %}
{% extends "eventNav.html"%}
<!-- Without eventPast view event cannot use it when called through eventNav -->
{% set eventPast = event.isPastStart if not isNewEvent else False %}
BrianRamsay marked this conversation as resolved.
Show resolved Hide resolved

{% block scripts %}
{{super()}}
Expand Down Expand Up @@ -66,7 +68,7 @@ <h5 id="location"style="margin: 0;">Location:</h5>
<br>
<div>
{% if eventData.isRsvpRequired %}
{% if not eventPast %}
{% if not event.isPastStart %}
{% if userHasRSVPed %}
<button type="submit" class="btn btn-danger" value="{{eventData.id}}" id="removeRsvpBtn">Remove RSVP</button>
{% elif eventData.isRsvpRequired %}
Expand Down Expand Up @@ -128,7 +130,7 @@ <h3>Contact Information:</h3>
{% endif %}
<br>
</div>
<div class="col-md-6">
<div class="col-md-6">
{% if programTrainings %}
{% if program or not eventData.isAllVolunteerTraining %}
<h3>Program Trainings:</h3>
Expand Down
7 changes: 2 additions & 5 deletions app/templates/events/manageVolunteers.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
{% extends "eventNav.html" %}



{% block scripts %}
{{super()}}
<script type="module" src="/static/js/manageVolunteers.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.11.3/r-2.2.9/datatables.min.js"></script>
{% endblock %}





{% block styles %}

{{super()}}
Expand Down Expand Up @@ -367,4 +364,4 @@ <h5 class="modal-title">{{modalTitle}}</h5>
</div>
</div>
</div>
{% endblock %}
{% endblock %}
Loading