forked from CGM_Public/pretix_original
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-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 {
|
||||
border-top: 1px solid @table-border-color;
|
||||
|
||||
&.headline, &.simple {
|
||||
border-top: 2px solid @table-border-color;
|
||||
}
|
||||
&:last-child {
|
||||
border-bottom: 2px solid @table-border-color;
|
||||
}
|
||||
p:last-child {
|
||||
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 {
|
||||
margin-bottom: 0;
|
||||
|
||||
@@ -17,4 +17,7 @@ footer {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 20px;
|
||||
}
|
||||
.js-only {
|
||||
display: none;
|
||||
}
|
||||
@@ -38,38 +38,54 @@
|
||||
{% if tup.0 %}<h3>{{ tup.0.name }}</h3>{% endif %}
|
||||
{% for item in tup.1 %}
|
||||
{% if item.has_variations %}
|
||||
<div class="row-fluid product-row headline">
|
||||
<div class="col-md-8 col-xs-12">
|
||||
<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="item-with-variations">
|
||||
<div class="row-fluid product-row headline">
|
||||
<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 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 %}
|
||||
{% blocktrans trimmed with minprice=item.min_price|floatformat:2 currency=event.currency %}
|
||||
from {{ currency }} {{ minprice }}
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-6 availability-box">
|
||||
<a href="javascript:void();" data-toggle="variations" class="js-only">
|
||||
{% trans "Show variants" %}
|
||||
</a>
|
||||
</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 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 %}
|
||||
<div class="row-fluid product-row simple">
|
||||
<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[1] = min(var.cached_availability[1],
|
||||
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]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user