[tor-commits] [donate-static/master] Added fields for t-shirt option labels

peterh at torproject.org peterh at torproject.org
Fri Oct 9 00:58:52 UTC 2020


commit 05c7fa51c6dc072c3b682dd7004445b306bbddf2
Author: Peter Haight <peterh at giantrabbit.com>
Date:   Thu Oct 8 17:55:40 2020 -0700

    Added fields for t-shirt option labels
    
    They want to be able to change the t-shirts. A lot of the t-shirt stuff
    is sort of hard-coded, but we can change the lables pretty easily as
    long as it's undrstood that the names don't get changed on the back end.
---
 content/donate/contents.lr |  4 ++++
 models/donate-form.ini     |  8 ++++++++
 parcel/js/giving_form.jsx  |  4 ++--
 parcel/js/settings.js      | 29 -----------------------------
 templates/donate-form.html | 29 +++++++++++++++++++++++++++++
 5 files changed, 43 insertions(+), 31 deletions(-)

diff --git a/content/donate/contents.lr b/content/donate/contents.lr
index 303340df..9a178119 100644
--- a/content/donate/contents.lr
+++ b/content/donate/contents.lr
@@ -89,3 +89,7 @@ header_image: /static/images/donate/donate-header.png
 success_redirect_url: 
 ---
 counter: yes
+---
+tshirt_pack_second_shirt_options_label: Take back the Internet with Tor
+---
+tshirt_perk_options_label: Tor: Strength in Numbers
diff --git a/models/donate-form.ini b/models/donate-form.ini
index fc3b4ce3..cd1027cb 100644
--- a/models/donate-form.ini
+++ b/models/donate-form.ini
@@ -188,6 +188,14 @@ type = string
 label = Sweatshirt Perk Description (Monthly)
 type = string
 
+[fields.tshirt_perk_options_label]
+label = T-Shirt Perk Options Label
+type = string
+
+[fields.tshirt_pack_second_shirt_options_label]
+label = T-Shirt Pack Second Shirt Options Label
+type = string
+
 [fields.html]
 label = Html
 type = string
diff --git a/parcel/js/giving_form.jsx b/parcel/js/giving_form.jsx
index d66fba16..85d80f20 100644
--- a/parcel/js/giving_form.jsx
+++ b/parcel/js/giving_form.jsx
@@ -10,13 +10,13 @@ import {PaymentOptionButton} from './payment_option_button';
 import {PerkSelectionSection} from './perk_selection_section';
 import {GivingInfoForm} from './giving_info_form';
 import {GivingErrorContainer} from './giving_error_container';
-import {paymentMethods, shirtFits, sweatshirtSizes, requiredFields, textFields, displayPerkSelections, stripeTokenFieldMap} from './settings';
+import {paymentMethods, sweatshirtSizes, requiredFields, textFields, displayPerkSelections, stripeTokenFieldMap} from './settings';
 import {AppContext} from './app_context';
 import {LoadingDialogReactPages} from './loading_dialog_react_pages';
 import {FrequencySelector} from './frequency_selector';
 
 export function _GivingForm(props) {
-  const {stripe, frequencyOptions, pricesOnButtons, donateProccessorBaseUrl, perks, initialSelectedPrices, defaultFrequencyForBoth, successRedirectUrl} = props;
+  const {stripe, frequencyOptions, pricesOnButtons, donateProccessorBaseUrl, perks, initialSelectedPrices, defaultFrequencyForBoth, successRedirectUrl, shirtFits} = props;
   const [frequency, setFrequency] = useState((frequencyOptions == 'both')? defaultFrequencyForBoth : frequencyOptions);
   const displayPerkSelection = displayPerkSelections[frequency];
   const [noPerk, setNoPerk] = useState(true);
diff --git a/parcel/js/settings.js b/parcel/js/settings.js
index d0b53257..03620cc2 100644
--- a/parcel/js/settings.js
+++ b/parcel/js/settings.js
@@ -11,35 +11,6 @@ export const paymentMethods = [
   }
 ];
 
-export const shirtFits = {
-  'strength-in-numbers': {
-    'friendly-name': 'Tor: Strength in Numbers',
-    'fits': {
-      'slim': {
-        'friendly-name': 'Slim',
-        'sizes': ['s', 'm', 'l', 'xl', 'xxl']
-      },
-      'classic': {
-        'friendly-name': 'Classic',
-        'sizes': ['s', 'm', 'l', 'xl', 'xxl']
-      },
-    }
-  },
-  'take-back-internet': {
-    'friendly-name': 'Take back the Internet with Tor',
-    'fits': {
-      'slim': {
-        'friendly-name': 'Slim',
-        'sizes': ['s', 'm', 'l', 'xl', 'xxl']
-      },
-      'classic': {
-        'friendly-name': 'Classic',
-        'sizes': ['s', 'm', 'l', 'xl', 'xxl']
-      },
-    }
-  },
-};
-
 export const sweatshirtSizes = ['s', 'm', 'l', 'xl', 'xxl'];
 
 export function requiredFields(paymentMethod, perk) {
diff --git a/templates/donate-form.html b/templates/donate-form.html
index 84b86f02..e263936b 100644
--- a/templates/donate-form.html
+++ b/templates/donate-form.html
@@ -126,6 +126,35 @@
             'requiredFields': ['sweatshirtSize'],
           },
         ],
+        'shirtFits': {
+          'strength-in-numbers': {
+            'friendly-name': `{{ this.tshirt_perk_options_label }}`,
+            'fits': {
+              'slim': {
+                'friendly-name': 'Slim',
+                'sizes': ['s', 'm', 'l', 'xl', 'xxl']
+              },
+              'classic': {
+                'friendly-name': 'Classic',
+                'sizes': ['s', 'm', 'l', 'xl', 'xxl']
+              },
+            }
+          },
+          'take-back-internet': {
+            'friendly-name': `{{ this.tshirt_pack_second_shirt_options_label }}`,
+            'fits': {
+              'slim': {
+                'friendly-name': 'Slim',
+                'sizes': ['s', 'm', 'l', 'xl', 'xxl']
+              },
+              'classic': {
+                'friendly-name': 'Classic',
+                'sizes': ['s', 'm', 'l', 'xl', 'xxl']
+              },
+            }
+          },
+
+        },
         'defaultFrequencyForBoth': `{{ this.default_frequency_for_both }}`,
         'initialSelectedPrices': {
           'single': parseInt(`{{ this.single_three }}`),



More information about the tor-commits mailing list