From 3dcc8d4fe56b671df0d70a9199a49b670bad0a80 Mon Sep 17 00:00:00 2001
From: MattIPv4 <me@mattcowley.co.uk>
Date: Thu, 31 Dec 2020 13:22:14 +0000
Subject: [PATCH] Add external learn more link

---
 .../en/templates/domain_sections/onion.js     |  1 +
 .../pt-br/templates/domain_sections/onion.js  |  1 +
 .../zh-cn/templates/domain_sections/onion.js  |  1 +
 .../zh-tw/templates/domain_sections/onion.js  |  1 +
 src/nginxconfig/scss/_fields.scss             |  4 +++
 .../templates/domain_sections/onion.vue       | 31 ++++++++++++++-----
 6 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/src/nginxconfig/i18n/en/templates/domain_sections/onion.js b/src/nginxconfig/i18n/en/templates/domain_sections/onion.js
index 5c662d0..6ada5a7 100644
--- a/src/nginxconfig/i18n/en/templates/domain_sections/onion.js
+++ b/src/nginxconfig/i18n/en/templates/domain_sections/onion.js
@@ -31,5 +31,6 @@ export default {
     onionLocation: `${onion} location`,
     provideAnOnionLocationToSetOnionLocationHeader: 'Provide an onion location address to set the Onion-Location header for your site.',
     letsVisitorsKnownOnionServicesIsAvailable: 'This lets visitors know that an onion services version of your site is available for Tor browsers.',
+    learnMoreAboutOnionServices: 'Learn more about Onion services',
     onionLocationExpectedToEndWithOnion: 'Onion location addresses normally end with `.onion`.',
 };
diff --git a/src/nginxconfig/i18n/pt-br/templates/domain_sections/onion.js b/src/nginxconfig/i18n/pt-br/templates/domain_sections/onion.js
index cf68436..1d1b509 100644
--- a/src/nginxconfig/i18n/pt-br/templates/domain_sections/onion.js
+++ b/src/nginxconfig/i18n/pt-br/templates/domain_sections/onion.js
@@ -31,5 +31,6 @@ export default {
     onionLocation: `${onion} location`, // TODO: translate
     provideAnOnionLocationToSetOnionLocationHeader: 'Provide an onion location address to set the Onion-Location header for your site.', // TODO: translate
     letsVisitorsKnownOnionServicesIsAvailable: 'This lets visitors know that an onion services version of your site is available for Tor browsers.', // TODO: translate
+    learnMoreAboutOnionServices: 'Learn more about Onion services', // TODO: translate
     onionLocationExpectedToEndWithOnion: 'Onion location addresses normally end with `.onion`.', // TODO: translate
 };
diff --git a/src/nginxconfig/i18n/zh-cn/templates/domain_sections/onion.js b/src/nginxconfig/i18n/zh-cn/templates/domain_sections/onion.js
index cf68436..1d1b509 100644
--- a/src/nginxconfig/i18n/zh-cn/templates/domain_sections/onion.js
+++ b/src/nginxconfig/i18n/zh-cn/templates/domain_sections/onion.js
@@ -31,5 +31,6 @@ export default {
     onionLocation: `${onion} location`, // TODO: translate
     provideAnOnionLocationToSetOnionLocationHeader: 'Provide an onion location address to set the Onion-Location header for your site.', // TODO: translate
     letsVisitorsKnownOnionServicesIsAvailable: 'This lets visitors know that an onion services version of your site is available for Tor browsers.', // TODO: translate
+    learnMoreAboutOnionServices: 'Learn more about Onion services', // TODO: translate
     onionLocationExpectedToEndWithOnion: 'Onion location addresses normally end with `.onion`.', // TODO: translate
 };
diff --git a/src/nginxconfig/i18n/zh-tw/templates/domain_sections/onion.js b/src/nginxconfig/i18n/zh-tw/templates/domain_sections/onion.js
index cf68436..1d1b509 100644
--- a/src/nginxconfig/i18n/zh-tw/templates/domain_sections/onion.js
+++ b/src/nginxconfig/i18n/zh-tw/templates/domain_sections/onion.js
@@ -31,5 +31,6 @@ export default {
     onionLocation: `${onion} location`, // TODO: translate
     provideAnOnionLocationToSetOnionLocationHeader: 'Provide an onion location address to set the Onion-Location header for your site.', // TODO: translate
     letsVisitorsKnownOnionServicesIsAvailable: 'This lets visitors know that an onion services version of your site is available for Tor browsers.', // TODO: translate
+    learnMoreAboutOnionServices: 'Learn more about Onion services', // TODO: translate
     onionLocationExpectedToEndWithOnion: 'Onion location addresses normally end with `.onion`.', // TODO: translate
 };
diff --git a/src/nginxconfig/scss/_fields.scss b/src/nginxconfig/scss/_fields.scss
index 55fbac5..d3d4bb3 100644
--- a/src/nginxconfig/scss/_fields.scss
+++ b/src/nginxconfig/scss/_fields.scss
@@ -130,6 +130,10 @@ THE SOFTWARE.
           display: inline-block;
         }
       }
+
+      .fa-external-link-alt {
+        margin: 0 0 0 .25rem;
+      }
     }
   }
 
diff --git a/src/nginxconfig/templates/domain_sections/onion.vue b/src/nginxconfig/templates/domain_sections/onion.vue
index 570c769..aaf4e30 100644
--- a/src/nginxconfig/templates/domain_sections/onion.vue
+++ b/src/nginxconfig/templates/domain_sections/onion.vue
@@ -36,14 +36,25 @@ THE SOFTWARE.
                         <input v-model="onionLocation" class="input" type="text" :placeholder="$props.data.onionLocation.placeholder" />
                     </div>
 
-                    <div class="control" v-if="!onionLocationChanged">
-                        <label class="text">
-                            {{ $t('templates.domainSections.onion.provideAnOnionLocationToSetOnionLocationHeader') }}
-                        </label>
-                        <label class="text">
-                            {{ $t('templates.domainSections.onion.letsVisitorsKnownOnionServicesIsAvailable') }}
-                        </label>
-                    </div>
+                    <template v-if="!onionLocationChanged">
+                        <div class="control">
+                            <label class="text">
+                                {{ $t('templates.domainSections.onion.provideAnOnionLocationToSetOnionLocationHeader') }}
+                            </label>
+                        </div>
+                        <div class="control">
+                            <label class="text">
+                                {{ $t('templates.domainSections.onion.letsVisitorsKnownOnionServicesIsAvailable') }}
+                            </label>
+                        </div>
+                        <div class="control">
+                            <label class="text">
+                                <ExternalLink :text="$t('templates.domainSections.onion.learnMoreAboutOnionServices')"
+                                              link="https://community.torproject.org/onion-services/"
+                                ></ExternalLink>
+                            </label>
+                        </div>
+                    </template>
 
                     <div class="control" v-if="incorrectEnding">
                         <label class="text message is-warning">
@@ -59,6 +70,7 @@ THE SOFTWARE.
 </template>
 
 <script>
+    import ExternalLink from 'do-vue/src/templates/external_link';
     import delegatedFromDefaults from '../../util/delegated_from_defaults';
     import computedFromDefaults from '../../util/computed_from_defaults';
 
@@ -75,6 +87,9 @@ THE SOFTWARE.
         display: 'templates.domainSections.onion.onion',        // Display name for tab (i18n key)
         key: 'onion',                                           // Key for data in parent
         delegated: delegatedFromDefaults(defaults),             // Data the parent will present here
+        components: {
+            ExternalLink,
+        },
         props: {
             data: Object,                                       // Data delegated back to us from parent
         },