mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Collapse variants by default
This commit is contained in:
@@ -5,6 +5,11 @@ $(function () {
|
|||||||
$($(this).attr("data-parent")).find(".collapse.in").collapse('hide');
|
$($(this).attr("data-parent")).find(".collapse.in").collapse('hide');
|
||||||
$($(this).attr("data-target")).collapse('show');
|
$($(this).attr("data-target")).collapse('show');
|
||||||
});
|
});
|
||||||
|
$(".js-only").removeClass("js-only");
|
||||||
|
$(".variations").hide();
|
||||||
|
$("a[data-toggle=variations]").click(function() {
|
||||||
|
$(this).parent().parent().parent().find(".variations").slideToggle();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
.product-row {
|
.product-row {
|
||||||
border-top: 1px solid @table-border-color;
|
border-top: 1px solid @table-border-color;
|
||||||
|
|
||||||
&.headline, &.simple {
|
|
||||||
border-top: 2px solid @table-border-color;
|
|
||||||
}
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
border-bottom: 2px solid @table-border-color;
|
|
||||||
}
|
}
|
||||||
p:last-child {
|
p:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
@@ -25,6 +21,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.item-with-variations .product-row.headline, .product-row.simple {
|
||||||
|
border-top: 2px solid @table-border-color;
|
||||||
|
}
|
||||||
|
.item-with-variations:last-child {
|
||||||
|
border-bottom: 2px solid @table-border-color;
|
||||||
|
}
|
||||||
|
|
||||||
.panel-body address:last-child {
|
.panel-body address:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|||||||
@@ -18,3 +18,6 @@ footer {
|
|||||||
right: 0;
|
right: 0;
|
||||||
bottom: 20px;
|
bottom: 20px;
|
||||||
}
|
}
|
||||||
|
.js-only {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
@@ -38,38 +38,54 @@
|
|||||||
{% if tup.0 %}<h3>{{ tup.0.name }}</h3>{% endif %}
|
{% if tup.0 %}<h3>{{ tup.0.name }}</h3>{% endif %}
|
||||||
{% for item in tup.1 %}
|
{% for item in tup.1 %}
|
||||||
{% if item.has_variations %}
|
{% if item.has_variations %}
|
||||||
<div class="row-fluid product-row headline">
|
<div class="item-with-variations">
|
||||||
<div class="col-md-8 col-xs-12">
|
<div class="row-fluid product-row headline">
|
||||||
<strong>{{ item.name }}</strong>
|
|
||||||
{% if item.short_description %}<p>{{ item.short_description }}</p>{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
</div>
|
|
||||||
{% for var in item.available_variations %}
|
|
||||||
<div class="row-fluid product-row variation">
|
|
||||||
<div class="col-md-8 col-xs-12">
|
<div class="col-md-8 col-xs-12">
|
||||||
{{ var }}
|
<a href="javascript:void();" data-toggle="variations">
|
||||||
|
<strong>{{ item.name }}</strong>
|
||||||
|
</a>
|
||||||
|
{% if item.short_description %}<p>{{ item.short_description }}</p>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-xs-6 price">
|
<div class="col-md-2 col-xs-6 price">
|
||||||
{{ event.currency }} {{ var.price|floatformat:2 }}
|
{% blocktrans trimmed with minprice=item.min_price|floatformat:2 currency=event.currency %}
|
||||||
{% if item.tax_rate %}
|
from {{ currency }} {{ minprice }}
|
||||||
<br /><small>{% blocktrans trimmed with rate=item.tax_rate %}
|
{% endblocktrans %}
|
||||||
incl. {{ rate }}% taxes
|
</div>
|
||||||
{% endblocktrans %}</small>
|
<div class="col-md-2 col-xs-6 availability-box">
|
||||||
{% endif %}
|
<a href="javascript:void();" data-toggle="variations" class="js-only">
|
||||||
|
{% trans "Show variants" %}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% if var.cached_availability.0 == 100 %}
|
|
||||||
<div class="col-md-2 col-xs-6 availability-box available">
|
|
||||||
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
|
||||||
max="{{ var.cached_availability.1 }}"
|
|
||||||
name="variation_{{ item.identity }}_{{ var.variation.identity }}">
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
{% include "pretixpresale/event/fragment_availability.html" with avail=var.cached_availability.0 %}
|
|
||||||
{% endif %}
|
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
<div class="variations">
|
||||||
|
{% for var in item.available_variations %}
|
||||||
|
<div class="row-fluid product-row variation">
|
||||||
|
<div class="col-md-8 col-xs-12">
|
||||||
|
{{ var }}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 col-xs-6 price">
|
||||||
|
{{ event.currency }} {{ var.price|floatformat:2 }}
|
||||||
|
{% if item.tax_rate %}
|
||||||
|
<br /><small>{% blocktrans trimmed with rate=item.tax_rate %}
|
||||||
|
incl. {{ rate }}% taxes
|
||||||
|
{% endblocktrans %}</small>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% if var.cached_availability.0 == 100 %}
|
||||||
|
<div class="col-md-2 col-xs-6 availability-box available">
|
||||||
|
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
||||||
|
max="{{ var.cached_availability.1 }}"
|
||||||
|
name="variation_{{ item.identity }}_{{ var.variation.identity }}">
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
{% include "pretixpresale/event/fragment_availability.html" with avail=var.cached_availability.0 %}
|
||||||
|
{% endif %}
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="row-fluid product-row simple">
|
<div class="row-fluid product-row simple">
|
||||||
<div class="col-md-8 col-xs-12">
|
<div class="col-md-8 col-xs-12">
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class EventIndex(EventViewMixin, CartDisplayMixin, TemplateView):
|
|||||||
var.cached_availability = list(var['variation'].check_quotas())
|
var.cached_availability = list(var['variation'].check_quotas())
|
||||||
var.cached_availability[1] = min(var.cached_availability[1],
|
var.cached_availability[1] = min(var.cached_availability[1],
|
||||||
int(self.request.event.settings.max_items_per_order))
|
int(self.request.event.settings.max_items_per_order))
|
||||||
|
item.min_price = min([var['price'] for v in item.available_variations])
|
||||||
|
|
||||||
items = [item for item in items if len(item.available_variations) > 0]
|
items = [item for item in items if len(item.available_variations) > 0]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user