Added AmiiboShop type, updated shop list layout
This commit is contained in:
parent
f6d0adedfb
commit
6949a88aed
|
@ -14,6 +14,6 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='amiiboshop',
|
||||
name='type',
|
||||
field=models.CharField(default=1, max_length=1, choices=[(1, b'Figure'), (2, b'Pack')]),
|
||||
field=models.CharField(default=b'1', max_length=1, choices=[(b'1', b'Figure'), (b'2', b'Pack')]),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -150,8 +150,8 @@ class AmiiboCard(models.Model):
|
|||
|
||||
|
||||
class AmiiboShop(models.Model):
|
||||
FIGURE = 1
|
||||
PACK = 2
|
||||
FIGURE = '1'
|
||||
PACK = '2'
|
||||
|
||||
ITEM_TYPES = (
|
||||
(FIGURE, 'Figure'),
|
||||
|
@ -189,6 +189,10 @@ class AmiiboShop(models.Model):
|
|||
def last_price(self):
|
||||
return self.price_set.first()
|
||||
|
||||
@property
|
||||
def is_pack(self):
|
||||
return self.type == self.PACK
|
||||
|
||||
def __unicode__(self):
|
||||
return u'{} in {}'.format(self.amiibo.name, self.shop.name)
|
||||
|
||||
|
|
|
@ -5,3 +5,10 @@ $('[data-href]').on('click', function(event) {
|
|||
|
||||
// Enable dropdowns
|
||||
$('.dropdown').dropdown({transition: 'drop', on: 'hover'});
|
||||
|
||||
$(function(){
|
||||
$('[data-component="silbingPopup"]').popup({
|
||||
inline: true,
|
||||
position: 'left center'
|
||||
});
|
||||
});
|
||||
|
|
|
@ -58,7 +58,6 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "Shop" %}</th>
|
||||
<th class="center aligned">{% trans "Stock" %}</th>
|
||||
<th class="center aligned">{% trans "Price" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -71,18 +70,29 @@
|
|||
<a href="{{ relation.get_url }}" target="_blank">
|
||||
<i class="{% if relation.shop.flag_code == 'uk' %}gb{% else %}{{ relation.shop.flag_code }}{% endif %} flag"></i> {{ relation.shop.name }}
|
||||
</a>
|
||||
{% if relation.last_price.date %}<em class="float-right">{% trans "Updated " %} <span data-relative="{{ relation.last_price.date.isoformat }}"></span></em>{% endif %}
|
||||
{% if relation.last_price.date %}
|
||||
<i class="ui icon info circle float-right" data-component="silbingPopup"></i>
|
||||
<div class="ui special popup">
|
||||
<em>{% trans "Updated " %} <span data-relative="{{ relation.last_price.date.isoformat }}"></span></em>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if relation.is_pack %}
|
||||
<i class="icon cube float-right" data-component="silbingPopup"></i>
|
||||
<div class="ui special popup">
|
||||
{% trans "This is a pack of various items" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endspaceless %}
|
||||
<td class="center aligned {{ stock|yesno:'positive,negative' }}" {% if not price %}colspan="2"{% endif %}>
|
||||
<i class="icon {{ stock|yesno:'checkmark,close' }}"></i>
|
||||
{{ stock|yesno|capfirst }}
|
||||
<td class="center aligned {{ stock|yesno:'positive,negative' }}">
|
||||
{% if stock and price %}
|
||||
<span data-price="{{ price }}" data-currency="{{ currency }}" data-money>
|
||||
{{ price }} {{ relation.last_price.currency }}
|
||||
</span>
|
||||
{% else %}
|
||||
{% trans "No stock" %}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% if price %}
|
||||
<td class="center aligned" data-price="{{ price }}" data-currency="{{ currency }}" data-money>
|
||||
{{ price }} {{ relation.last_price.currency }}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in New Issue