Skip to content

Commit

Permalink
deduplicated accept-* partials into single checkbox partial
Browse files Browse the repository at this point in the history
  • Loading branch information
tobihagemann committed Feb 24, 2025
1 parent 1cf1590 commit 8e2e792
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 34 deletions.
2 changes: 1 addition & 1 deletion layouts/for-individuals/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ <h2 id="newsletter" class="font-h2 mb-4">{{ i18n "home_newsletter_title" . }}</h
<i :class="{'fa-envelope': !data.inProgress, 'fa-spinner fa-spin': data.inProgress}" class="fas fa-fw" aria-hidden="true"></i> {{ i18n "home_newsletter_subscribe" }}
</button>
</div>
<p class="font-p">{{ partial "accept-newsletter-privacy.html" (dict "context" . "alpineVariable" "data.acceptTerms") }}</p>
<p class="font-p">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "data.acceptTerms" "label" (i18n "accept_newsletter_privacy" | safeHTML)) }}</p>
<p :class="{'hidden': !data.errorMessage}" class="text-sm text-red-600 mt-2" x-text="data.errorMessage"></p>
</form>

Expand Down
2 changes: 1 addition & 1 deletion layouts/for-teams/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ <h2 id="newsletter" class="font-h2 mb-4">{{ i18n "hub_newsletter_title" . }}</h2
<i :class="{'fa-envelope': !data.inProgress, 'fa-spinner fa-spin': data.inProgress}" class="fas fa-fw" aria-hidden="true"></i> {{ i18n "hub_newsletter_subscribe" }}
</button>
</div>
<p class="font-p">{{ partial "accept-newsletter-privacy.html" (dict "context" . "alpineVariable" "data.acceptTerms") }}</p>
<p class="font-p">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "data.acceptTerms" "label" (i18n "accept_newsletter_privacy" | safeHTML)) }}</p>
<p :class="{'hidden': !data.errorMessage}" class="text-sm text-red-600 mt-2" x-text="data.errorMessage"></p>
</form>

Expand Down
4 changes: 2 additions & 2 deletions layouts/hub-billing/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ <h2 class="inline-flex px-4 py-1 rounded-full text-sm font-medium tracking-wide
<p class="font-p mb-4">
{{ i18n "hub_billing_checkout_standard_instruction" . }}
</p>
<p x-show="subscriptionData.customBilling?.managed" class="font-p mb-4">{{ partial "accept-hub-managed-terms-and-privacy.html" (dict "context" . "alpineVariable" "acceptTerms") }}</p>
<p x-show="!subscriptionData.customBilling?.managed" class="font-p mb-4">{{ partial "accept-terms-and-privacy.html" (dict "context" . "alpineVariable" "acceptTerms") }}</p>
<p x-show="subscriptionData.customBilling?.managed" class="font-p mb-4">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "acceptTerms" "label" (i18n "accept_hub_managed_terms_and_privacy" | safeHTML)) }}</p>
<p x-show="!subscriptionData.customBilling?.managed" class="font-p mb-4">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "acceptTerms" "label" (i18n "accept_terms_and_privacy" | safeHTML)) }}</p>
<button :disabled="subscriptionData.inProgress || !acceptTerms" @click.prevent="hubSubscription.checkout('{{ .Site.Language.Lang }}')" type="submit" class="btn btn-primary w-full lg:w-1/2">
<i :class="{'fa-shopping-cart': !subscriptionData.inProgress, 'fa-check': !subscriptionData.inProgress, 'fa-spinner fa-spin': subscriptionData.inProgress}" class="fas fa-fw" aria-hidden="true"></i>
{{ i18n "hub_billing_checkout_standard_submit" . }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/hub-managed/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ <h2 class="font-h2 mb-6">
</li>
</ul>
<p class="font-p text-sm mb-2">
{{ partial "accept-hub-managed-terms-and-privacy.html" (dict "context" . "alpineVariable" "acceptTerms") }}
{{ partial "checkbox.html" (dict "context" . "alpineVariable" "acceptTerms" "label" (i18n "accept_hub_managed_terms_and_privacy" | safeHTML)) }}
</p>
<p class="font-p text-sm mb-2">
{{ partial "accept-hub-newsletter-optional.html" (dict "context" . "alpineVariable" "submitData.acceptNewsletter") }}
{{ partial "checkbox.html" (dict "context" . "alpineVariable" "submitData.acceptNewsletter" "label" (i18n "accept_hub_newsletter_optional")) }}
</p>
<div class="mt-auto">
<p :class="{'hidden': !feedbackData.errorMessage}" class="text-sm text-red-600 mb-2" x-text="feedbackData.errorMessage"></p>
Expand Down
2 changes: 1 addition & 1 deletion layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ <h2 id="newsletter" class="font-h2 mb-4">{{ i18n "home_newsletter_title" . }}</h
<i :class="{'fa-envelope': !data.inProgress, 'fa-spinner fa-spin': data.inProgress}" class="fas fa-fw" aria-hidden="true"></i> {{ i18n "home_newsletter_subscribe" }}
</button>
</div>
<p class="font-p">{{ partial "accept-newsletter-privacy.html" (dict "context" . "alpineVariable" "data.acceptTerms") }}</p>
<p class="font-p">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "data.acceptTerms" "label" (i18n "accept_newsletter_privacy" | safeHTML)) }}</p>
<p :class="{'hidden': !data.errorMessage}" class="text-sm text-red-600 mt-2" x-text="data.errorMessage"></p>
</form>

Expand Down
3 changes: 0 additions & 3 deletions layouts/partials/accept-hub-managed-terms-and-privacy.html

This file was deleted.

3 changes: 0 additions & 3 deletions layouts/partials/accept-hub-newsletter-optional.html

This file was deleted.

3 changes: 0 additions & 3 deletions layouts/partials/accept-newsletter-optional.html

This file was deleted.

3 changes: 0 additions & 3 deletions layouts/partials/accept-newsletter-privacy.html

This file was deleted.

3 changes: 0 additions & 3 deletions layouts/partials/accept-terms-and-privacy.html

This file was deleted.

4 changes: 2 additions & 2 deletions layouts/partials/android-getkey.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ <h3 class="font-h3 text-lg">{{ i18n "android_getkey_title" }}</h3>
</div>
<div class="text-center mt-8">
<p class="font-p mb-4">{{ i18n "android_getkey_instruction" }}</p>
<p class="font-p mb-2">{{ partial "accept-terms-and-privacy.html" (dict "context" . "alpineVariable" "acceptTerms") }}</p>
<p class="font-p mb-4">{{ partial "accept-newsletter-optional.html" (dict "context" . "alpineVariable" "checkoutData.acceptNewsletter") }}</p>
<p class="font-p mb-2">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "acceptTerms" "label" (i18n "accept_terms_and_privacy" | safeHTML)) }}</p>
<p class="font-p mb-4">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "checkoutData.acceptNewsletter" "label" (i18n "accept_newsletter_optional")) }}</p>
<button :disabled="checkoutData.inProgress || !acceptTerms" @click.prevent="androidLicense.checkout('{{ .Site.Language.Lang }}')" type="submit" class="btn btn-primary w-full md:w-64 plausible-event-name=android-getkey-checkout" data-umami-event="android-getkey-checkout">
<i x-show="!checkoutData.inProgress" class="fas fa-shopping-cart fa-fw" aria-hidden="true"></i><i x-show="checkoutData.inProgress" class="fas fa-spinner fa-spin fa-fw" aria-hidden="true"></i> {{ i18n "android_getkey_checkout" }}
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{ $unique_id := printf "id-%s" (delimit (shuffle (seq 1 9)) "") }}
<input class="mr-1 rounded-sm text-primary focus:ring-0 focus:ring-offset-0 focus:border-secondary" type="checkbox" id="{{ $unique_id }}" x-model="{{ .alpineVariable }}" />
<label for="{{ $unique_id }}">{{ i18n "accept_privacy" . | safeHTML }}</label>
<label for="{{ $unique_id }}">{{ .label }}</label>
4 changes: 2 additions & 2 deletions layouts/partials/donate-creditcard.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<div class="text-center mt-8" x-show="!oneTimePaymentStatus.success">
<p class="font-p mb-4">{{ i18n "donate_creditcard_once_instruction" | safeHTML }}</p>

<p class="font-p mb-4">{{ partial "accept-privacy.html" (dict "context" . "alpineVariable" "acceptTerms") }}</p>
<p class="font-p mb-4">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "acceptTerms" "label" (i18n "accept_privacy" | safeHTML)) }}</p>

<div x-ref="captchaWrapper" x-show="!oneTimePaymentStatus.captcha" class="flex justify-center">
<button :disabled="!oneTimePaymentStatus.validCardNum || !acceptTerms" @click="loadRecaptcha($refs.captchaWrapper, (token) => oneTimePaymentStatus.captcha = token)" class="btn btn-primary w-full md:w-64">{{ i18n "donate_creditcard_once_loadcaptcha" }}</button>
Expand All @@ -60,7 +60,7 @@

<div x-show="frequency === 'recurring'" class="text-center">
<p class="font-p mb-4">{{ i18n "donate_creditcard_recurring_instruction" | safeHTML }}</p>
<p class="font-p mb-4">{{ partial "accept-privacy.html" (dict "context" . "alpineVariable" "acceptTerms") }}</p>
<p class="font-p mb-4">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "acceptTerms" "label" (i18n "accept_privacy" | safeHTML)) }}</p>
<button type="submit" class="btn btn-primary w-full md:w-64 plausible-event-name=donate-creditcard-recurring-checkout" data-umami-event="donate-creditcard-recurring-checkout" @click="recurringPayment.checkout(amount, currency, '{{ .Site.Language.Lang }}')" :disabled="!acceptTerms">
<i class="fas fa-external-link" aria-hidden="true"></i> {{ i18n "donate_creditcard_recurring_calltoaction" }}
</button>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/donate-crypto.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<input type="hidden" name="allow_amount" value="1" />
<input type="hidden" name="success_url" value="{{ "/donate/thanks" | absURL }}" />
<input type="hidden" name="allow_extra" value="1" />
<p class="font-p mb-4">{{ partial "accept-privacy.html" (dict "context" . "alpineVariable" "acceptTerms") }}</p>
<p class="font-p mb-4">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "acceptTerms" "label" (i18n "accept_privacy" | safeHTML)) }}</p>
<button type="submit" class="btn btn-primary w-full md:w-64 plausible-event-name=donate-crypto-link" data-umami-event="donate-crypto-link" :disabled="!acceptTerms"><i class="fas fa-external-link" aria-hidden="true"></i> {{ i18n "donate_crypto_calltoaction" }}</button>
</form>
</div>
2 changes: 1 addition & 1 deletion layouts/partials/donate-paypal.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="{{ .Params.paypalHostedButtonId }}" />
<input type="hidden" name="amount" value="15" />
<p class="font-p mb-4">{{ partial "accept-privacy.html" (dict "context" . "alpineVariable" "acceptTerms") }}</p>
<p class="font-p mb-4">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "acceptTerms" "label" (i18n "accept_privacy" | safeHTML)) }}</p>
<button type="submit" class="btn btn-primary w-full md:w-64 plausible-event-name=donate-paypal-link" data-umami-event="donate-paypal-link" :disabled="!acceptTerms"><i class="fas fa-external-link" aria-hidden="true"></i> {{ i18n "donate_paypal_calltoaction" }}</button>
</form>
</div>
2 changes: 1 addition & 1 deletion layouts/partials/supporter-cert-contributor.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
<div class="text-center mt-8">
<p class="font-p mb-4">{{ i18n "supporter_cert_contributor_instruction" . | safeHTML }}</p>
<p class="font-p mb-4">{{ partial "accept-terms-and-privacy.html" (dict "context" . "alpineVariable" "acceptTerms") }}</p>
<p class="font-p mb-4">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "acceptTerms" "label" (i18n "accept_terms_and_privacy" | safeHTML)) }}</p>
<div x-show="!submitData.captcha" x-ref="captchaWrapper" class="flex justify-center">
<button :disabled="!acceptTerms" @click.prevent="loadRecaptcha($refs.captchaWrapper, (token) => submitData.captcha = token)" class="btn btn-primary w-full md:w-64">{{ i18n "supporter_cert_common_loadcaptcha" }}</button>
</div>
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/supporter-cert-funder.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
</div>
<div class="text-center mt-8">
<p class="font-p mb-4">{{ i18n "supporter_cert_funder_instruction" }}</p>
<p class="font-p mb-2">{{ partial "accept-terms-and-privacy.html" (dict "context" . "alpineVariable" "acceptTerms") }}</p>
<p class="font-p mb-4">{{ partial "accept-newsletter-optional.html" (dict "context" . "alpineVariable" "checkoutData.acceptNewsletter") }}</p>
<p class="font-p mb-2">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "acceptTerms" "label" (i18n "accept_terms_and_privacy" | safeHTML)) }}</p>
<p class="font-p mb-4">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "checkoutData.acceptNewsletter" "label" (i18n "accept_newsletter_optional")) }}</p>
<button :disabled="checkoutData.inProgress || !acceptTerms" @click.prevent="desktopLicense.checkout(checkoutData.prices[checkoutData.selectedPriceIndex].productId, '{{ .Site.Language.Lang }}')" type="submit" class="btn btn-primary w-full md:w-64 plausible-event-name=supporter-cert-funder-checkout" data-umami-event="supporter-cert-funder-checkout">
<i :class="{'fa-shopping-cart': !checkoutData.inProgress, 'fa-spinner fa-spin': checkoutData.inProgress}" class="fas fa-fw" aria-hidden="true"></i> {{ i18n "supporter_cert_funder_checkout" }}
</button>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/supporter-cert-influencer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
<div class="text-center mt-8">
<p class="font-p mb-4">{{ i18n "supporter_cert_influencer_instruction" }}</p>
<p class="font-p mb-4">{{ partial "accept-terms-and-privacy.html" (dict "context" . "alpineVariable" "acceptTerms") }}</p>
<p class="font-p mb-4">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "acceptTerms" "label" (i18n "accept_terms_and_privacy" | safeHTML)) }}</p>
<div x-show="!submitData.captcha" x-ref="captchaWrapper" class="flex justify-center">
<button :disabled="!acceptTerms" @click.prevent="loadRecaptcha($refs.captchaWrapper, (token) => submitData.captcha = token)" class="btn btn-primary w-full md:w-64">{{ i18n "supporter_cert_common_loadcaptcha" }}</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/supporter-cert-other.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
<div class="text-center mt-8">
<p class="font-p mb-4">{{ i18n "supporter_cert_other_instruction" }}</p>
<p class="font-p mb-4">{{ partial "accept-terms-and-privacy.html" (dict "context" . "alpineVariable" "acceptTerms") }}</p>
<p class="font-p mb-4">{{ partial "checkbox.html" (dict "context" . "alpineVariable" "acceptTerms" "label" (i18n "accept_terms_and_privacy" | safeHTML)) }}</p>
<div x-show="!submitData.captcha" x-ref="captchaWrapper" class="flex justify-center">
<button :disabled="!acceptTerms" @click.prevent="loadRecaptcha($refs.captchaWrapper, (token) => submitData.captcha = token)" class="btn btn-primary w-full md:w-64">{{ i18n "supporter_cert_common_loadcaptcha" }}</button>
</div>
Expand Down

0 comments on commit 8e2e792

Please sign in to comment.