Skip to content

Commit

Permalink
Adjusted card preview - statuse tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekaterina-Vititneva committed Aug 11, 2024
1 parent 580ce40 commit 4e89920
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 11 deletions.
25 changes: 18 additions & 7 deletions project_2/commerce/auctions/static/auctions/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,30 @@ body {
text-decoration: none !important;
}

.card:hover {
text-decoration: none;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.card-price {
display: flex;
flex-direction: row;
}

.card-subtitle-bold {
font-weight: bold;
}

.card-statuse {
align-items: center;
margin-left: 10px;
margin-left: auto;
}

.text-bg-success {
background-color: #9ab7f4 !important;
}

.text-bg-danger {
background-color: #e0ac8b !important;
}

.card:hover {
text-decoration: none;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.listing-image {
Expand Down
2 changes: 1 addition & 1 deletion project_2/commerce/auctions/templates/auctions/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h2>Active Listings</h2>
<div class="card-body">
<h5 class="card-title">{{ listing.title }}</h5>
<div class="card-price">
<h6 class="card-subtitle mb-2 text-body">Price: {{ listing.bid }}€</h6>
<p class="card-subtitle-bold">Price: {{ listing.bid }}€</p>
<div class="card-statuse">
{%if listing.active%}
<span class="badge text-bg-success">Active</span>
Expand Down
13 changes: 12 additions & 1 deletion project_2/commerce/auctions/templates/auctions/listing.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h4 class="listing-bid">{{ listing.bid }}€</h4>
<div class = "listing-details">
<div>Category: {{ listing.category }}</div>
<div>Listed by {{ listing.created_by }}</div>
<div>Last Bid by {{ listing.last_modifed_by }}</div>
<div>Last Bid by {{ listing.last_modified_by }}</div>
<div>Created time: {{ listing.created_at }}</div>
<div>Updated time: {{ listing.updated_at }}</div>
<div>Statuse:
Expand All @@ -69,6 +69,17 @@ <h4 class="listing-bid">{{ listing.bid }}€</h4>
</div>
</div>
</div>
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<img src="..." class="rounded me-2" alt="...">
<strong class="me-auto">Bootstrap</strong>
<small>11 mins ago</small>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="toast-body">
Hello, world! This is a toast message.
</div>
</div>
<div class="listing-bottom">
<p class="listing-description-heading">Description</p>
<p class="listing-description">{{ listing.description }}</p>
Expand Down
11 changes: 10 additions & 1 deletion project_2/commerce/auctions/templates/auctions/watchlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ <h2>Watchlist</h2>
{% endif %}
<div class="card-body">
<h5 class="card-title">{{ listing.title }}</h5>
<h6 class="card-subtitle mb-2 text-body">Price: {{ listing.bid }}€</h6>
<div class="card-price">
<p class="card-subtitle-bold">Price: {{ listing.bid }}€</p>
<div class="card-statuse">
{%if listing.active%}
<span class="badge text-bg-success">Active</span>
{% else %}
<span class="badge text-bg-danger">Closed</span>
{% endif %}
</div>
</div>
<p class="card-text">{{ listing.description }}</p>
</div>
<div class="card-footer text-body-secondary">
Expand Down
4 changes: 3 additions & 1 deletion project_2/commerce/auctions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ def listing(request, title):
listing=listing,
)
new_bid.save()

listing.last_modified_by = user
listing.save()

messages.success(request, "Your bid was placed successfully!")
return redirect('listing', title=listing.title)
else:
Expand Down

0 comments on commit 4e89920

Please sign in to comment.