Add setting to turn off automatic collapsing of variations

This commit is contained in:
Raphael Michel
2017-01-22 20:31:59 +01:00
parent 3a2ca8d3d6
commit 78fc58cc93
5 changed files with 16 additions and 5 deletions

View File

@@ -128,6 +128,10 @@ DEFAULTS = {
'default': 'False',
'type': bool
},
'show_variations_expanded': {
'default': 'False',
'type': bool
},
'ticket_download': {
'default': 'False',
'type': bool

View File

@@ -499,6 +499,10 @@ class DisplaySettingsForm(SettingsForm):
required=False,
widget=I18nTextarea
)
show_variations_expanded = forms.BooleanField(
label=_("Show variations of a product expanded by default"),
required=False
)
class TicketSettingsForm(SettingsForm):

View File

@@ -10,6 +10,7 @@
{% bootstrap_field form.primary_color layout="horizontal" %}
{% bootstrap_field form.logo_image layout="horizontal" %}
{% bootstrap_field form.frontpage_text layout="horizontal" %}
{% bootstrap_field form.show_variations_expanded layout="horizontal" %}
</fieldset>
<div class="form-group submit-group">
<button type="submit" class="btn btn-primary btn-save">

View File

@@ -113,13 +113,15 @@
{% endif %}
</div>
<div class="col-md-2 col-xs-6 availability-box">
<a href="#" data-toggle="variations" class="js-only">
{% trans "Show variants" %}
</a>
{% if not event.settings.show_variations_expanded %}
<a href="#" data-toggle="variations" class="js-only">
{% trans "Show variants" %}
</a>
{% endif %}
</div>
<div class="clearfix"></div>
</div>
<div class="variations">
<div class="variations {% if not event.settings.show_variations_expanded %}variations-collapsed{% endif %}">
{% for var in item.available_variations %}
<div class="row-fluid product-row variation">
<div class="col-md-8 col-xs-12">

View File

@@ -20,7 +20,7 @@ $(function () {
$($(this).attr("data-target")).collapse('show');
});
$(".js-only").removeClass("js-only");
$(".variations").hide();
$(".variations-collapsed").hide();
$("a[data-toggle=variations]").click(function (e) {
$(this).parent().parent().parent().find(".variations").slideToggle();
e.preventDefault();