Skip to content

Commit

Permalink
Merge branch 'development' into createEventgap
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianRamsay committed Jul 17, 2024
2 parents 4fff539 + d8452bf commit eb0e7d4
Show file tree
Hide file tree
Showing 24 changed files with 596 additions and 331 deletions.
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
22 changes: 19 additions & 3 deletions app/controllers/admin/minor.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
from flask import render_template, g, abort
from flask import render_template, g, abort, request, redirect, url_for

from app.models.user import User

from app.controllers.admin import admin_bp

from app.logic.minor import getMinorInterest, getMinorProgress
from app.logic.minor import getMinorInterest, getMinorProgress, toggleMinorInterest

@admin_bp.route('/admin/cceMinor', methods=['GET'])
@admin_bp.route('/admin/cceMinor', methods=['POST','GET'])
def manageMinor():

if not g.current_user.isAdmin:
abort(403)

if request.method == 'POST':
interested_students = request.form.getlist('interestedStudents[]')

for i in interested_students:
user = User.get(username=i)
if not user.minorInterest:
toggleMinorInterest(i)


interestedStudentsList = getMinorInterest()
interestedStudentEmailString = ';'.join([student['email'] for student in interestedStudentsList])
sustainedEngagement = getMinorProgress()


return render_template('/admin/cceMinor.html',
interestedStudentsList = interestedStudentsList,
interestedStudentEmailString = interestedStudentEmailString,
sustainedEngagement = sustainedEngagement,
)



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
6 changes: 5 additions & 1 deletion app/controllers/main/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ def getDietInfo():

@main_bp.route('/profile/<username>/indicateInterest', methods=['POST'])
def indicateMinorInterest(username):
toggleMinorInterest(username)
if g.current_user.isCeltsAdmin or g.current_user.username == username:
toggleMinorInterest(username)

else:
abort(403)

return ""
18 changes: 17 additions & 1 deletion app/logic/serviceLearningCourses.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,28 @@ def getSLProposalInfoForUser(user: User) -> Dict[int, Dict[str, Any]]:

courseDict[course.id] = {"id":course.id,
"creator":f"{course.createdBy.firstName} {course.createdBy.lastName}",
"name":course.courseName if course.courseName else course.courseAbbreviation,
"name": course.courseName,
"abbr": course.courseAbbreviation,
"courseDisplayName": createCourseDisplayName(course.courseName, course.courseAbbreviation),
"faculty": faculty,
"term": course.term,
"status": course.status.status}
return courseDict

def createCourseDisplayName(name, abbreviation):
'''
This function combines course name and numbers with conditions
inputs: course name, course abbreviation
'''
if name and abbreviation:
return f"{abbreviation} - {name}"
elif not name and not abbreviation:
return ''
elif not name:
return abbreviation
elif not abbreviation:
return name

def saveCourseParticipantsToDatabase(cpPreview: Dict[str, Dict[str, Dict[str, List[Dict[str, Any]]]]]) -> None:
for term, terminfo in cpPreview.items():
termObj: Term = Term.get_or_none(description = term) or addPastTerm(term)
Expand Down
8 changes: 8 additions & 0 deletions app/static/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,12 @@ select.empty {

.rsvp-btn{
padding-top: 4em;
}
.required::after {
content: " *";
color: red;
font-size: 1.3em; /* Adjust the font size as needed */
font-weight: bolder; /* make it bold */
vertical-align: middle; /* Align vertically with the text */
line-height: 1; /* Match the line height of the parent text */
}
6 changes: 5 additions & 1 deletion app/static/css/eventList.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.accordion-button::after {
margin-left: 1.5rem;
}
}

.icon {
margin-right: 20px; /* Adjust the value as needed */
}
19 changes: 0 additions & 19 deletions app/static/css/slcNewProposal.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,5 @@
background-color: #0d6efd;
}

@media (max-width: 1500px){
.btn{
height:60px;
}
.step{
width: 13px;
height:13px;
}
}

@media (max-width: 1100px){
.btn{
height:80px;
}
.step{
width: 10px;
height:10px;
}
}


Loading

0 comments on commit eb0e7d4

Please sign in to comment.