Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
vtestagrossa committed Feb 20, 2024
2 parents bf8a72a + c011a9c commit 0ac7714
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
10 changes: 7 additions & 3 deletions app/hindsite/group/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def search_users():
error = None
if request.method == 'POST':
try:
# get users
#TODO: Check if user invited during search
users = get_users(request.form['search'])
except UserSearchError as e:
error = e.message
Expand All @@ -51,8 +51,12 @@ def send_invite():
"""
if request.method == 'POST':
try:
user = request.args['user']
send_invitation(session['groupid'], user)
if 'groupid' in session:
user = request.args['user']
#TODO: check for an invitation prior to sending
send_invitation(session['groupid'], user)
else:
raise UserSearchError("no group selected")
except UserSearchError as ex:
flash(ex.message)
return "Invitation Sent!"
Expand Down
11 changes: 4 additions & 7 deletions app/hindsite/group/templates/partials/search-results.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<div class="overflow-auto w-30 text-light">
<div class="content-sm text-light">
{% if users != "" %}
{% for user in users %}
<div class="content-sm bg-secondary">
<div class="btn btn-secondary w-100 d-flex justify-content-between align-items-center">
<p class="px-5 py-1 text-align-center">
<div class="btn btn-secondary w-100 h-100 d-flex justify-content-end align-items-center">
<p class="px-1 py-1 text-align-center">
{{ user.email }}
</p>
<p class="px-5 py-1 text-align-center">
{{ user.display_name }}
</p>
<a href="#" class="px-5 py-1 btn btn-light"
<a href="#" class="px-2 btn btn-light h-100 w-30"
hx-post="/send-invite?user={{ user.email }}"
hx-target="#invite-code">
Send Invite
Expand Down
11 changes: 6 additions & 5 deletions app/hindsite/home/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,19 @@ def homepage():
"""
Loads home.html, sets the title
"""
if session['groupname'] is not None:
selected = session['groupname']
else:
selected = "Select Group"
if not 'groupname' in session or session['groupname'] is None:
#Ensures session contains groupname and sets a default value
session['groupname'] = "Select a Group"
selected = session['groupname']

groups = get_groups(current_user.id)
if request.method == 'POST':
try:
session['groupname'] = request.args['groupname']
session['groupid'] = request.args['group_id']
except GroupAddError as ex:
flash(ex.message)
if session['groupname'] is not None:
if 'groupname' in session:
selected = session['groupname']
return render_template('partials/dropdown.html', title='Home', \
groups=groups, selected=selected)
Expand Down

0 comments on commit 0ac7714

Please sign in to comment.