summaryrefslogtreecommitdiff
path: root/lib/gitlab/badge/template.rb
blob: bfeb00526420c2e257827311a1386511cdbec944 (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
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