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

style(state): actually display the state on the frontend #120

Merged
merged 1 commit into from
Oct 20, 2023
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
2 changes: 1 addition & 1 deletion concert_elephant/static/js/concert_create.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ $(document).ready(function() {
$("#createVenueForm").on("submit", function (event) {
handleModalSubmit(event, venueCreateUrl, function (data) {
$("#modal-venue-messages").html('<div class="alert alert-success text-center">' + data.message + '</div>');
const venueName = data.venue.name + " - " + data.venue.city + ", " + data.venue.country;
const venueName = data.venue.name + " - " + data.venue.city + ", " + (data.venue.state ? data.venue.state : data.venue.country);
$('#venue-autocomplete').val(venueName);
$('#concert-venue').val(data.venue.id);
setTimeout(() => closeModal("#createVenueModal"), 1000);
Expand Down
15 changes: 15 additions & 0 deletions concert_elephant/templates/concerts/venue_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ <h5 class="display-4 text-center">Venues</h5>
</a>
</span>
</th>
<th class="text-center" scope="col">
State
<span class="sort-icon" data-sort="state">
<a href="{% if request.GET.sort_by == "city" %}?sort_by=-state{% else %}?sort_by=state{% endif %}">
<i title="Sort" class="bi bi-arrow-down-up default-icon {% if "state" in request.GET.sort_by or "-state" in request.GET.sort_by %}hidden{% endif %}"></i>
</a>
<a href="?sort_by=-state">
<i title="Change to descending" class="bi bi-arrow-up asc-icon {% if request.GET.sort_by == "state" %}active{% endif %}"></i>
</a>
<a href="?sort_by=state">
<i title="Change to ascending" class="bi bi-arrow-down desc-icon {% if request.GET.sort_by == "-state" %}active{% endif %}"></i>
</a>
</span>
</th>
<th class="text-center" scope="col">
Country
<span class="sort-icon" data-sort="country">
Expand Down Expand Up @@ -80,6 +94,7 @@ <h5 class="display-4 text-center">Venues</h5>
data-href="{% url 'concerts:venue-detail' venue.id %}">
<td class="align-middle text-center">{{ venue.name }}</td>
<td class="align-middle text-center">{{ venue.city }}</td>
<td class="align-middle text-center">{% if venue.state %}{{ venue.state }}{% else %}---{% endif %}</td>
<td class="align-middle text-center">{{ venue.country }}</td>
<td class="align-middle text-center">{{ venue.concert_count }}</td>
</tr>
Expand Down
2 changes: 2 additions & 0 deletions concert_elephant/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ <h5 class="card-header card-header-custom display-4 text-center">Recent Venues</
<tr>
<th scope="col">Venue</th>
<th class="text-center" scope="col">City</th>
<th class="text-center" scope="col">State</th>
<th class="text-center" scope="col">Country</th>
<th class="text-center" scope="col">Concerts</th>
</tr>
Expand All @@ -93,6 +94,7 @@ <h5 class="card-header card-header-custom display-4 text-center">Recent Venues</
<tr class="clickable-row" data-href="{% url 'concerts:venue-detail' venue.pk %}">
<td>{{ venue.name }}</td>
<td class="text-center">{{ venue.city }}</td>
<td class="text-center">{% if venue.state %}{{ venue.state }}{% else %}---{% endif %}</td>
<td class="text-center">{{ venue.country.alpha3 }}</td>
<td class="text-center">{{ venue.concerts.count }}</td>
</tr>
Expand Down
2 changes: 2 additions & 0 deletions concert_elephant/templates/main_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ <h5 class="card-header card-header-custom display-4 text-center">Venues</h5>
<tr>
<th scope="col">Venue</th>
<th class="text-center" scope="col">City</th>
<th class="text-center" scope="col">State</th>
<th class="text-center" scope="col">Country</th>
<th class="text-center" scope="col">Total Concerts</th>
</tr>
Expand All @@ -47,6 +48,7 @@ <h5 class="card-header card-header-custom display-4 text-center">Venues</h5>
<tr class="clickable-row" data-href="{% url 'concerts:venue-detail' venue.pk %}">
<td>{{ venue.name }}</td>
<td class="text-center">{{ venue.city }}</td>
<td class="text-center">{% if venue.state %}{{ venue.state }}{% else %}---{% endif %}</td>
<td class="text-center">{{ venue.country }}</td>
<td class="text-center">{{ venue.concerts.count }}</td> <!-- Assuming you have a reverse relation called concerts on the Venue model -->
</tr>
Expand Down