From a9928e7bcf588c366b7b6bde7cd380ff1538312a Mon Sep 17 00:00:00 2001
From: nesdis <nesdis@gmail.com>
Date: Tue, 25 Aug 2020 17:35:24 +0200
Subject: [PATCH] Refactored parts of sponsors page.

---
 .gitignore                                    |  2 -
 docs/Gemfile                                  | 10 +--
 docs/_includes/{sponsor_row => advert_row}    |  2 +-
 docs/_includes/empty_banner                   |  1 +
 docs/_includes/tire_column                    | 25 ++++++
 docs/_includes/tire_row                       | 21 -----
 .../{head => vendors}/google-tag-manager.html |  0
 docs/_includes/{head => vendors}/hotjar.html  |  0
 docs/_includes/vendors/stripe.html            | 37 +++++++++
 docs/_sass/_custom-components.scss            |  3 +
 docs/_sass/sponsor-tire.scss                  |  1 -
 docs/_sass/sponsor-tire/_components.scss      | 16 ++++
 .../sponsor-tire/{_tire.scss => _item.scss}   | 30 +++----
 docs/_sass/sponsor-tire/_sponsor-tire.scss    |  2 +
 docs/_sass/sponsor-tire/_variables.scss       |  6 ++
 docs/_sass/style.scss                         |  2 +
 docs/assets/css/custom.scss                   |  2 +-
 docs/docs/Discuss.md                          |  6 +-
 docs/docs/home.md                             |  4 +-
 docs/docs/sponsor.md                          | 78 ++++---------------
 docs/docs/support.md                          |  2 +-
 21 files changed, 137 insertions(+), 113 deletions(-)
 rename docs/_includes/{sponsor_row => advert_row} (96%)
 create mode 100644 docs/_includes/empty_banner
 create mode 100644 docs/_includes/tire_column
 delete mode 100644 docs/_includes/tire_row
 rename docs/_includes/{head => vendors}/google-tag-manager.html (100%)
 rename docs/_includes/{head => vendors}/hotjar.html (100%)
 create mode 100644 docs/_includes/vendors/stripe.html
 create mode 100644 docs/_sass/_custom-components.scss
 delete mode 100644 docs/_sass/sponsor-tire.scss
 create mode 100644 docs/_sass/sponsor-tire/_components.scss
 rename docs/_sass/sponsor-tire/{_tire.scss => _item.scss} (66%)
 create mode 100644 docs/_sass/sponsor-tire/_sponsor-tire.scss
 create mode 100644 docs/_sass/sponsor-tire/_variables.scss
 create mode 100644 docs/_sass/style.scss

diff --git a/.gitignore b/.gitignore
index 41d59b1..2dee331 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,8 +10,6 @@ venv_py38_dj30/
 
 
 docs/.sass-cache/*
-docs/_apidocs/_build/
-docs/_apidocs/doctrees/
 docs/_layouts/*
 docs/_site/*
 docs/assets/js/*
diff --git a/docs/Gemfile b/docs/Gemfile
index a16e2ab..a07c9c5 100644
--- a/docs/Gemfile
+++ b/docs/Gemfile
@@ -2,10 +2,10 @@ source 'https://rubygems.org'
 
 # gem stripe
 # run locally
-# gem 'github-pages', group: :jekyll_plugins
-# gem "jekyll-include-cache"
+ gem 'github-pages', group: :jekyll_plugins
+ gem "jekyll-include-cache"
 
 # run server
-gem "minimal-mistakes-jekyll"
-gem "jekyll", "~> 3.5"
-gem 'wdm'
+# gem "minimal-mistakes-jekyll"
+# gem "jekyll", "~> 3.5"
+# gem 'wdm'
diff --git a/docs/_includes/sponsor_row b/docs/_includes/advert_row
similarity index 96%
rename from docs/_includes/sponsor_row
rename to docs/_includes/advert_row
index 728cecf..ded5193 100644
--- a/docs/_includes/sponsor_row
+++ b/docs/_includes/advert_row
@@ -1,7 +1,7 @@
 
 <div class="feature__wrapper">
 
-  {% for f in page.sponsor_row %}
+  {% for f in page.advert_row %}
     <div class="feature__item">
       <div class="archive__item">
         {% if f.image_path %}
diff --git a/docs/_includes/empty_banner b/docs/_includes/empty_banner
new file mode 100644
index 0000000..6598064
--- /dev/null
+++ b/docs/_includes/empty_banner
@@ -0,0 +1 @@
+<div class="empty-banner"></div>
\ No newline at end of file
diff --git a/docs/_includes/tire_column b/docs/_includes/tire_column
new file mode 100644
index 0000000..0913241
--- /dev/null
+++ b/docs/_includes/tire_column
@@ -0,0 +1,25 @@
+
+  <div class="tire__container">
+    {% for s in page.tires %}
+        <div class="tire_item__box">
+          <div class="tire_item__title">{{ s.title }}</div>
+          <div class="tire_item__price">${{ s.price }}</div>
+          <div class="tire_item__period">PER MONTH</div>
+          <button id="{{ s.btn_id }}" class="btn btn--success btn--large">Join</button>
+          <div class="tire_item__benefit">
+            <ul>
+              {% for b in s.benefits %}
+                <li>{{ b | markdownify | remove: "<p>" | remove: "</p>" }}</li>
+              {% endfor %}
+            </ul>
+          </div>
+        </div>
+    {% endfor %}
+  </div>
+  <div class="tire__disclaimer">
+    <ul class="notice--warning">
+      {% for d in page.disclaimer %}
+      <li><em>{{ d }}</em></li>
+      {% endfor %}
+    </ul>
+  </div>
diff --git a/docs/_includes/tire_row b/docs/_includes/tire_row
deleted file mode 100644
index e9348d4..0000000
--- a/docs/_includes/tire_row
+++ /dev/null
@@ -1,21 +0,0 @@
-
-<div class="tire__banner"></div>
-
-<div class="tire__wrapper">
-  {% for s in page.sponsor_row %}
-      <div class="tire_item__box">
-        <div class="tire_item__title">{{ s.title }}</div>
-        <div class="tire_item__price">${{ s.price }}</div>
-        <div class="tire_item__period">PER MONTH</div>
-        <button id="{{ s.btn_id }}" class="btn btn--success btn--large">Pay</button>
-        <div class="tire_item__benefit">
-          <ul>
-            {% for b in s.benefits %}
-              <li>{{ b | markdownify | remove: "<p>" | remove: "</p>" }}</li>
-            {% endfor %}
-          </ul>
-        </div>
-      </div>
-  {% endfor %}
-
-</div>
diff --git a/docs/_includes/head/google-tag-manager.html b/docs/_includes/vendors/google-tag-manager.html
similarity index 100%
rename from docs/_includes/head/google-tag-manager.html
rename to docs/_includes/vendors/google-tag-manager.html
diff --git a/docs/_includes/head/hotjar.html b/docs/_includes/vendors/hotjar.html
similarity index 100%
rename from docs/_includes/head/hotjar.html
rename to docs/_includes/vendors/hotjar.html
diff --git a/docs/_includes/vendors/stripe.html b/docs/_includes/vendors/stripe.html
new file mode 100644
index 0000000..8637d8b
--- /dev/null
+++ b/docs/_includes/vendors/stripe.html
@@ -0,0 +1,37 @@
+<script>
+  // Replace with your own publishable key: https://dashboard.stripe.com/test/apikeys
+  var PUBLISHABLE_KEY = "pk_live_eEfW8XjO4oZUPRFaYASLCWqn";
+  // Replace with the domain you want your users to be redirected back to after payment
+  var DOMAIN = "https://nesdis.github.io";
+
+  var stripe = Stripe(PUBLISHABLE_KEY);
+
+  // Handle any errors from Checkout
+  var handleResult = function (result) {
+    if (result.error) {
+      var displayError = document.getElementById("error-message");
+      displayError.textContent = result.error.message;
+    }
+  };
+
+  var redirectToCheckout = function (priceId) {
+    // Make the call to Stripe.js to redirect to the checkout page
+    // with the current quantity
+    stripe
+      .redirectToCheckout({
+        lineItems: [{ price: priceId, quantity: 1 }],
+        successUrl:
+          DOMAIN + "/djongo?session_id={CHECKOUT_SESSION_ID}",
+        cancelUrl: DOMAIN + "/sponsor",
+        mode: 'subscription',
+      })
+      .then(handleResult);
+  };
+{% for t in page.tires %}
+  document
+  .getElementById("{{ t.btn_id }}")
+  .addEventListener("click", function (evt) {
+    redirectToCheckout("{{ t.price_id }}");
+  });
+{% endfor %}
+</script>
\ No newline at end of file
diff --git a/docs/_sass/_custom-components.scss b/docs/_sass/_custom-components.scss
new file mode 100644
index 0000000..6b2a55e
--- /dev/null
+++ b/docs/_sass/_custom-components.scss
@@ -0,0 +1,3 @@
+.empty-banner {
+  height: 100px;
+}
diff --git a/docs/_sass/sponsor-tire.scss b/docs/_sass/sponsor-tire.scss
deleted file mode 100644
index 7f89558..0000000
--- a/docs/_sass/sponsor-tire.scss
+++ /dev/null
@@ -1 +0,0 @@
-@import "sponsor-tire/tire";
\ No newline at end of file
diff --git a/docs/_sass/sponsor-tire/_components.scss b/docs/_sass/sponsor-tire/_components.scss
new file mode 100644
index 0000000..95e3873
--- /dev/null
+++ b/docs/_sass/sponsor-tire/_components.scss
@@ -0,0 +1,16 @@
+@import "variables";
+
+.tire__container {
+  display: flex;
+  justify-content: left;
+  flex-direction: row;
+  flex-wrap: wrap;
+}
+
+.tire__disclaimer {
+  margin-left: $box-side-margin;
+  display: inline-block;
+  .notice--warning li {
+    margin-left: $box-side-margin;
+  }
+}
diff --git a/docs/_sass/sponsor-tire/_tire.scss b/docs/_sass/sponsor-tire/_item.scss
similarity index 66%
rename from docs/_sass/sponsor-tire/_tire.scss
rename to docs/_sass/sponsor-tire/_item.scss
index ff321be..03b1618 100644
--- a/docs/_sass/sponsor-tire/_tire.scss
+++ b/docs/_sass/sponsor-tire/_item.scss
@@ -1,13 +1,4 @@
-.tire__wrapper {
-  display: flex;
-  flex-direction: row;
-  flex-wrap: wrap;
-  justify-content: center;
-}
-
-.tire__banner {
-  height: 100px;
-}
+@import "variables";
 
 %box-border {
   border-style: solid;
@@ -18,18 +9,22 @@
 
 %box-spacing {
   margin-bottom: 2em;
-  margin-left: 1em;
-  margin-right: 1em;
+  margin-left: $box-side-margin;
+  margin-right: $box-side-margin;
 
   padding: 1em;
 }
 
+%box-size {
+  min-width: $min-box-width;
+  width: calc(33% - #{$box-side-margin}*2);
+}
+
 .tire_item__box {
   @extend %box-border;
   @extend %box-spacing;
+  @extend %box-size;
 
-  width: 29%;
-  min-width: 16em;
   text-align: center;
 
   ul {
@@ -53,6 +48,13 @@
   margin-bottom: 1em;
 }
 
+
+@media (max-width: $min-box-width-px*3 + $box-side-margin-px*6 + 2*$base-font-size-px) {
+  %box-size {
+    width: calc(50% - #{$box-side-margin}*2);
+  }
+}
+
 @media (max-width: 650px) {
   .tire__wrapper {
     display: block;
diff --git a/docs/_sass/sponsor-tire/_sponsor-tire.scss b/docs/_sass/sponsor-tire/_sponsor-tire.scss
new file mode 100644
index 0000000..f8ca156
--- /dev/null
+++ b/docs/_sass/sponsor-tire/_sponsor-tire.scss
@@ -0,0 +1,2 @@
+@import "components";
+@import "item";
\ No newline at end of file
diff --git a/docs/_sass/sponsor-tire/_variables.scss b/docs/_sass/sponsor-tire/_variables.scss
new file mode 100644
index 0000000..0147fb7
--- /dev/null
+++ b/docs/_sass/sponsor-tire/_variables.scss
@@ -0,0 +1,6 @@
+$min-box-width: 16em;
+$box-side-margin: 1em;
+
+$base-font-size-px: 20px;
+$min-box-width-px: 16 * $base-font-size-px;
+$box-side-margin-px: 1 * $base-font-size-px;
diff --git a/docs/_sass/style.scss b/docs/_sass/style.scss
new file mode 100644
index 0000000..f77c13c
--- /dev/null
+++ b/docs/_sass/style.scss
@@ -0,0 +1,2 @@
+@import "sponsor-tire/sponsor-tire";
+@import "custom-components";
\ No newline at end of file
diff --git a/docs/assets/css/custom.scss b/docs/assets/css/custom.scss
index cd6993c..81f728e 100644
--- a/docs/assets/css/custom.scss
+++ b/docs/assets/css/custom.scss
@@ -2,4 +2,4 @@
 # this ensures Jekyll reads the file to be transformed into CSS later
 ---
 
-@import "sponsor-tire";
\ No newline at end of file
+@import "style";
\ No newline at end of file
diff --git a/docs/docs/Discuss.md b/docs/docs/Discuss.md
index 8d91a5e..7ff9fa1 100644
--- a/docs/docs/Discuss.md
+++ b/docs/docs/Discuss.md
@@ -4,6 +4,9 @@ permalink: /discuss/
 toc: false
 layout: splash
 ---
+
+{% include empty_banner %}
+
 Djongo forum is where you can watch for:
 
 * New release announcements.
@@ -15,9 +18,10 @@ Djongo forum is where you can watch for:
   src="javascript:void(0)"
   scrolling="no"
   frameborder="0"
-  width="900"
+  width="100%"
   height="700">
 </iframe>
+
 <script type="text/javascript">
   document.getElementById('forum_embed').src =
      'https://groups.google.com/forum/embed/?place=forum/djongo'
diff --git a/docs/docs/home.md b/docs/docs/home.md
index 0e90a1d..153c537 100644
--- a/docs/docs/home.md
+++ b/docs/docs/home.md
@@ -58,7 +58,7 @@ addendum_row1:
     btn_label: "Learn More"
     btn_class: "btn--primary"
     
-sponsor_row:
+advert_row:
   - image_path: /assets/images/e2e.png
     alt: "Admin MongoDB"
     image_link: http://www.e2eprojects.com/
@@ -74,7 +74,7 @@ sponsor_row:
 
 {% include feature_row id="punchline" type="center" %}
 
-{% include sponsor_row %}
+{% include advert_row %}
 
 {% include feature_row id="feature_row1" %}
 
diff --git a/docs/docs/sponsor.md b/docs/docs/sponsor.md
index 4b07140..7f754ab 100644
--- a/docs/docs/sponsor.md
+++ b/docs/docs/sponsor.md
@@ -6,10 +6,11 @@ layout: splash
 excerpt: "If you are a company that uses Djongo in your products, consider enrolling in a subscription plan. You get long term support and advertisement space"
 description: "If you are a company that uses Djongo in your products, consider enrolling in a subscription plan. You get long term support and advertisement space."
 
-sponsor_row:
+tires:
   - title: A Sweet Tip
     price: 3
     btn_id: price_3
+    price_id: price_1HIKfSLbyDBUaJVjuc3i3YEW
     benefits:
       - You use Djongo and you LOVE IT.
       - You want to tip the project! Thanks!
@@ -17,22 +18,24 @@ sponsor_row:
   - title: Q&A
     price: 4
     btn_id: price_4
+    price_id: price_1HIKi6LbyDBUaJVj7FvgB3gx
     benefits:
       - Take a look at your **one question**.
       - You support the long term sustainability of the project.
-      - Your token of appreciation will help me continue maintain the repository.
 
   - title: Generous Supporter
     price: 7
     btn_id: price_7
+    price_id: price_1HIKkyLbyDBUaJVj8XbaHS8O
     benefits:
       - Your questions are answered within 24 hours on Discord priority-support.
-      - You support the long term sustainability of the project.
       - Your name is mentioned in the source code.
+      - You support the long term sustainability of the project.
   
   - title: Evangelist Supporter
     price: 15
     btn_id: price_15
+    price_id: price_1HIKphLbyDBUaJVjQylkb7QE
     benefits:
       - You **get access to the djongoNxt** repository.
       - Your questions are **immediately** taken up for consideration on Discord priority-support.
@@ -41,75 +44,22 @@ sponsor_row:
   - title: Advertise on Djongo
     price: 50
     btn_id: price_50
+    price_id: price_1HHwbOLbyDBUaJVjYnDESotB
     benefits:
       - Your name or company logo will be displayed on the home page.
       - Your feature requests and support queries to be given top priority.
-      
----
 
-{% include tire_row %}
+disclaimer:
+  - Subscriptions are not binding and can be canceled any time.
+  - Upon successful checkout you are provided with an option to submit additional details required to deliver your benefits.
 
- * *Subscriptions are not binding and can be canceled any time.*
- * *Upon successful checkout you are provided with an option to submit additional details required to deliver your benefits.*
+---
 
-<script>
-  // Replace with your own publishable key: https://dashboard.stripe.com/test/apikeys
-  var PUBLISHABLE_KEY = "pk_live_eEfW8XjO4oZUPRFaYASLCWqn";
-  // Replace with the domain you want your users to be redirected back to after payment
-  var DOMAIN = "https://nesdis.github.io";
+{% include empty_banner %}
 
-  var stripe = Stripe(PUBLISHABLE_KEY);
+{% include tire_column %}
 
-  // Handle any errors from Checkout
-  var handleResult = function (result) {
-    if (result.error) {
-      var displayError = document.getElementById("error-message");
-      displayError.textContent = result.error.message;
-    }
-  };
 
-  var redirectToCheckout = function (priceId) {
-    // Make the call to Stripe.js to redirect to the checkout page
-    // with the current quantity
-    stripe
-      .redirectToCheckout({
-        lineItems: [{ price: priceId, quantity: 1 }],
-        successUrl:
-          DOMAIN + "/djongo?session_id={CHECKOUT_SESSION_ID}",
-        cancelUrl: DOMAIN + "/sponsor",
-        mode: 'subscription',
-      })
-      .then(handleResult);
-  };
 
-  document
-    .getElementById("price_3")
-    .addEventListener("click", function (evt) {
-      redirectToCheckout("price_1HIKfSLbyDBUaJVjuc3i3YEW");
-    });
 
-  document
-    .getElementById("price_4")
-    .addEventListener("click", function (evt) {
-      redirectToCheckout("price_1HIKi6LbyDBUaJVj7FvgB3gx");
-    });
-  
-  document
-    .getElementById("price_7")
-    .addEventListener("click", function (evt) {
-      redirectToCheckout("price_1HIKkyLbyDBUaJVj8XbaHS8O");
-    });
-  
-  document
-    .getElementById("price_15")
-    .addEventListener("click", function (evt) {
-      redirectToCheckout("price_1HIKphLbyDBUaJVjQylkb7QE");
-    });
-  
-  document
-    .getElementById("price_50")
-    .addEventListener("click", function (evt) {
-      redirectToCheckout("price_1HHwbOLbyDBUaJVjYnDESotB");
-    });
-    
-</script>
+{% include vendors/stripe.html %}
diff --git a/docs/docs/support.md b/docs/docs/support.md
index fc498de..40e57fe 100644
--- a/docs/docs/support.md
+++ b/docs/docs/support.md
@@ -1,6 +1,6 @@
 ---
 title: Support
-permalink: /support/
+permalink: 
 layout: splash
 
 row1:
-- 
GitLab