diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /lib/gitlab/ci/badge/template.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'lib/gitlab/ci/badge/template.rb')
-rw-r--r-- | lib/gitlab/ci/badge/template.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/lib/gitlab/ci/badge/template.rb b/lib/gitlab/ci/badge/template.rb new file mode 100644 index 00000000000..0580dad72ba --- /dev/null +++ b/lib/gitlab/ci/badge/template.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module Gitlab::Ci + module Badge + ## + # Abstract template class for badges + # + class Template + MAX_KEY_TEXT_SIZE = 64 + MAX_KEY_WIDTH = 512 + + def initialize(badge) + @entity = badge.entity + @status = badge.status + end + + def key_text + raise NotImplementedError + end + + def value_text + raise NotImplementedError + end + + def key_width + raise NotImplementedError + end + + def value_width + raise NotImplementedError + end + + def value_color + raise NotImplementedError + end + + def key_color + '#555' + end + + def key_text_anchor + key_width / 2 + end + + def value_text_anchor + key_width + (value_width / 2) + end + + def width + key_width + value_width + end + end + end +end |