diff --git a/doc/development/api/restriction.rst b/doc/development/api/restriction.rst index e29b799cd..ff3870ee7 100644 --- a/doc/development/api/restriction.rst +++ b/doc/development/api/restriction.rst @@ -179,11 +179,9 @@ In our example, the implementation could look like this:: applied_to = list(restriction.variations.all()) # Only take this restriction into consideration if it either - # is directly applied to this variation OR is applied to all - # variations (e.g. the applied_to list is empty) - if len(applied_to) > 0: - if 'variation' not in v or v['variation'] not in applied_to: - continue + # is directly applied to this variation + if 'variation' not in v or v['variation'] not in applied_to: + continue if restriction.timeframe_from <= now() <= restriction.timeframe_to: # Selling this item is currently possible @@ -236,6 +234,9 @@ You are expected to return a dict containing the following items: ``title`` A title for your formset (normally your plugin name) + ``description`` + An short, explanatory text about your restriction. + Our time restriction example looks like this:: @@ -280,6 +281,9 @@ Our time restriction example looks like this:: 'title': _('Restriction by time'), 'formsetclass': formset, 'prefix': 'timerestriction', + 'description': 'If you use this restriction type, the system will only ' + 'sell variations, which are covered by at least one of the ' + 'timeframes you define below.' } diff --git a/src/tixlcontrol/static/tixlcontrol/js/ui/main.js b/src/tixlcontrol/static/tixlcontrol/js/ui/main.js index 85623f2d6..924392903 100644 --- a/src/tixlcontrol/static/tixlcontrol/js/ui/main.js +++ b/src/tixlcontrol/static/tixlcontrol/js/ui/main.js @@ -4,5 +4,15 @@ $(function () { animateForms: true, reorderMode: 'animate' }); + $(document).on("click", ".variations .variations-select-all", function (e) { + $(this).parent().parent().find("input[type=checkbox]").prop("checked", true); + e.stopPropagation(); + return false; + }); + $(document).on("click", ".variations .variations-select-none", function (e) { + $(this).parent().parent().find("input[type=checkbox]").prop("checked", false); + e.stopPropagation(); + return false; + }); $('.collapse').collapse(); }); diff --git a/src/tixlcontrol/templates/tixlcontrol/item/restrictions.html b/src/tixlcontrol/templates/tixlcontrol/item/restrictions.html index 07b16e09d..e0c0dc6d7 100644 --- a/src/tixlcontrol/templates/tixlcontrol/item/restrictions.html +++ b/src/tixlcontrol/templates/tixlcontrol/item/restrictions.html @@ -3,11 +3,16 @@ {% load bootstrap3 %} {% load formset_tags %} {% block inside %} +
{% blocktrans trimmed %} + In this area, you can choose of a set of "restriction types" to restrict the availability of your item with + certain conditions. + {% endblocktrans %}