Some optimizations to trade_offers to reduce loading times
This commit is contained in:
parent
0ac8ac8d5c
commit
9ce5d525b3
13 changed files with 255 additions and 222 deletions
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
{% block javascript_head %}{% endblock %}
|
||||
</head>
|
||||
<body class="min-h-screen bg-base-200">
|
||||
<div class="min-h-screen bg-base-200">
|
||||
<!-- Header and Navigation -->
|
||||
<div class="navbar bg-base-100 shadow-sm">
|
||||
<div class="navbar-start">
|
||||
|
|
@ -116,7 +116,6 @@
|
|||
<li><a href="{% url 'account_logout' %}">Sign Out</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="flex gap-2">
|
||||
<a class="btn btn-primary" href="{% url 'account_login' %}">Login</a>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ Expected variables:
|
|||
</select>
|
||||
</div>
|
||||
{% else %}
|
||||
<input type="hidden" name="{{ field_name }}" value="{{ friend_codes.0.pk }}">
|
||||
<input type="hidden" id="{{ field_name }}" name="{{ field_name }}" value="{{ friend_codes.0.pk }}">
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
|
|
@ -6,25 +6,54 @@
|
|||
{% block content %}
|
||||
<div class="container mx-auto max-w-2xl mt-6">
|
||||
<h2 class="text-2xl font-bold">Trade Offer Details</h2>
|
||||
<div>
|
||||
<div class="flex justify-center mt-10">
|
||||
{% render_trade_offer object %}
|
||||
</div>
|
||||
{% if acceptance_form %}
|
||||
<h3 class="text-xl font-semibold mt-6">Accept This Offer</h3>
|
||||
<div class="card p-4">
|
||||
<div class="w-3/4 mx-auto mt-4">
|
||||
<h3 class="text-xl font-semibold mt-6 mb-2">Accept This Offer</h3>
|
||||
<form method="post" action="{% url 'trade_acceptance_create' offer_pk=object.pk %}">
|
||||
{% csrf_token %}
|
||||
{{ acceptance_form.as_p }}
|
||||
<button type="submit" class="btn btn-primary">Submit Acceptance</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
<input type="hidden" name="next" value="{% url 'trade_offer_detail' pk=object.pk %}">
|
||||
|
||||
<div class="mt-6">
|
||||
{% if is_initiator %}
|
||||
<a href="{{ delete_close_url }}" class="btn btn-danger">Delete/Close Trade Offer</a>
|
||||
<div class="mb-4">
|
||||
<label for="{{ acceptance_form.offered_card.id_for_label }}" class="block text-sm font-medium text-gray-700">I have:</label>
|
||||
{{ acceptance_form.offered_card }}
|
||||
{% for error in acceptance_form.offered_card.errors %}
|
||||
<p class="mt-1 text-sm text-red-600">{{ error }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="{{ acceptance_form.requested_card.id_for_label }}" class="block text-sm font-medium text-gray-700">I want:</label>
|
||||
{{ acceptance_form.requested_card }}
|
||||
{% for error in acceptance_form.requested_card.errors %}
|
||||
<p class="mt-1 text-sm text-red-600">{{ error }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
{% if not acceptance_form.accepted_by.field.widget.is_hidden %}
|
||||
<label for="{{ acceptance_form.accepted_by.id_for_label }}" class="block text-sm font-medium text-gray-700">
|
||||
Accepted By
|
||||
</label>
|
||||
{% endif %}
|
||||
{{ acceptance_form.accepted_by }}
|
||||
{% for error in acceptance_form.accepted_by.errors %}
|
||||
<p class="mt-1 text-sm text-red-600">{{ error }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<a href="{% url 'trade_offer_list' %}" class="btn btn-secondary">Back to Trade Offers</a>
|
||||
|
||||
<div class="mt-6 flex justify-between">
|
||||
<a href="{% url 'trade_offer_list' %}" class="btn btn-secondary">Back to Trade Offers</a>
|
||||
{% if is_initiator %}
|
||||
<a href="{{ delete_close_url }}" class="btn btn-danger">Delete/Close Trade Offer</a>
|
||||
{% else %}
|
||||
<button type="submit" class="btn btn-primary">Submit Acceptance</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
|
@ -57,8 +57,7 @@
|
|||
<div
|
||||
id="my-trade-offers"
|
||||
x-data="tradeOffersPagination('{% url 'trade_offer_my_list' %}?ajax_section=my_trade_offers')"
|
||||
x-init="init()"
|
||||
>
|
||||
x-init="init()">
|
||||
{% include "trades/_trade_offer_list_paginated.html" with offers=my_trade_offers_paginated %}
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue