diff options
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | content/_data/banner.yaml | 4 | ||||
-rw-r--r-- | content/assets/stylesheets/stylesheet.scss | 8 | ||||
-rw-r--r-- | layouts/banner.html | 22 | ||||
-rw-r--r-- | lib/helpers/generic.rb | 7 | ||||
-rw-r--r-- | nanoc.yaml | 3 |
6 files changed, 36 insertions, 24 deletions
@@ -508,18 +508,14 @@ In case there's a survey that needs to reach a big audience, the docs site has the ability to host a banner for that purpose. When it is enabled, it's shown at the top of every page of the docs site. -To publish a survey: +To publish a survey, edit [`banner.yaml`](/content/_data/banner.yaml) and: -1. Edit [`layouts/banner.html`](/layouts/banner.html) and fill in the required - information like the description text and the survey link. -1. Edit [`nanoc.yaml`](nanoc.yaml) and set `show_banner` to `true`. +1. Set `show_banner` to `true`. +1. Under `description`, add what information you want to appear in the banner. + Markdown is supported. -To unpublish a survey: - -1. Edit [`nanoc.yaml`](nanoc.yaml) and set `show_banner` to `false`. -1. Edit [`layouts/banner.html`](/layouts/banner.html) remove the survey link. - This step is optional, but it's good to have the link removed so that it's - not exposed when no new survey answers are needed. +To unpublish a survey, edit [`banner.yaml`](/content/_data/banner.yaml) and +set `show_banner` to `false`. ## CSP header diff --git a/content/_data/banner.yaml b/content/_data/banner.yaml new file mode 100644 index 00000000..481a0611 --- /dev/null +++ b/content/_data/banner.yaml @@ -0,0 +1,4 @@ +show_banner: true +description: | + We'd love to understand your experience with GitLab's documentation: + [Take the 3-minute survey!](https://gitlab.fra1.qualtrics.com/jfe/form/SV_7PUN2cXgMytSMyG) diff --git a/content/assets/stylesheets/stylesheet.scss b/content/assets/stylesheets/stylesheet.scss index c845b8dc..a2e5d7e0 100644 --- a/content/assets/stylesheets/stylesheet.scss +++ b/content/assets/stylesheets/stylesheet.scss @@ -1,5 +1,5 @@ --- -version: 116 +version: 117 --- @import 'variables'; @@ -533,3 +533,9 @@ h6[id]::before { .imageblock { margin: 1rem 0; } + +.admonition { + p { + margin-bottom: 0; + } +} diff --git a/layouts/banner.html b/layouts/banner.html index 949c70f0..57aea7ad 100644 --- a/layouts/banner.html +++ b/layouts/banner.html @@ -1,16 +1,18 @@ -<% if @config[:show_banner] and !stable_version?(current_branch) %> +<% +banner_raw = @items["/_data/banner.yaml"][:description] +%> +<% if show_banner? and !stable_version?(current_branch) %> <div class="d-lg-block"> <div class="admonition-wrapper note d-none" id="banner-close"> <div class="admonition alert alert-banner alert-dismissible fade show text-center" role="alert"> - <i class="fa fa-gitlab fa-fw" style="color:rgb(225,67,41); font-size:.85em" aria-hidden="true"></i> - Help us measure the doc site's usability over time: - <a href="https://gitlab.fra1.qualtrics.com/jfe/form/SV_7PUN2cXgMytSMyG" target="_blank" rel="noopener noreferrer"> - Take the 3-minute survey! - </a> - <i class="fa fa-gitlab fa-fw" style="color:rgb(225,67,41); font-size:.85em" aria-hidden="true"></i> - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> - <span aria-hidden="true">×</span> - </button> + <div class="d-flex justify-content-center align-items-center"> + <i class="fa fa-gitlab fa-fw" style="color:rgb(225,67,41); font-size:.85em" aria-hidden="true"></i> + <%= markdown(banner_raw) %> + <i class="fa fa-gitlab fa-fw" style="color:rgb(225,67,41); font-size:.85em" aria-hidden="true"></i> + <button type="button" class="close mt-n1" data-dismiss="alert" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> </div> </div> <script type="application/javascript" src="<%= @items['/assets/javascripts/banner.*'].path %>"></script> diff --git a/lib/helpers/generic.rb b/lib/helpers/generic.rb index c9254368..1f7a091c 100644 --- a/lib/helpers/generic.rb +++ b/lib/helpers/generic.rb @@ -46,5 +46,12 @@ module Nanoc::Helpers def gitlab_docs_or_local? ENV['CI_PROJECT_NAME'] == 'gitlab-docs' or ENV['CI_PROJECT_NAME'].nil? end + + # + # Control display of survey banner. See README.md#survey-banner + # + def show_banner? + @items['/_data/banner.yaml'][:show_banner] + end end end @@ -117,9 +117,6 @@ checks: breadcrumbs: false debug: false -# Control display of survey banner. See README.md#survey-banner -show_banner: true - products: ee: slug: 'ee' |