Initial working version with minor bugs
This commit is contained in:
parent
f946e4933a
commit
71b3993326
83 changed files with 34485 additions and 173 deletions
13
templates/includes/card_badge.html
Normal file
13
templates/includes/card_badge.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{% if decks|length == 1 %}
|
||||
{% if dropdown %}'{% endif %}<span class="badge card-badge-grid m-1" style="{% if dropdown %}'+ style +'{% else %}background-color: {{ decks.0.hex_color }}; color: white;{% endif %}">{% if dropdown %}' + {% endif %}
|
||||
{% elif decks|length == 2 %}
|
||||
{% if dropdown %}'{% endif %}<span class="badge card-badge-grid m-1" style="{% if dropdown %}'+ style +'{% else %}background: linear-gradient(to right, {{ decks.0.hex_color }}, {{ decks.1.hex_color }}); color: white;{% endif %}">{% if dropdown %}' + {% endif %}
|
||||
{% elif decks|length >= 3 %}
|
||||
{% if dropdown %}'{% endif %}<span class="badge card-badge-grid m-1" style="{% if dropdown %}'+ style +'{% else %}background: linear-gradient(to right, {{ decks.0.hex_color }}, {{ decks.1.hex_color }}, {{ decks.2.hex_color }}); color: white;{% endif %}">{% if dropdown %}' + {% endif %}
|
||||
{% else %}
|
||||
{% if dropdown %}'{% endif %}<span class="badge card-badge-grid m-1" style="{% if dropdown %}'+ style +'{% else %}background-color: #cccccc; color: white;{% endif %}">{% if dropdown %}' + {% endif %}
|
||||
{% endif %}
|
||||
{% if dropdown %}'{% endif %}<span class="card-badge-name">{% if dropdown %}'+ cardName +'{% else %}{{ card.name }}{% endif %}</span>{% if dropdown %}' + {% endif %}
|
||||
{% if dropdown %}'{% endif %}<span class="card-badge-rarity">{% if dropdown %}'+ rarity +'{% else %}{{ card.rarity.icons }}{% endif %}</span>{% if dropdown %}' + {% endif %}
|
||||
{% if dropdown %}'{% endif %}<span class="card-badge-cardset">{% if dropdown %}'+ cardset +'{% else %}{{ card.cardset.name }}{% endif %}</span>{% if dropdown %}' + {% endif %}
|
||||
{% if dropdown %}'{% endif %}</span>{% if dropdown %}'{% endif %}
|
||||
29
templates/includes/card_multiselect.html
Normal file
29
templates/includes/card_multiselect.html
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{% load cache card_badge %}
|
||||
<label for="{{ field_id }}" class="form-label">{{ label }}</label>
|
||||
<select name="{{ field_name }}" id="{{ field_id }}" class="form-select select2-field" data-placeholder="{{ placeholder }}" multiple="multiple">
|
||||
{% cache cache_timeout cache_key %}
|
||||
<option value="" disabled="disabled">{{ placeholder }}</option>
|
||||
{% for card in available_cards %}
|
||||
<option value="{{ card.pk }}"
|
||||
data-name="{{ card.name }}"
|
||||
data-rarity="{{ card.rarity.icons }}"
|
||||
data-cardset="{{ card.cardset.name }}"
|
||||
data-style="{{ card.style }}"
|
||||
{{ card.name }} {{ card.rarity.icons }} {{ card.cardset.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
{% endcache %}
|
||||
</select>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#{{ field_id }}').select2({
|
||||
placeholder: $('#{{ field_id }}').data('placeholder'),
|
||||
templateResult: formatOption,
|
||||
templateSelection: formatOption,
|
||||
width: '100%',
|
||||
dropdownAutoWidth: true,
|
||||
allowClear: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
62
templates/includes/trade_offer.html
Normal file
62
templates/includes/trade_offer.html
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{% load gravatar card_badge %}
|
||||
|
||||
<div class="card trade-offer mb-3 mx-auto shadow-lg unified-card" style="border: none;">
|
||||
<div class="card-body trade-offer-body">
|
||||
<!-- Header Row: Using Grid, with relative positioning for avatar placement -->
|
||||
<div class="row no-gutters">
|
||||
<!-- Has Side -->
|
||||
<div class="col-6 position-relative" style="padding: 1rem;">
|
||||
{% if offer.initiated_by and offer.initiated_by.user.email %}
|
||||
<!-- Positioned to the left -->
|
||||
<div class="avatar position-absolute" style="left: 1rem; top: 50%; transform: translateY(-50%);">
|
||||
{{ offer.initiated_by.user.email|gravatar:40 }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- Centered text remains in the normal flow -->
|
||||
<div class="text-center">
|
||||
<h6 class="card-subtitle text-muted mb-0">Has</h6>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Wants Side -->
|
||||
<div class="col-6 position-relative" style="padding: 1rem;">
|
||||
{% if offer.accepted_by and offer.accepted_by.user.email %}
|
||||
<!-- Positioned to the right -->
|
||||
<div class="avatar position-absolute" style="right: 1rem; top: 50%; transform: translateY(-50%);">
|
||||
{{ offer.accepted_by.user.email|gravatar:40 }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- Centered text remains in the normal flow -->
|
||||
<div class="text-center">
|
||||
<h6 class="card-subtitle text-muted mb-0">Wants</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Body Row: Using Grid, no separators; badge spacing is consistent -->
|
||||
<div class="row no-gutters">
|
||||
<div class="col-6" style="padding: 1rem;">
|
||||
<div class="trade-offer-cards d-flex flex-wrap justify-content-center gap-2">
|
||||
{% if offer.have_cards.all %}
|
||||
{% for card in offer.have_cards.all %}
|
||||
{% card_badge card %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6" style="padding: 1rem;">
|
||||
<div class="trade-off-offer-cards d-flex flex-wrap justify-content-center gap-2">
|
||||
{% if offer.want_cards.all %}
|
||||
{% for card in offer.want_cards.all %}
|
||||
{% card_badge card %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Trade ID Footer with Info Icon -->
|
||||
<small class="text-muted mt-auto d-block text-end pe-2">
|
||||
<i class="bi bi-info-circle-fill" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Trade ID: {{ offer.hash }}" style="cursor: pointer;"></i>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue