diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-23 00:06:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-23 00:06:42 +0300 |
commit | d5e0416021aa6de53b89f9d415f368226d9326e5 (patch) | |
tree | 9a3e3bd6d1aac10cfde7f0079f784a489491a48b /app/views | |
parent | 24fe7aa2aa199b2aace0cfec26d744f51d7e2167 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/admin/application_settings/_pendo.html.haml | 24 | ||||
-rw-r--r-- | app/views/admin/application_settings/integrations.html.haml | 3 | ||||
-rw-r--r-- | app/views/layouts/_head.html.haml | 3 | ||||
-rw-r--r-- | app/views/layouts/_pendo.html.haml | 17 |
4 files changed, 45 insertions, 2 deletions
diff --git a/app/views/admin/application_settings/_pendo.html.haml b/app/views/admin/application_settings/_pendo.html.haml new file mode 100644 index 00000000000..c165610b332 --- /dev/null +++ b/app/views/admin/application_settings/_pendo.html.haml @@ -0,0 +1,24 @@ +- expanded = true if !@application_setting.valid? && @application_setting.errors.any? { |k| k.to_s.start_with?('pendo_') } +%section.settings.as-pendo.no-animate#js-pendo-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Pendo') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Configure the %{link} integration.').html_safe % { link: link_to('Pendo', 'https://www.pendo.io/', target: '_blank') } + .settings-content + + = form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-pendo-settings'), html: { class: 'fieldset-form' } do |f| + = form_errors(@application_setting) if expanded + + %fieldset + .form-group + .form-check + = f.check_box :pendo_enabled, class: 'form-check-input' + = f.label :pendo_enabled, _('Enable pendo tracking'), class: 'form-check-label' + .form-group + = f.label :pendo_url, _('Pendo endpoint'), class: 'label-light' + = f.text_field :pendo_url, class: 'form-control', placeholder: 'https://cdn.pendo.io/agent/static/your-api-key/pendo.js' + + = f.submit _('Save changes'), class: 'btn btn-success' diff --git a/app/views/admin/application_settings/integrations.html.haml b/app/views/admin/application_settings/integrations.html.haml index 310e86b1377..399f3566cef 100644 --- a/app/views/admin/application_settings/integrations.html.haml +++ b/app/views/admin/application_settings/integrations.html.haml @@ -28,4 +28,5 @@ .settings-content = render 'third_party_offers', application_setting: @application_setting -= render_if_exists 'admin/application_settings/snowplow', expanded: expanded_by_default? += render 'admin/application_settings/snowplow', expanded: expanded_by_default? += render 'admin/application_settings/pendo' diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index b8c9f0ae1e8..d7319b18092 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -89,4 +89,5 @@ = render 'layouts/google_analytics' if extra_config.has_key?('google_analytics_id') = render 'layouts/piwik' if extra_config.has_key?('piwik_url') && extra_config.has_key?('piwik_site_id') - = render_if_exists 'layouts/snowplow' + = render 'layouts/snowplow' + = render 'layouts/pendo' diff --git a/app/views/layouts/_pendo.html.haml b/app/views/layouts/_pendo.html.haml new file mode 100644 index 00000000000..08b1acbe3d3 --- /dev/null +++ b/app/views/layouts/_pendo.html.haml @@ -0,0 +1,17 @@ +- return unless Gitlab::CurrentSettings.pendo_enabled? + += javascript_tag nonce: true do + :plain + ;var trackable = !['1', 'yes'].includes(window.doNotTrack || navigator.doNotTrack || navigator.msDoNotTrack); + if (trackable){ + (function(p,e,n,d,o){var v,w,x,y,z;o=p[d]=p[d]||{};o._q=[]; + v=['initialize','identify','updateOptions','pageLoad'];for(w=0,x=v.length;w<x;++w)(function(m){ + o[m]=o[m]||function(){o._q[m===v[0]?'unshift':'push']([m].concat([].slice.call(arguments,0)));};})(v[w]); + y=e.createElement(n);y.async=!0;y.src='#{Gitlab::CurrentSettings.pendo_url}'; + z=e.getElementsByTagName(n)[0];z.parentNode.insertBefore(y,z);})(window,document,'script','pendo'); + + pendo.initialize({ + visitor: { + id: '#{current_user&.id}', + } + });}; |