|
15 | 15 | {% macro package_navigation(title=false, metadata, platforms=false, active_tab) %}
|
16 | 16 | <div class="cratesfyi-package-container">
|
17 | 17 | <div class="container">
|
18 |
| - {# Page title #} |
19 |
| - <h1 id="crate-title"> |
20 |
| - {%- if title -%} |
21 |
| - {{ title }} |
22 |
| - {%- else -%} |
23 |
| - {{ metadata.name }} {{ metadata.version }} |
24 |
| - {{ "copy" | far(id="clipboard", aria_label="Copy crate name and version information", fa=true) }} |
25 |
| - {%- endif -%} |
26 |
| - </h1> |
| 18 | + <div class="description-container"> |
| 19 | + {# The partial path of the crate, `:name/:release` #} |
| 20 | + {%- set crate_path = metadata.name ~ "/" ~ metadata.version -%} |
27 | 21 |
|
28 |
| - {# Page description #} |
29 |
| - <div class="description"> |
30 |
| - {%- if metadata.description -%} |
31 |
| - {{ metadata.description }} |
32 |
| - {%- endif -%} |
33 |
| - </div> |
| 22 | + {# If docs are built, show a button for them #} |
34 | 23 |
|
35 |
| - <div class="pure-menu pure-menu-horizontal"> |
36 |
| - {# If there are platforms, show a dropdown with them #} |
37 |
| - {%- if platforms -%} |
38 |
| - <ul class="pure-menu-list platforms-menu"> |
39 |
| - <li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover"> |
40 |
| - <a href="#" class="pure-menu-link">Platform</a> |
41 |
| - <ul class="pure-menu-children"> |
42 |
| - {%- for platform in platforms -%} |
43 |
| - <li class="pure-menu-item"> |
44 |
| - <a href="/{{ metadata.name }}/{{ metadata.version }}/{{ platform }}/{{ metadata.target_name }}/" |
45 |
| - class="pure-menu-link"> |
46 |
| - {{ platform }} |
47 |
| - </a> |
48 |
| - </li> |
49 |
| - {%- endfor -%} |
50 |
| - </ul> |
51 |
| - </li> |
52 |
| - </ul> |
53 |
| - {%- endif -%} |
| 24 | + {# Page title #} |
| 25 | + <h1 id="crate-title"> |
| 26 | + {%- if title -%} |
| 27 | + {{ title }} |
| 28 | + {%- else -%} |
| 29 | + {{ metadata.name }} {{ metadata.version }} |
| 30 | + {{ "copy" | far(id="clipboard", aria_label="Copy crate name and version information", fa=true) }} |
| 31 | + {%- endif -%} |
| 32 | + </h1> |
| 33 | + |
| 34 | + {# Page description #} |
| 35 | + <div class="description"> |
| 36 | + {%- if metadata.description -%} |
| 37 | + {{ metadata.description }} |
| 38 | + {%- endif -%} |
| 39 | + </div> |
54 | 40 |
|
55 |
| - <ul class="pure-menu-list"> |
56 |
| - {# The partial path of the crate, `:name/:release` #} |
57 |
| - {%- set crate_path = metadata.name ~ "/" ~ metadata.version -%} |
58 | 41 |
|
59 |
| - {# If docs are built, show a tab for them #} |
60 |
| - {%- if metadata.rustdoc_status -%} |
61 |
| - <li class="pure-menu-item"> |
62 |
| - {# The docs tab redirects to the docs, so the tab will never be selected and seen #} |
63 |
| - <a href="/{{ crate_path | safe }}/{{ metadata.target_name }}/" class="pure-menu-link"> |
64 |
| - {{ "book" | fas(fw=true) }} |
65 |
| - <span class="title"> Documentation</span> |
66 |
| - </a> |
67 |
| - </li> |
| 42 | + <div class="pure-menu pure-menu-horizontal"> |
| 43 | + {# If there are platforms, show a dropdown with them #} |
| 44 | + {%- if platforms -%} |
| 45 | + <ul class="pure-menu-list platforms-menu"> |
| 46 | + <li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover"> |
| 47 | + <a href="#" class="pure-menu-link">Platform</a> |
| 48 | + <ul class="pure-menu-children"> |
| 49 | + {%- for platform in platforms -%} |
| 50 | + <li class="pure-menu-item"> |
| 51 | + <a href="/{{ metadata.name }}/{{ metadata.version }}/{{ platform }}/{{ metadata.target_name }}/" |
| 52 | + class="pure-menu-link"> |
| 53 | + {{ platform }} |
| 54 | + </a> |
| 55 | + </li> |
| 56 | + {%- endfor -%} |
| 57 | + </ul> |
| 58 | + </li> |
| 59 | + </ul> |
68 | 60 | {%- endif -%}
|
69 | 61 |
|
70 |
| - {# The crate information tab #} |
71 |
| - <li class="pure-menu-item"><a href="/crate/{{ crate_path | safe }}" |
72 |
| - class="pure-menu-link{% if active_tab == 'crate' %} pure-menu-active{% endif %}"> |
73 |
| - {{ "cube" | fas(fw=true) }} |
74 |
| - <span class="title"> Crate</span> |
75 |
| - </a> |
76 |
| - </li> |
| 62 | + <ul class="pure-menu-list"> |
| 63 | + {# The crate information tab #} |
| 64 | + <li class="pure-menu-item"><a href="/crate/{{ crate_path | safe }}" |
| 65 | + class="pure-menu-link{% if active_tab == 'crate' %} pure-menu-active{% endif %}"> |
| 66 | + {{ "cube" | fas(fw=true) }} |
| 67 | + <span class="title"> Crate</span> |
| 68 | + </a> |
| 69 | + </li> |
77 | 70 |
|
78 |
| - {# The source view tab #} |
79 |
| - <li class="pure-menu-item"> |
80 |
| - <a href="/crate/{{ crate_path | safe }}/source/" |
81 |
| - class="pure-menu-link{% if active_tab == 'source' %} pure-menu-active{% endif %}"> |
82 |
| - {{ "folder-open" | far(fw=true) }} |
83 |
| - <span class="title"> Source</span> |
84 |
| - </a> |
85 |
| - </li> |
| 71 | + {# The source view tab #} |
| 72 | + <li class="pure-menu-item"> |
| 73 | + <a href="/crate/{{ crate_path | safe }}/source/" |
| 74 | + class="pure-menu-link{% if active_tab == 'source' %} pure-menu-active{% endif %}"> |
| 75 | + {{ "folder-open" | far(fw=true) }} |
| 76 | + <span class="title"> Source</span> |
| 77 | + </a> |
| 78 | + </li> |
86 | 79 |
|
87 |
| - {# The builds tab #} |
88 |
| - <li class="pure-menu-item"> |
89 |
| - <a href="/crate/{{ crate_path | safe }}/builds" |
90 |
| - class="pure-menu-link{% if active_tab == 'builds' %} pure-menu-active{% endif %}"> |
91 |
| - {{ "cogs" | fas }} |
92 |
| - <span class="title"> Builds</span> |
93 |
| - </a> |
94 |
| - </li> |
95 |
| - </ul> |
| 80 | + {# The builds tab #} |
| 81 | + <li class="pure-menu-item"> |
| 82 | + <a href="/crate/{{ crate_path | safe }}/builds" |
| 83 | + class="pure-menu-link{% if active_tab == 'builds' %} pure-menu-active{% endif %}"> |
| 84 | + {{ "cogs" | fas }} |
| 85 | + <span class="title"> Builds</span> |
| 86 | + </a> |
| 87 | + </li> |
| 88 | + </ul> |
| 89 | + </div> |
96 | 90 | </div>
|
| 91 | + |
| 92 | + {%- if metadata.rustdoc_status -%} |
| 93 | + <a href="/{{ crate_path | safe }}/{{ metadata.target_name }}/" class="doc-link"> |
| 94 | + {{ "book" | fas(fw=true) }} Documentation |
| 95 | + </a> |
| 96 | + {%- endif -%} |
97 | 97 | </div>
|
98 | 98 | </div>
|
99 | 99 | {% endmacro package_navigation %}
|
0 commit comments