forked from superfly/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
guides.html.erb
100 lines (94 loc) · 2.31 KB
/
guides.html.erb
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---
title: Flight Plans - Guides and Examples
layout: docs
toc: true
nav: firecracker
---
<% categories = HashWithIndifferentAccess.new(
guide: {
title: "Guides"
},
performance: {
title: "Application Performance",
},
"custom domains": {
title: "Custom Domains for SaaS",
},
graphql: {
title: "GraphQL"
},
app: {
title: "Example Applications",
},
elixir: {
title: "Elixir Guides",
},
proxy: {
title: "Proxies",
},
ci: {
title: "Deployment Tools",
},
msg: {
title: "Messaging"
},
apigw: {
title: "API Gateways"
},
cdn: {
title: "CDNs"
},
"6pn": {
title: "6PN Private Networking"
},
volumes: {
title: "Volumes"
},
certs: {
title: "Certificates"
}
).map { |k, v| [k, OpenStruct.new(v)] }
guides = sitemap.resources.select { |r| r.path =~ %r{^docs/app-guides/} }.map do |page|
OpenStruct.new(
{ url: page.url }.merge(page.data)
)
end
new_guides = guides
guides.select { |g| g[:author].present? }.each do |g|
g[:author] = data.authors[g[:author]]
end
new_guides = new_guides.sort_by(&:date).reverse.first(5)
idx = HashWithIndifferentAccess.new
guides.each do |p|
p&.categories&.each do |c|
idx[c] ||= []
idx[c].push(p)
end
end
%>
<section class="grid min-lg:col:1 gap:1 text:md">
<dl id="new-guides" class="p:2 bg:lightest-blue r:lg mb:0 text:darkest-blue">
<dt class="text:smallcaps text:xs mb:12p child">
Latest Plans
</dt>
<% new_guides.each do |k|%>
<dd><a class="" href="<%= k.url %>"><%= k.title %></a> (<%= k.date.strftime("%b %y") %>)</dd>
<% end %>
</dl>
<% categories.each do |k, v| %>
<dl id="<%= k %>" class="p:2 bg:lightest-silver target:shadow:highlight r:lg mb:0<%= k == "app" ? " colspan:all" : "" %>">
<dt
id="h-<%= k %>"
class="text:smallcaps text:xs mb:12p child"
>
<%= v.title %>
</dt>
<dd class="<%= k == "app" ? "grid min-lg:col:1 gap-x:1 mx:-2" : "flex flex:col" %>">
<% idx[k].sort_by(&:title).each do |p| %>
<% author = p.author %>
<a class="<%= k == "app" ? "px:2" : "" %>" href="<%= p.url %>"><%= p.title %></a>
<% end %>
</dd>
</dl>
<% end %>
</section>