|
1 | | -{% assign page_tag = page.tag[0] %} |
2 | | -{% assign data = site.uw-research-computing | where_exp: "x", "x.tag contains page.tag" | sort: "category" %} |
3 | | -{% assign category_order = "Get started,Submit jobs,Manage data,Software,Workflows,Special use cases,Troubleshooting,External Resources" | split: "," %} |
4 | | - |
5 | | - <div id="guide-sidebar"> |
6 | | - {% if page.guide.tag contains 'htc' and page.guide.tag contains 'hpc' %} |
7 | | - {% assign general_pages = site.uw-research-computing | where_exp: "x", "x.guide.tag contains 'htc'" | where_exp: "x", "x.guide.tag contains 'hpc'" | sort: "category" %} |
8 | | - |
9 | | - {% assign categories = "" | split: "" %} |
10 | | - {% for page in general_pages %} |
11 | | - {% unless categories contains page.guide.category %} |
12 | | - {% assign categories = categories | push: page.guide.category %} |
13 | | - {% endunless %} |
14 | | - {% endfor %} |
15 | | - |
16 | | - <h6 class="mt-5">General Guides</h6> |
17 | | - <div class="accordion accordion-flush"> |
18 | | - {% for category in category_order %} |
19 | | - {% if categories contains category %} |
20 | | - {% assign pages_in_category = general_pages | where_exp: "x", "x.guide.category == category" | sort: "guide.order" %} |
21 | | - |
22 | | - {% assign active = pages_in_category | where_exp: "x", "x.url == page.url" %} |
23 | | - |
24 | | - <div class="accordion-item"> |
25 | | - <span class="accordion-header mt-0" id="{{ category | slugify }}"> |
26 | | - <button class="accordion-button {% unless active.size == 1 %}collapsed {% endunless %}" type="button" data-bs-toggle="collapse" data-bs-target="#{{ category | slugify }}-collapse" aria-expanded="false" aria-controls="{{ category | slugify }}"> |
27 | | - {{ category }} |
28 | | - </button> |
29 | | - </span> |
30 | | - <div id="{{ category | slugify }}-collapse" class="accordion-collapse collapse {% if active.size == 1 %}show {% endif %}" aria-labelledby="{{ category | slugify }}" data-bs-parent="#guide-sidebar"> |
31 | | - {% for page in pages_in_category %} |
32 | | - |
33 | | - <div class="document-link-wrapper bg-light"> |
34 | | - <a class="{% if active[0].url == page.url %}fw-bolder{% endif %}" href="{{ page.url | relative_url }}">{{ page.title }}</a> |
35 | | - </div> |
36 | | - {% endfor %} |
37 | | - </div> |
38 | | - </div> |
39 | | - {% endif %} |
40 | | - {% endfor %} |
41 | | - </div> |
| 1 | +{% assign htc_menu = site.data.htc-guide-menu %} |
| 2 | +{% assign hpc_menu = site.data.hpc-guide-menu %} |
| 3 | +{% assign active = page.url %} |
| 4 | + |
| 5 | +{% if page.guide.tag contains "htc" and page.guide.tag contains "hpc" %} |
| 6 | + {% assign show_guide = "HTC guides,HPC guides" | split: ',' %} |
| 7 | + {% assign collapse_guides = "accordion-header" %} |
| 8 | +{% elsif page.guide.tag contains "htc" %} |
| 9 | + {% assign show_guide = "HTC guides" %} |
| 10 | +{% elsif page.guide.tag contains "hpc" %} |
| 11 | + {% assign show_guide = "HPC guides" %} |
| 12 | +{% endif %} |
| 13 | +<div id="guide-sidebar"> |
| 14 | + {% for item in show_guide %} |
| 15 | + {% if show_guide.first %} |
| 16 | + <h6 class="mt-5">{{ item }}</h6> |
| 17 | + {% else %} |
| 18 | + <h6 class="mt-5">{{ item }}</h6> |
42 | 19 | {% endif %} |
43 | | - {% if page.guide.tag contains 'htc' %} |
44 | | - {% assign htc_pages = site.uw-research-computing | where_exp: "x", "x.guide.tag contains 'htc'" | sort: "category" %} |
45 | | - |
46 | | - {% assign categories = "" | split: "" %} |
47 | | - {% for page in htc_pages %} |
48 | | - {% unless categories contains page.guide.category %} |
49 | | - {% assign categories = categories | push: page.guide.category %} |
50 | | - {% endunless %} |
51 | | - {% endfor %} |
52 | | - |
53 | | - <h6 class="mt-5">HTC Guides</h6> |
54 | | - <div class="accordion accordion-flush"> |
55 | | - {% for category in category_order %} |
56 | | - {% if categories contains category %} |
57 | | - |
58 | | - {% assign pages_in_category = htc_pages | where_exp: "x", "x.guide.category == category" | sort: "guide.order" %} |
59 | | - |
60 | | - {% assign active = pages_in_category | where_exp: "x", "x.url == page.url" %} |
61 | | - {% if page.guide.tag contains 'htc' and page.guide.tag contains 'hpc' %} |
62 | | - {% assign active = "" | split: "" %} |
63 | | - {% endif %} |
64 | | - |
65 | | - <div class="accordion-item"> |
66 | | - <span class="accordion-header mt-0" id="{{ category | slugify }}-htc"> |
67 | | - <button class="accordion-button {% unless active.size == 1 %}collapsed {% endunless %}" type="button" data-bs-toggle="collapse" data-bs-target="#{{ category | slugify }}-htc-collapse" aria-expanded="false" aria-controls="{{ category | slugify }}-htc"> |
68 | | - {{ category }} |
69 | | - </button> |
70 | | - </span> |
71 | | - <div id="{{ category | slugify }}-htc-collapse" class="accordion-collapse collapse {% if active.size == 1 %}show {% endif %}" aria-labelledby="{{ category | slugify }}-htc" data-bs-parent="#guide-sidebar"> |
72 | | - {% for page in pages_in_category %} |
73 | | - |
74 | | - <div class="document-link-wrapper bg-light"> |
75 | | - <a class="{% if active[0].url == page.url %}fw-bolder{% endif %}" href="{{ page.url | relative_url }}">{{ page.title }}</a> |
76 | | - </div> |
77 | | - {% endfor %} |
78 | | - </div> |
79 | | - </div> |
80 | | - {% endif %} |
81 | | - {% endfor %} |
82 | | - </div> |
| 20 | + {% if item == "HTC guides" %} |
| 21 | + {% assign menu = htc_menu %} |
| 22 | + {% elsif item == "HPC guides" %} |
| 23 | + {% assign menu = hpc_menu %} |
83 | 24 | {% endif %} |
84 | | - {% if page.guide.tag contains 'hpc' %} |
85 | | - {% assign hpc_pages = site.uw-research-computing | where_exp: "x", "x.guide.tag contains 'hpc'" | sort: "category" %} |
86 | | - |
87 | | - {% assign categories = "" | split: "" %} |
88 | | - {% for page in hpc_pages %} |
89 | | - {% unless categories contains page.guide.category %} |
90 | | - {% assign categories = categories | push: page.guide.category %} |
91 | | - {% endunless %} |
92 | | - {% endfor %} |
93 | | - |
94 | | - <h6 class="mt-5">HPC Guides</h6> |
95 | | - <div class="accordion accordion-flush"> |
96 | | - {% for category in category_order %} |
97 | | - {% if categories contains category %} |
98 | | - |
99 | | - {% assign pages_in_category = hpc_pages | where_exp: "x", "x.guide.category == category" | sort: "guide.order" %} |
100 | | - |
101 | | - {% assign active = pages_in_category | where_exp: "x", "x.url == page.url" %} |
102 | | - {% if page.guide.tag contains 'htc' and page.guide.tag contains 'hpc' %} |
103 | | - {% assign active = "" | split: "" %} |
104 | | - {% endif %} |
105 | | - |
106 | | - <div class="accordion-item"> |
107 | | - <span class="accordion-header mt-0" id="{{ category | slugify }}-hpc"> |
108 | | - <button class="accordion-button {% unless active.size == 1 %}collapsed {% endunless %}" type="button" data-bs-toggle="collapse" data-bs-target="#{{ category | slugify }}-hpc-collapse" aria-expanded="false" aria-controls="{{ category | slugify }}-hpc"> |
109 | | - {{ category }} |
110 | | - </button> |
111 | | - </span> |
112 | | - <div id="{{ category | slugify }}-hpc-collapse" class="accordion-collapse collapse {% if active.size == 1 %}show {% endif %}" aria-labelledby="{{ category | slugify }}-hpc" data-bs-parent="#guide-sidebar"> |
113 | | - {% for page in pages_in_category %} |
114 | | - |
115 | | - <div class="document-link-wrapper bg-light"> |
116 | | - <a class="{% if active[0].url == page.url %}fw-bolder{% endif %}" href="{{ page.url | relative_url }}">{{ page.title }}</a> |
117 | | - </div> |
118 | | - {% endfor %} |
119 | | - </div> |
| 25 | + <div class="accordion accordion-flush"> |
| 26 | + {% for categories in menu %} |
| 27 | + {% assign category = categories.text %} |
| 28 | + <div class="accordion-item"> |
| 29 | + {% assign id = category | append: item %} |
| 30 | + <span class="accordion-header mt-0" id="{{ id | slugify }}"> |
| 31 | + <button class="accordion-button {% unless active.size == 1 %}collapsed {% endunless %}" type="button" data-bs-toggle="collapse" data-bs-target="#{{ id | slugify }}-collapse" aria-expanded="false" aria-controls="{{ id | slugify }}"> |
| 32 | + {{ category }} |
| 33 | + </button> |
| 34 | + </span> |
| 35 | + <div id="{{ id | slugify }}-collapse" class="accordion-collapse collapse" aria-labelledby="{{ id | slugify }}" data-bs-parent="#guide-sidebar"> |
| 36 | + {% for link in categories.links %} |
| 37 | + {% include components/sidebar-guide-links.liquid %} |
| 38 | + {% endfor %} |
120 | 39 | </div> |
121 | | - {% endif %} |
122 | | - {% endfor %} |
123 | | - </div> |
124 | | - {% endif %} |
125 | | - </div> |
| 40 | + </div> |
| 41 | + {% endfor %} |
| 42 | + </div> |
| 43 | + {% endfor %} |
| 44 | +</div> |
| 45 | +<script> |
| 46 | + // Set the height of the sidebar to fill the viewport minus the height of the main content area |
| 47 | + const updateSidebarHeight = () => { |
| 48 | + const navHeight = document.getElementById("navbar").clientHeight; |
| 49 | + console.log(navHeight, window.innerHeight - navHeight); |
| 50 | + document.getElementById("guide-sidebar").style.height = `${window.innerHeight - navHeight}px`; |
| 51 | + }; |
| 52 | +
|
| 53 | + // Initial call to set the sidebar height |
| 54 | + updateSidebarHeight(); |
| 55 | + // Add event listener to update the sidebar height on window resize |
| 56 | + window.addEventListener("resize", updateSidebarHeight); |
| 57 | +</script> |
126 | 58 |
|
127 | 59 |
|
0 commit comments