diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /lib/gitlab/tracking/docs/helper.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'lib/gitlab/tracking/docs/helper.rb')
-rw-r--r-- | lib/gitlab/tracking/docs/helper.rb | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/lib/gitlab/tracking/docs/helper.rb b/lib/gitlab/tracking/docs/helper.rb new file mode 100644 index 00000000000..81874aac9a5 --- /dev/null +++ b/lib/gitlab/tracking/docs/helper.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +module Gitlab + module Tracking + module Docs + # Helper with functions to be used by HAML templates + module Helper + def auto_generated_comment + <<-MARKDOWN.strip_heredoc + --- + stage: Growth + group: Product Intelligence + info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers + --- + + <!--- + This documentation is auto generated by a script. + + Please do not edit this file directly, check generate_metrics_dictionary task on lib/tasks/gitlab/usage_data.rake. + ---> + + <!-- vale gitlab.Spelling = NO --> + MARKDOWN + end + + def render_description(object) + return 'Missing description' unless object.description.present? + + object.description + end + + def render_event_taxonomy(object) + headers = %w[category action label property value] + values = %i[category action label property_description value_description] + values = values.map { |key| backtick(object.attributes[key]) } + values = values.join(" | ") + + [ + "| #{headers.join(" | ")} |", + "#{'|---' * headers.size}|", + "| #{values} |" + ].join("\n") + end + + def md_link_to(anchor_text, url) + "[#{anchor_text}](#{url})" + end + + def render_owner(object) + "Owner: #{backtick(object.product_group)}" + end + + def render_tiers(object) + "Tiers: #{object.tiers.map(&method(:backtick)).join(', ')}" + end + + def render_yaml_definition_path(object) + "YAML definition: #{backtick(object.yaml_path)}" + end + + def backtick(string) + "`#{string}`" + end + end + end + end +end |