diff --git a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/helpers/helpers.js b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/helpers/helpers.js index d4e4b98254c..c50475776b4 100644 --- a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/helpers/helpers.js +++ b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/helpers/helpers.js @@ -118,7 +118,7 @@ export function scrollToActiveExplorerNode() { } } -function getOffsetTop(container, el) { +export function getOffsetTop(container, el) { let offset = 0; while (el && el != container) { offset += el.offsetTop; diff --git a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/index.js b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/index.js index e403807cd0d..c4c0a38c5da 100644 --- a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/index.js +++ b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/index.js @@ -31,6 +31,7 @@ import { newSearchFiltersController, newSearchInputController, newSearchStore, g import { newHomeController } from './sections/home/home'; import { newSectionsController } from './sections/sections/index'; import { newSVGViewerController } from './navigation/svg-viewer'; +import { newFileIssueButton } from './navigation/file-issue-button'; // Set up the search configuration (as defined in config.toml). const searchConfig = getSearchConfig(params); @@ -101,6 +102,9 @@ const searchConfig = getSearchConfig(params); Alpine.data('lncPromoCodes', () => newPromoCodesController(params.is_test)); Alpine.data('lncFetch', fetchController); Alpine.data('lnvSVGViewer', newSVGViewerController); + if (params.file_issue_button && params.file_issue_button.enable) { + Alpine.data('lncFileIssueButton', () => newFileIssueButton(params.file_issue_button)); + } // Page controllers. Alpine.data('lncHome', (staticData) => { diff --git a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/file-issue-button.js b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/file-issue-button.js new file mode 100644 index 00000000000..7642896133e --- /dev/null +++ b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/file-issue-button.js @@ -0,0 +1,149 @@ +var debug = 0 ? console.log.bind(console, '[file-issue-button]') : function () {}; + +import { getOffsetTop, isMobile } from '../helpers/helpers'; + +export function newFileIssueButton(conf) { + return { + isHovered: false, + hoveredEl: null, + isHoveredButton: false, + timeoutID: null, + + // The issue items presented to the user. + items: [], + + show() { + return this.isHoveredButton || this.isHovered; + }, + + hoverButton() { + // Prepare the issue items. + // First clear any existing items. + this.items.length = 0; + + for (let item of conf.issue_templates) { + let info = window.lnPageInfo; + let file = ''; + if (info.path) { + file = `https://github.com/linode/docs/blob/develop/docs/${info.path}`; + } + let context = this.hoveredEl.textContent.trim(); + debug('context:', context); + let href = `${conf.repo_url}/issues/new?&template=${item.id}&file=${encodeURIComponent( + file, + )}&context=${encodeURIComponent(context)}`; + this.items.push({ title: item.title, href: href }); + } + + // This will show the issue items dropdown. + this.isHoveredButton = true; + }, + + hoverOn(hoveredEl) { + if (this.isHovered) { + debug('hoverOn:', hoveredEl.tagName, 'vs', this.hoveredEl.tagName); + + if (hoveredEl.tagName !== this.hoveredEl.tagName) { + // Check if we're hovering over the same element or an ancestor. + if (hoveredEl.contains(this.hoveredEl)) { + debug('skip'); + return; + } + } else { + if (hoveredEl.tagName == 'TD' || hoveredEl.tagName == 'TH') { + debug('skip'); + return; + } + } + } + if (this.isHoveredButton) { + this.isHoveredButton = false; + } + if (this.timeoutID) { + clearTimeout(this.timeoutID); + } + debug('hoverOn:', hoveredEl.tagName); + + if (hoveredEl.tagName === 'PRE') { + // If the parent is a TD we need to select the second column, the first is line numbers. + let parent = hoveredEl.parentNode; + if (parent.tagName === 'TD') { + hoveredEl = parent.parentNode.parentNode; + let tds = hoveredEl.querySelectorAll('td'); + // Select last td. + hoveredEl = tds[tds.length - 1]; + } + } + + this.isHovered = true; + this.hoveredEl = hoveredEl; + + let el = this.$el; + let container = el.parentNode; + let distance = getOffsetTop(container, hoveredEl); + + // Position el relative to hoveredEl. + el.style.position = 'absolute'; + el.style.top = distance + 'px'; + el.style.left = '0'; + el.style.zIndex = 5; + + this.timeoutID = setTimeout(() => { + this.isHovered = false; + }, 2500); + }, + + init() { + return this.$nextTick(() => { + if (isMobile()) { + return; + } + let mainContentEl = document.getElementById('main__content'); + if (!mainContentEl) { + return; + } + + mainContentEl.querySelectorAll('.content').forEach((contentEl) => { + contentEl.addEventListener( + 'mouseover', + (e) => { + switch (e.target.tagName) { + case 'DL': + case 'LI': + case 'P': + case 'PRE': + case 'TD': + case 'TH': + this.hoverOn(e.target); + break; + case 'SPAN': + case 'CODE': + // Check if we're in a pre block. + let pre = e.target.closest('pre'); + if (pre) { + this.hoverOn(pre); + } + break; + case 'DIV': + // This class is set in the tabs component etc, + // to avoid getting many false positives on the DIVS. + let whitelist = ['file-issue-button-content', 'note', 'code']; + for (let w of whitelist) { + if (e.target.classList.contains(w)) { + this.hoverOn(e.target); + break; + } + } + break; + default: + debug('default:', e.target.tagName); + break; + } + }, + { passive: true }, + ); + }); + }); + }, + }; +} diff --git a/_vendor/github.com/linode/linode-docs-theme/config.toml b/_vendor/github.com/linode/linode-docs-theme/config.toml index 850f986ae64..80ff9943716 100644 --- a/_vendor/github.com/linode/linode-docs-theme/config.toml +++ b/_vendor/github.com/linode/linode-docs-theme/config.toml @@ -10,8 +10,25 @@ weglot_api_key = "wg_3b3ef29c81aa81292c64d1368ee318969" adobe_launch_script = "https://assets.adobedtm.com/fcfd3580c848/f9e7661907ee/launch-2fb69de42220.min.js" # OneTrust Domain used in production. +onetrust_script_src = "https://www.linode.com/ns/ot/202410.1.0/prod/scripttemplates/otSDKStub.js" onetrust_domain_script = "01922358-0e47-73fa-9452-fa124177d6d6" +# Configuration for the contextual menu over content items that +# allows the user to send specific feedback/issue about the content +# to GitHub. +# We currently pass attribute 'context' and 'file' prefilled from the front-end. +[params.file_issue_button] +enable = true +repo_url = "https://github.com/bep/githubissuestest" +[[params.file_issue_button.issue_templates]] +# The id maps to a GitHub issue template in the repository. +id = "issue-template-1.yml" +# The title is what gets shown in the contextual menu. +title = "Report a problem" +[[params.file_issue_button.issue_templates]] +id = "issue-template-2.yml" +title = "Report something else" + [params.search_config2] app_id = "KGUN8FAIPF" diff --git a/_vendor/github.com/linode/linode-docs-theme/config/development/config.toml b/_vendor/github.com/linode/linode-docs-theme/config/development/config.toml index f292e15ec94..45b87b99f23 100644 --- a/_vendor/github.com/linode/linode-docs-theme/config/development/config.toml +++ b/_vendor/github.com/linode/linode-docs-theme/config/development/config.toml @@ -3,4 +3,5 @@ adobe_launch_script = "https://assets.adobedtm.com/fcfd3580c848/f9e7661907ee/launch-006d022c8726-development.min.js" # OneTrust Domain used in test/development. + onetrust_script_src = "https://www.linode.com/ns/ot/202410.1.0/staging/scripttemplates/otSDKStub.js" onetrust_domain_script = "01922358-0e47-73fa-9452-fa124177d6d6-test" diff --git a/_vendor/github.com/linode/linode-docs-theme/config/staging/config.toml b/_vendor/github.com/linode/linode-docs-theme/config/staging/config.toml index 9091267e64a..246550c5804 100644 --- a/_vendor/github.com/linode/linode-docs-theme/config/staging/config.toml +++ b/_vendor/github.com/linode/linode-docs-theme/config/staging/config.toml @@ -3,4 +3,5 @@ adobe_launch_script = "https://assets.adobedtm.com/fcfd3580c848/f9e7661907ee/launch-96338797f65e-staging.min.js" # OneTrust Domain used in test/development. + onetrust_script_src = "https://www.linode.com/ns/ot/202410.1.0/staging/scripttemplates/otSDKStub.js" onetrust_domain_script = "01922358-0e47-73fa-9452-fa124177d6d6-test" diff --git a/_vendor/github.com/linode/linode-docs-theme/config/testing/config.toml b/_vendor/github.com/linode/linode-docs-theme/config/testing/config.toml index f292e15ec94..45b87b99f23 100644 --- a/_vendor/github.com/linode/linode-docs-theme/config/testing/config.toml +++ b/_vendor/github.com/linode/linode-docs-theme/config/testing/config.toml @@ -3,4 +3,5 @@ adobe_launch_script = "https://assets.adobedtm.com/fcfd3580c848/f9e7661907ee/launch-006d022c8726-development.min.js" # OneTrust Domain used in test/development. + onetrust_script_src = "https://www.linode.com/ns/ot/202410.1.0/staging/scripttemplates/otSDKStub.js" onetrust_domain_script = "01922358-0e47-73fa-9452-fa124177d6d6-test" diff --git a/_vendor/github.com/linode/linode-docs-theme/content/whatsnew/index.md b/_vendor/github.com/linode/linode-docs-theme/content/whatsnew/index.md index f09b37b9a64..9ab153445ad 100644 --- a/_vendor/github.com/linode/linode-docs-theme/content/whatsnew/index.md +++ b/_vendor/github.com/linode/linode-docs-theme/content/whatsnew/index.md @@ -1,5 +1,6 @@ --- title: "What’s New" +linkTitle: "New and updated Cloud Guides & Tutorials" date: 2021-04-16 layout: "whatsnew" --- diff --git a/_vendor/github.com/linode/linode-docs-theme/layouts/_default/baseof.html b/_vendor/github.com/linode/linode-docs-theme/layouts/_default/baseof.html index 78481ed9d43..7b415990bed 100644 --- a/_vendor/github.com/linode/linode-docs-theme/layouts/_default/baseof.html +++ b/_vendor/github.com/linode/linode-docs-theme/layouts/_default/baseof.html @@ -161,7 +161,7 @@ {{ if eq $mainLayout "content_toc" }}
+ class="main__content relative mb-20 container mx-auto max-w-content xl:max-w-6xl"> @@ -183,6 +183,9 @@ + {{ if site.Params.file_issue_button.enable }} + {{ partial "sections/navigation/file-issue-button.html" . }} + {{ end }}
{{ else }} {{ block "main-section" . }} diff --git a/_vendor/github.com/linode/linode-docs-theme/layouts/_default/whatsnew.html b/_vendor/github.com/linode/linode-docs-theme/layouts/_default/whatsnew.html index d791ace70bb..3196a18ef60 100644 --- a/_vendor/github.com/linode/linode-docs-theme/layouts/_default/whatsnew.html +++ b/_vendor/github.com/linode/linode-docs-theme/layouts/_default/whatsnew.html @@ -9,13 +9,34 @@
{{ .Summary }}
- {{ $deprecated := where site.RegularPages "Params.deprecated" true }} - {{ $pages := where site.RegularPages "Section" "in" (slice "guides" "products" ) | complement $deprecated }} - {{ $pages = $pages.ByLastmod.Reverse | first 20 }} -
- {{ range $pages }} - {{ partial "components/card.html" (dict "page" .) }} - {{ end }} -
+ {{ $guides := site.GetPage "guides" }} + {{ $pages := $guides.RegularPagesRecursive }} + + {{ $pages = $pages.ByLastmod.Reverse }} + {{ range $pages.GroupByLastmod "January 2006" | first 3 }} +

{{ .Key }}

+
+ {{ range .Pages }} + +

+ {{ .LinkTitle }} +

+

+ {{ (or .Params.description .Summary)| truncate 160 | safeHTML }} +

+
+ {{ end }} +
+ {{ end }} +

+ View All Cloud Guides & Tutorials +

{{ end }} diff --git a/_vendor/github.com/linode/linode-docs-theme/layouts/index.html b/_vendor/github.com/linode/linode-docs-theme/layouts/index.html index 86ca4d87bf5..bfd6a59acc1 100644 --- a/_vendor/github.com/linode/linode-docs-theme/layouts/index.html +++ b/_vendor/github.com/linode/linode-docs-theme/layouts/index.html @@ -362,7 +362,7 @@

  • Product docs
  • @@ -370,7 +370,7 @@

    API reference @@ -381,18 +381,14 @@

    {{ end }} {{ define "home/cards" }} -
    +

    {{ .title }}

    - {{ $numItemsNarrowViewport := 2 }} -
    +
    {{ range $i, $e := .cards }} - {{ $hideOnNarrow := ge $i $numItemsNarrowViewport }}

    Explore more {{ .more_text }} -

    +
    +
    + {{ with .whats_new_page }} + {{ .LinkTitle }} +
    + {{ end }} + {{ .more_text }} +
    + {{ if gt (len .cards) 3 }} + + + + {{ end }} +
    {{ end }}
    {{ end }} {{ define "home/cards-from-section" }} {{ $pages := slice }} + {{ $numPages := cond (eq .page.Section "guides") 9 3 }} {{ if eq .page.Section "reference-architecture" }} {{ $pages = .page.Sections }} {{ else }} {{ $pages = .page.RegularPagesRecursive }} {{ end }} - {{ $featured := $pages | first 3 }} + {{ $featured := $pages | first $numPages }} {{ $cards := slice }} {{ range $featured }} {{ $cards = $cards | append (dict "title" .LinkTitle "text" (or .Params.description .Summary) "href" .RelPermalink) }} {{ end }} - {{ $moreText := .page.Title }} + {{ $moreText := printf "Explore all %s" .page.Title }} + {{ $moreHref := .page.RelPermalink }} + {{ $whatsNewPage := "" }} + {{ if eq .page.Section "guides" }} + {{ $whatsNewPage = site.GetPage "whatsnew" }} + {{ end }} {{ template "home/cards" dict "title" .page.Title "cards" $cards "class" .class "more_text" $moreText "more_href" .page.RelPermalink + "whats_new_page" $whatsNewPage }} {{ end }} diff --git a/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/after-body-start.html b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/after-body-start.html index 330beb2b7ef..26720b469e6 100644 --- a/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/after-body-start.html +++ b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/after-body-start.html @@ -5,9 +5,14 @@ {{/* Scripts to be executed as soon as possible. */}} {{- $js := resources.Get "js/body-start/index.js" -}} {{ partial "helpers/script-src.html" (dict "js" $js "nodefer" true "params" (dict "is_production" (ne hugo.Environment "development") ) ) }} +{{ $path := "" }} +{{ if .File }} + {{ $path = .Params.path | default .File.Path }} +{{ end }} {{ $pageInfo := dict "href" .RelPermalink + "path" $path "permalink" .Permalink "kind" .Kind "section" .Section diff --git a/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/head-src.html b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/head-src.html index 638d408d457..58766f6582d 100644 --- a/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/head-src.html +++ b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/head-src.html @@ -42,6 +42,7 @@ {{ $cacheWarmerUrls := $algoliaData.urls }} {{ $params := (dict "search_config" site.Params.search_config2 + "file_issue_button" site.Params.file_issue_button "weglot_api_key" site.Params.weglot_api_key "page_title_suffix" site.Params.page_title_suffix "search_cachewarmer_urls" $cacheWarmerUrls diff --git a/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/head.html b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/head.html index 76d465f3be6..38920841a06 100644 --- a/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/head.html +++ b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/head.html @@ -30,8 +30,23 @@ {{/* OneTrust Cookies Consent Notice for www.linode.com. Load this before Adobe Analytics. */}} + + diff --git a/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/navigation/file-issue-button.html b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/navigation/file-issue-button.html new file mode 100644 index 00000000000..aae72d0539f --- /dev/null +++ b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/navigation/file-issue-button.html @@ -0,0 +1,60 @@ + diff --git a/_vendor/github.com/linode/linode-docs-theme/layouts/shortcodes/tabs.html b/_vendor/github.com/linode/linode-docs-theme/layouts/shortcodes/tabs.html index 944740cc6f2..4f69a4015c7 100644 --- a/_vendor/github.com/linode/linode-docs-theme/layouts/shortcodes/tabs.html +++ b/_vendor/github.com/linode/linode-docs-theme/layouts/shortcodes/tabs.html @@ -18,6 +18,7 @@ {{- range (.Scratch.Get "tabsContent") -}}
    {{ .content }}
    diff --git a/_vendor/github.com/linode/linode-docs-theme/tailwind.config.js b/_vendor/github.com/linode/linode-docs-theme/tailwind.config.js index 9f23471856c..09ae3607f83 100644 --- a/_vendor/github.com/linode/linode-docs-theme/tailwind.config.js +++ b/_vendor/github.com/linode/linode-docs-theme/tailwind.config.js @@ -150,8 +150,8 @@ module.exports = { maxWidth: '860px', '@screen tablet': { - paddingLeft: '1.5rem', - paddingRight: '1.5rem', + paddingLeft: '2rem', + paddingRight: '2rem', }, '@screen lg': { diff --git a/_vendor/github.com/linode/linode-website-partials/footer.html b/_vendor/github.com/linode/linode-website-partials/footer.html index 8f1ca424f2a..b5c82ac68d7 100644 --- a/_vendor/github.com/linode/linode-website-partials/footer.html +++ b/_vendor/github.com/linode/linode-website-partials/footer.html @@ -24,7 +24,7 @@
    @@ -36,10 +36,10 @@