Welcome to mirror list, hosted at ThFree Co, Russian Federation.

template.rb « badge « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ed2ec50b197bc35791bf4d245a46bf050f2cc71a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# frozen_string_literal: true

module Gitlab
  module Badge
    ##
    # Abstract template class for badges
    #
    class Template
      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