blob: 2e8897326655262be230eeb5bc5e2105f3e10d93 (
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
|
# frozen_string_literal: true
module Nanoc::Helpers
module Blueprints
def all_blueprints
@items.find_all('/ee/architecture/blueprints/**/*.md').sort_by { |i| blueprint_creation_date(i) }.reverse
end
def author_link(author)
username = author.tr('@', '')
link_to("@#{username}", "https://gitlab.com/#{username}")
end
def blueprint_creation_date(blueprint)
blueprint[:'creation-date'].nil? ? '-' : Time.parse(blueprint[:'creation-date']).strftime('%Y-%m-%d')
end
# TODO: this is generic, should live elsewhere
def gl_label(label)
return if label.nil?
scope, text = label.tr('~', '').split('::')
is_scoped = !text.nil?
%(
<span class="gl-label #{is_scoped ? 'gl-label-scoped' : ''} #{scope}">
<span class="gl-label-text">#{scope}</span>
#{%(<span class="gl-label-text-scoped">#{text}</span>) if is_scoped}
</span>
)
end
end
end
|