From e20baee820ea2c76ee16980a98e8080f255d9035 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 27 Mar 2020 18:07:48 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/assets/javascripts/serverless/survey_banner.js | 36 +++++++++++++++ .../javascripts/serverless/survey_banner.vue | 52 ++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 app/assets/javascripts/serverless/survey_banner.js create mode 100644 app/assets/javascripts/serverless/survey_banner.vue (limited to 'app/assets/javascripts/serverless') diff --git a/app/assets/javascripts/serverless/survey_banner.js b/app/assets/javascripts/serverless/survey_banner.js new file mode 100644 index 00000000000..070e8f4c661 --- /dev/null +++ b/app/assets/javascripts/serverless/survey_banner.js @@ -0,0 +1,36 @@ +import Vue from 'vue'; +import { setUrlParams } from '~/lib/utils/url_utility'; +import SurveyBanner from './survey_banner.vue'; + +let bannerInstance; +const SURVEY_URL_BASE = 'https://gitlab.fra1.qualtrics.com/jfe/form/SV_00PfofFfY9s8Shf'; + +export default function initServerlessSurveyBanner() { + const el = document.querySelector('.js-serverless-survey-banner'); + if (el && !bannerInstance) { + const { userName, userEmail } = el.dataset; + + // pre-populate survey fields + const surveyUrl = setUrlParams( + { + Q_PopulateResponse: JSON.stringify({ + QID1: userEmail, + QID2: userName, + QID16: '1', // selects "yes" to "do you currently use GitLab?" + }), + }, + SURVEY_URL_BASE, + ); + + bannerInstance = new Vue({ + el, + render(createElement) { + return createElement(SurveyBanner, { + props: { + surveyUrl, + }, + }); + }, + }); + } +} diff --git a/app/assets/javascripts/serverless/survey_banner.vue b/app/assets/javascripts/serverless/survey_banner.vue new file mode 100644 index 00000000000..a0a90fa5e80 --- /dev/null +++ b/app/assets/javascripts/serverless/survey_banner.vue @@ -0,0 +1,52 @@ + + + -- cgit v1.2.1