Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
feat(views): ✨ Add commendation location to web
Browse files Browse the repository at this point in the history
Adds the commendation location field to the award commendation page, and updates the commendation type to avoid conflicts

Signed-off-by: Matthew Gray <[email protected]>
  • Loading branch information
mmoomocow committed Sep 22, 2023
1 parent bbe2bc4 commit a679859
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
7 changes: 7 additions & 0 deletions commendations/static/commendations/giveCommendation.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ form #submit {
cursor: pointer;
}

fieldset {
/* Remove annoying fieldset styles */
border: none;
padding: 0;
margin: 0;
}

.errorMessage {
color: red;
font-weight: bold;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 23 additions & 5 deletions commendations/templates/commendations/award.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,29 @@
<div class="formField">
<label for="commendationType">Commendation Type <abbr class="requiredField" title="This field is required">*</abbr></label>
<br>
{% for type in commendationTypes %}
<input type="radio" name="commendationType" id="{{ type.value }}" value="{{ type.value }}" required>
<label for="{{ type.value }}">{{ type.name }}</label>
<br>
{% endfor %}
<fieldset name="commendationType">
{% for type in commendationTypes %}
<input type="radio" name="commendationType" id="type-{{ type.value }}" value="{{ type.value }}" required>
<label for="type-{{ type.value }}">{{ type.name }}</label>
<br>
{% endfor %}
</fieldset>
</div>

<div class="formField">
<label for="commendationLocation">Commendation Location</label>
<br>
<fieldset name="commendationLocation">
{% for Location in commendationLocations %}
{% if forloop.counter == 1 %}
<input type="radio" name="commendationLocation" id="loc-{{ Location.value }}" value="{{ Location.value }}" checked>
{% else %}
<input type="radio" name="commendationLocation" id="loc-{{ Location.value }}" value="{{ Location.value }}">
{% endif %}
<label for="loc-{{ Location.value }}">{{ Location.name }}</label>
<br>
{% endfor %}
</fieldset>
</div>

<div class="formField">
Expand Down
4 changes: 4 additions & 0 deletions commendations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ def giveCommendation(request):

# Process and render the award commendation page
_commendationTypes = []
_commendationLocations = []

for Type in Commendation.COMMENDATION_TYPE_CHOICES:
_commendationTypes.append({"name": Type[1], "value": Type[0]})
for Location in Commendation.INSIDE_OUTSIDE_CHOICES:
_commendationLocations.append({"name": Location[1], "value": Location[0]})
students = Student.objects.all()
teachers = Teacher.objects.all()

Expand All @@ -113,6 +116,7 @@ def giveCommendation(request):
# Generate context and render the page
context = {
"commendationTypes": _commendationTypes,
"commendationLocations": _commendationLocations,
"students": students,
"teachers": teachers,
}
Expand Down

0 comments on commit a679859

Please sign in to comment.