Skip to content

Commit

Permalink
Merge pull request #61 from software-students-spring2024/add-deck-tem…
Browse files Browse the repository at this point in the history
…plate

Add deck template
  • Loading branch information
gboeker authored Feb 29, 2024
2 parents d950679 + 2998608 commit ec74274
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ def signup():
def allDecks(username):
if username == "guest":
mainDecks = db.decks.find({})
return render_template('decks.html', mainDecks=mainDecks)
return render_template('decks.html', mainDecks=mainDecks, isAuth=False)
else:
if (not current_user.is_authenticated or current_user.id != username):
return redirect('/login')
else:
user = db.users.find_one({'user_id': current_user.id})
mainDecks = db.decks.find({})
return render_template('decks.html', mainDecks = mainDecks, personalDecks = user['personalDecks'])
return render_template('decks.html', username = username, isAuth=True, mainDecks = mainDecks, personalDecks = user['personalDecks'])


@app.route("/<username>/<deckTitle>")
Expand Down
7 changes: 4 additions & 3 deletions templates/decks.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ <h3>{{ deck.title }}</h3>
</a>
{% endfor %}

{% if isAuth %}
<button class="add-deck">
<h3> + </h3>
</button>

<form action="/temp/create" method="post" class="add-deck-form" style="display: none">
<form action="{{ url_for('createDeck', username=username) }}" method="post" class="add-deck-form" style="display: none">
<p>x</p>
<div>
<label for="title">Title: </label>
Expand All @@ -43,5 +44,5 @@ <h3> + </h3>
document.querySelector(".add-deck-form").style.display="none"
})
</script>

{% endblock %}
{% endif %}
{% endblock %}

0 comments on commit ec74274

Please sign in to comment.