-
Notifications
You must be signed in to change notification settings - Fork 198
/
details.html
177 lines (156 loc) · 9 KB
/
details.html
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
{%- extends "base.html" -%}
{%- import "header/package_navigation.html" as navigation -%}
{%- block title -%}
{{ macros::doc_title(name=details.name, version=details.version) }}
{%- endblock title -%}
{%- block header -%}
{# Set the active tab to the `crate` tab #}
{{ navigation::package_navigation(metadata=details.metadata, active_tab="crate") }}
{%- endblock header -%}
{%- block body -%}
<div class="container package-page-container">
<div class="pure-g">
<div class="pure-u-1 pure-u-sm-7-24 pure-u-md-5-24">
<div class="pure-menu package-menu">
<ul class="pure-menu-list">
{# List the release author's names and a link to their docs.rs profile #}
<li class="pure-menu-heading">Authors</li>
{%- for author in details.authors -%}
<li class="pure-menu-item">
<a href="/releases/{{ author[1] }}" class="pure-menu-link">
{{ author[0] }}
</a>
</li>
{%- endfor -%}
<li class="pure-menu-heading">Links</li>
{# If the crate has a homepage, show it #}
{%- if details.homepage_url -%}
<li class="pure-menu-item">
<a href="{{ details.homepage_url }}" class="pure-menu-link">
<i class="fa fa-home fa-fw"></i> Homepage
</a>
</li>
{%- endif -%}
{# If the crate has a custom doc url, show it #}
{%- if details.documentation_url -%}
<li class="pure-menu-item">
<a href="{{ details.documentation_url }}" title="Canonical documentation" class="pure-menu-link">
<i class="fa fa-fw fa-file-text"></i> Documentation
</a>
</li>
{%- endif -%}
{# If the release has a repository, show it #}
{%- if details.repository_url -%}
<li class="pure-menu-item">
<a href="{{ details.repository_url }}" class="pure-menu-link">
{# If the repo link is for github, show some github stats #}
{# TODO: add support for hosts besides github (#35) #}
{%- if details.github -%}
<i class="fa fa-github fa-fw"></i>
<i class="fa fa-star-o fa-fw"></i> {{ details.github_stars }}
<i class="fa fa-code-fork fa-fw"></i> {{ details.github_forks }}
<i class="fa fa-exclamation-circle fa-fw"></i> {{ details.github_issues }}
{# If the repo link is unknown, just show a normal link #}
{%- else -%}
<i class="fa fa-code-fork fa-fw"></i> Repository
{%- endif -%}
</a>
</li>
{%- endif -%}
{# Show a link to the crate's Crates.io page #}
<li class="pure-menu-item">
<a href="https://crates.io/crates/{{ details.name }}" class="pure-menu-link"
title="See {{ details.name }} on crates.io">
<i class="fa fa-cube fa-fw"></i> Crates.io
</a>
</li>
<li class="pure-menu-heading">Dependencies</li>
<li class="pure-menu-item">
<div class="pure-menu pure-menu-scrollable sub-menu">
<ul class="pure-menu-list">
{# List all dependencies that the current release has #}
{%- for dep in details.dependencies -%}
<li class="pure-menu-item">
<a href="/crate/{{ dep[0] }}/{{ dep[1] }}" class="pure-menu-link">
{{ dep[0] }} {{ dep[1] }}
<i class="dependencies {{ dep[2] | default(value='') }}">{{ dep[2] | default(value="") }}</i>
</a>
</li>
{%- endfor -%}
</ul>
</div>
</li>
<li class="pure-menu-heading">Versions</li>
<li class="pure-menu-item">
<div class="pure-menu pure-menu-scrollable sub-menu">
<ul class="pure-menu-list">
{# Display all releases of this crate #}
{{ macros::releases_list(name=details.name, releases=details.releases) }}
</ul>
</div>
</li>
{# Display the crate owner's profile picture and a link to their docs.rs profile #}
<li class="pure-menu-heading">Owners</li>
<li class="pure-menu-item">
{%- for owner in details.owners -%}
<a href="/releases/@{{ owner[0] }}">
<img src="{{ owner[1] }}" alt="{{ owner[0] }}" class="owner">
</a>
{%- endfor -%}
</li>
</ul>
</div>
</div>
<div class="pure-u-1 pure-u-sm-17-24 pure-u-md-19-24 package-details" id="main">
{# If the release is not a library #}
{%- if not details.is_library -%}
<div class="warning">
{{ details.name }}-{{ details.version }} is not a library.
</div>
{# If the release has been yanked and is a library #}
{%- elif details.yanked -%}
<div class="warning">
{{ details.name }}-{{ details.version }} has been yanked.
</div>
{# If the build succeeded, isn't yanked and is a library #}
{%- elif details.build_status -%}
{# If there are no docs display a warning #}
{%- if not details.rustdoc_status -%}
<div class="warning">{{ details.name }}-{{ details.version }} doesn't have any documentation.</div>
{%- endif -%}
{# If there's a readme, display it #}
{%- if details.readme -%}
{{ details.readme | safe }}
{# If there's not a readme then attempt to display the long description #}
{%- elif details.rustdoc -%}
{{ details.rustdoc | safe }}
{%- endif -%}
{# If the build failed, the release isn't yanked and the release is a library #}
{%- else -%}
{# Display a warning telling the user we failed to build the docs #}
<div class="warning">
docs.rs failed to build {{ details.name }}-{{ details.version }}<br>Please check the
<a href="/crate/{{ details.name }}/{{ details.version }}/builds">build logs</a> and, if you believe this is
docs.rs' fault, <a href="https://github.com/rust-lang/docs.rs/issues/new/choose">open an issue</a>.
</div>
{# If there is one, display the most next most recent successful build #}
{%- if details.last_successful_build -%}
<div class="info">
Visit the last successful build:
<a href="/crate/{{ details.name }}/{{ details.last_successful_build }}">
{{ details.name }}-{{ details.last_successful_build }}
</a>
</div>
{%- endif -%}
{%- endif -%}
</div>
</div>
</div>
{%- endblock body -%}
{%- block css -%}
{{ macros::highlight_css() }}
{%- endblock css -%}
{%- block javascript -%}
{# Enable and load Rust and TOML syntax highlighting #}
{{ macros::highlight_js(languages=["rust", "ini"]) }}
{% endblock javascript -%}