Skip to content

Commit 3bd7337

Browse files
committed
Add basket shift info to Liquid::BasketDrop for newsletters
When members have shifted baskets to a future delivery, they need a clear reminder about picking up multiple baskets. This adds `shifted?` and `shifts` methods to BasketDrop, allowing newsletter templates to display a highlighted reminder with the shifted delivery dates. Updated the default next_delivery newsletter templates and documented the feature in the absences handbook section.
1 parent 829f363 commit 3bd7337

File tree

13 files changed

+259
-0
lines changed

13 files changed

+259
-0
lines changed

app/models/liquid/basket_drop.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ def quantity
2929
@basket.quantity
3030
end
3131

32+
def shifted
33+
return false unless Current.org.basket_shift_enabled?
34+
35+
@basket.shifts_as_target.any?
36+
end
37+
38+
def shifts
39+
return [] unless Current.org.basket_shift_enabled?
40+
41+
@basket.shifts_as_target.includes(source_basket: :delivery, target_basket: :delivery).map { |shift|
42+
Liquid::BasketShiftDrop.new(shift)
43+
}
44+
end
45+
3246
def contents
3347
@basket.delivery.basket_contents.includes(:product).select { |bc|
3448
bc.depot_ids.include?(@basket.depot_id)

app/views/handbook/absences.de.md.erb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ Wenn die Abwesenheit storniert wird, wird der Tascheninhalt automatisch zu seine
2525

2626
> Taschenverschiebungen sind nur möglich, wenn Abwesenheiten in Rechnung gestellt werden.
2727

28+
### Newsletter-Vorlage
29+
30+
Wenn eine Tasche Verschiebungen erhalten hat, können Sie eine Erinnerung in Ihren [Newsletter-Vorlagen](/newsletter_templates) anzeigen, indem Sie die Variablen `basket.shifted` und `basket.shifts` verwenden:
31+
32+
~~~ liquid
33+
{% if basket.shifted %}
34+
{% highlight %}
35+
<p><strong>📣 Wichtige Erinnerung!</strong></p>
36+
<p>Sie haben diese Woche <strong>{{ basket.quantity }} Taschen</strong> abzuholen:</p>
37+
<ul>
38+
<li>Ihre reguläre Tasche</li>
39+
{% for shift in basket.shifts %}
40+
<li>Tasche verschoben vom {{ shift.old_delivery_date }}</li>
41+
{% endfor %}
42+
</ul>
43+
{% endhighlight %}
44+
{% endif %}
45+
~~~
46+
2847
## Inbegriffene Abwesenheiten {#absence-included}
2948

3049
Es ist möglich, eine Anzahl von Abwesenheiten zu konfigurieren, die im Abonnement enthalten sind. Diese Abwesenheiten werden dann automatisch abgezogen und nicht in Rechnung gestellt, sobald das Abonnement beginnt. Das System wird vorübergehend die letzten Lieferungen des Abonnements als abwesend markieren, während darauf gewartet wird, dass das Mitglied diese Abwesenheiten auf bestimmte Daten festlegt. Zusätzliche Abwesenheiten werden gemäß dem in [Ihren Einstellungen](/settings#absence) gewählten Modus in Rechnung gestellt oder nicht.

app/views/handbook/absences.en.md.erb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ If the absence is cancelled, the basket content will be automatically restored t
2525

2626
> Basket shifting is only possible if absences are billed.
2727

28+
### Newsletter Template
29+
30+
When a basket has received shifts, you can display a reminder in your [newsletter templates](/newsletter_templates) using the `basket.shifted` and `basket.shifts` variables:
31+
32+
~~~ liquid
33+
{% if basket.shifted %}
34+
{% highlight %}
35+
<p><strong>📣 Important reminder!</strong></p>
36+
<p>You have <strong>{{ basket.quantity }} baskets</strong> to pick up this week:</p>
37+
<ul>
38+
<li>Your regular basket</li>
39+
{% for shift in basket.shifts %}
40+
<li>Basket shifted from {{ shift.old_delivery_date }}</li>
41+
{% endfor %}
42+
</ul>
43+
{% endhighlight %}
44+
{% endif %}
45+
~~~
46+
2847
## Included Absences {#absence-included}
2948

3049
It is possible to configure a number of absences included in the membership. These absences are then automatically deducted and not billed from the start of the membership. The system will provisionally mark the last deliveries of the membership as absent, while waiting for the member to fix these absences on specific dates. Additional absences will be billed or not according to the mode chosen in [your settings](/settings#absence).

app/views/handbook/absences.fr.md.erb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ Si l'absence est annulée, le contenu du panier sera automatiquement restitué
2525

2626
> Le déplacement de paniers est possible uniquement si les absences sont facturées.
2727

28+
### Template de newsletter
29+
30+
Lorsqu'un panier a reçu des déplacements, vous pouvez afficher un rappel dans [vos templates de newsletter](/newsletter_templates) en utilisant les variables `basket.shifted` et `basket.shifts`:
31+
32+
~~~ liquid
33+
{% if basket.shifted %}
34+
{% highlight %}
35+
<p><strong>📣 Rappel important!</strong></p>
36+
<p>Vous avez <strong>{{ basket.quantity }} paniers</strong> à récupérer cette semaine:</p>
37+
<ul>
38+
<li>Votre panier habituel</li>
39+
{% for shift in basket.shifts %}
40+
<li>Panier reporté du {{ shift.old_delivery_date }}</li>
41+
{% endfor %}
42+
</ul>
43+
{% endhighlight %}
44+
{% endif %}
45+
~~~
46+
2847
## Absences incluses {#absence-included}
2948

3049
Il est possible de configurer un nombre d'absences incluses dans l'abonnement. Ces absences sont alors automatiquement déduites et non-facturées dès le début de l'abonnement. Le système marquera provisoirement les dernières livraisons de l'abonnement comme absentes, en attendant que le membre fixe ces absences sur des dates précises. Les absences supplémentaires seront facturées ou non selon le mode choisi dans [vos paramètres](/settings#absence).

app/views/handbook/absences.it.md.erb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ Se l'assenza viene annullata, il contenuto del cestino sarà automaticamente res
2525

2626
> Lo spostamento di cestini è possibile solo se le assenze vengono fatturate.
2727

28+
### Template di newsletter
29+
30+
Quando un cestino ha ricevuto spostamenti, potete visualizzare un promemoria nei vostri [template di newsletter](/newsletter_templates) utilizzando le variabili `basket.shifted` e `basket.shifts`:
31+
32+
~~~ liquid
33+
{% if basket.shifted %}
34+
{% highlight %}
35+
<p><strong>📣 Promemoria importante!</strong></p>
36+
<p>Avete <strong>{{ basket.quantity }} cestini</strong> da ritirare questa settimana:</p>
37+
<ul>
38+
<li>Il vostro cestino abituale</li>
39+
{% for shift in basket.shifts %}
40+
<li>Cestino spostato dal {{ shift.old_delivery_date }}</li>
41+
{% endfor %}
42+
</ul>
43+
{% endhighlight %}
44+
{% endif %}
45+
~~~
46+
2847
## Assenze incluse {#absence-included}
2948

3049
È possibile configurare un numero di assenze incluse nell'abbonamento. Queste assenze vengono quindi automaticamente detratte e non fatturate fin dall'inizio dell'abbonamento. Il sistema segnerà provvisoriamente le ultime consegne dell'abbonamento come assenti, in attesa che il socio fissi queste assenze su date specifiche. Le assenze aggiuntive saranno fatturate o meno secondo la modalità scelta nelle [vostre impostazioni](/settings#absence).

app/views/handbook/absences.nl.md.erb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ Als de afwezigheid wordt geannuleerd, wordt de pakketinhoud automatisch hersteld
2525

2626
> Pakketverschuiving is alleen mogelijk als afwezigheid wordt gefactureerd.
2727

28+
### Nieuwsbrief Template
29+
30+
Wanneer een pakket verschuivingen heeft ontvangen, kunt u een herinnering weergeven in uw [nieuwsbrief templates](/newsletter_templates) met behulp van de variabelen `basket.shifted` en `basket.shifts`:
31+
32+
~~~ liquid
33+
{% if basket.shifted %}
34+
{% highlight %}
35+
<p><strong>📣 Belangrijke herinnering!</strong></p>
36+
<p>U heeft <strong>{{ basket.quantity }} pakketten</strong> op te halen deze week:</p>
37+
<ul>
38+
<li>Uw gewone pakket</li>
39+
{% for shift in basket.shifts %}
40+
<li>Pakket verschoven van {{ shift.old_delivery_date }}</li>
41+
{% endfor %}
42+
</ul>
43+
{% endhighlight %}
44+
{% endif %}
45+
~~~
46+
2847
## Inbegrepen afwezigheid {#absence-included}
2948

3049
Het is mogelijk om een aantal afwezigheid in te configureren die in het lidmaatschap zijn inbegrepen. Deze afwezigheid wordt dan automatisch afgetrokken en niet gefactureerd vanaf het begin van het lidmaatschap. Het systeem zal voorlopig de laatste leveringen van het lidmaatschap als afwezig markeren, in afwachting dat het lid deze afwezigheid op specifieke data vastlegt. Aanvullende afwezigheid wordt wel of niet gefactureerd volgens de gekozen modus in [uw instellingen](/settings#absence).

app/views/newsletter_templates/next_delivery.de.liquid

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
{% if basket.shifted %}
2+
{% highlight %}
3+
<p><strong>📣 Wichtige Erinnerung!</strong></p>
4+
<p>Sie haben diese Woche <strong>{{ basket.quantity }} Taschen</strong> abzuholen:</p>
5+
<ul>
6+
<li>Ihre reguläre Tasche</li>
7+
{% for shift in basket.shifts %}
8+
<li>Tasche verschoben vom {{ shift.old_delivery_date }}</li>
9+
{% endfor %}
10+
</ul>
11+
{% endhighlight %}
12+
{% endif %}
13+
114
{% content id: "intro" %}{% endcontent %}
215

316
{% if basket.contents.size > 0 and basket.quantity > 0 %}

app/views/newsletter_templates/next_delivery.en.liquid

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
{% if basket.shifted %}
2+
{% highlight %}
3+
<p><strong>📣 Important reminder!</strong></p>
4+
<p>You have <strong>{{ basket.quantity }} baskets</strong> to pick up this week:</p>
5+
<ul>
6+
<li>Your regular basket</li>
7+
{% for shift in basket.shifts %}
8+
<li>Basket shifted from {{ shift.old_delivery_date }}</li>
9+
{% endfor %}
10+
</ul>
11+
{% endhighlight %}
12+
{% endif %}
13+
114
{% content id: "intro" %}{% endcontent %}
215

316
{% if basket.contents.size > 0 and basket.quantity > 0 %}

app/views/newsletter_templates/next_delivery.fr.liquid

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
{% if basket.shifted %}
2+
{% highlight %}
3+
<p><strong>📣 Rappel important!</strong></p>
4+
<p>Vous avez <strong>{{ basket.quantity }} paniers</strong> à récupérer cette semaine:</p>
5+
<ul>
6+
<li>Votre panier habituel</li>
7+
{% for shift in basket.shifts %}
8+
<li>Panier reporté du {{ shift.old_delivery_date }}</li>
9+
{% endfor %}
10+
</ul>
11+
{% endhighlight %}
12+
{% endif %}
13+
114
{% content id: "intro" %}{% endcontent %}
215

316
{% if basket.contents.size > 0 and basket.quantity > 0 %}

app/views/newsletter_templates/next_delivery.it.liquid

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
{% if basket.shifted %}
2+
{% highlight %}
3+
<p><strong>📣 Promemoria importante!</strong></p>
4+
<p>Avete <strong>{{ basket.quantity }} cestini</strong> da ritirare questa settimana:</p>
5+
<ul>
6+
<li>Il vostro cestino abituale</li>
7+
{% for shift in basket.shifts %}
8+
<li>Cestino spostato dal {{ shift.old_delivery_date }}</li>
9+
{% endfor %}
10+
</ul>
11+
{% endhighlight %}
12+
{% endif %}
13+
114
{% content id: "intro" %}{% endcontent %}
215

316
{% if basket.contents.size > 0 and basket.quantity > 0 %}

0 commit comments

Comments
 (0)