Skip to content

Commit 53cbac8

Browse files
erogluorhananissa111pre-commit-ci[bot]
authored
Start using the updated theme (#418)
* Use cookbook-actions from feature branch * Update deploy job's branch from main to try_updated_theme * Update environment.yml * Fix logo_link warning * Fix html_tehem_options * Fix google analytics config and cookoff post image * Fix navbar logo and icons * Update configs to use the updated theme * Update environment.yml * Fix linkcheck * Update conf.py and custom.css to use the new theme * Start using 100% page width for navbar and center content per discussion * Update environment.yml * Update nightly-build.yaml * Update publish-site.yaml * Update environment.yml * Update nightly-build.yaml * Trying an alternative yaml to MD parsing * Update environment.yml * Update environment.yml * Similar gallery generation for try_updated_theme (#417) * similar galery * similar gallery w/ pre-commit * remove test print statement * use theme color * Update environment.yml to have sphinx_design installed with theme source for now --------- Co-authored-by: Orhan Eroglu <[email protected]> * Update environment.yml * Refactor gallery_generator.py and remove forgotten single quotes * Indentation fix and dependency removal * StackOverFlow link * Update environment.yml * Update environment.yml * Update environment.yml * Update environment.yml * Update nightly-build.yaml * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Anissa Zacharias <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 367d802 commit 53cbac8

9 files changed

+111
-84
lines changed

CODEOFCONDUCT.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ Instances of unacceptable behavior can be brought to the attention of the projec
4747

4848
## Consequences
4949

50-
Upon receipt of a complaint, the project administrator(s) may take any action deemed necessary and appropriate under the circumstances. Such action can include things such as: removing, editing, or rejecting comments, commits, code, wiki edits, email, issues, and other contributions that are not aligned to this Code of Conduct, or banning temporarily or permanently any contributor for other behaviors that are deemed inappropriate, threatening, offensive, or harmful. Project administrators also have the right to report violations to UCAR HR and/or UCAR’s Office of Diversity, Equity and Inclusion (ODEI), as well as a participant’s home institution and/or law enforcement. In the event an incident is reported to UCAR, UCAR will follow its Harassment Reporting and Complaint Procedure.
50+
Upon receipt of a complaint, the project administrator(s) may take any action deemed necessary and appropriate under the circumstances. Such action can include things such as: removing, editing, or rejecting comments, commits, code, wiki edits, email, issues, and other contributions that are not
51+
aligned to this Code of Conduct, or banning temporarily or permanently any contributor for other behaviors that are deemed inappropriate, threatening, offensive, or harmful. Project administrators also have the right to report violations to UCAR HR and/or UCAR’s Office of Diversity, Equity and Inclusion (ODEI), as well as a participant’s home institution and/or law enforcement. In the event an incident is reported to UCAR, UCAR will follow its Harassment Reporting and Complaint Procedure.
5152

5253
## Attribution
5354

environment.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ channels:
33
- conda-forge
44
- nodefaults
55
dependencies:
6+
- ablog
67
- matplotlib
78
- myst-nb
89
- pandas
9-
- pip
10-
- pyyaml
1110
- pre-commit
12-
- sphinx-panels
13-
- ablog
14-
- pip:
15-
- sphinx-pythia-theme
11+
- pyyaml
12+
- sphinx-pythia-theme

portal/_extensions/gallery_generator.py

+61-62
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import itertools
22
import pathlib
3-
from textwrap import dedent
43

54
from truncatehtml import truncate
65

@@ -32,16 +31,16 @@ def _generate_tag_menu(all_items, tag_key):
3231
)
3332

3433
return f"""
35-
<div class="dropdown">
34+
<div class="dropdown">
3635
37-
<button class="btn btn-sm btn-outline-primary mx-1 dropdown-toggle" type="button" id="{tag_key}Dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
38-
{tag_key.title()}
39-
</button>
40-
<ul class="dropdown-menu" aria-labelledby="{tag_key}Dropdown">
41-
{options}
42-
</ul>
43-
</div>
44-
"""
36+
<button class="btn btn-sm btn-outline-primary mx-1 dropdown-toggle" type="button" id="{tag_key}Dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
37+
{tag_key.title()}
38+
</button>
39+
<ul class="dropdown-menu" aria-labelledby="{tag_key}Dropdown">
40+
{options}
41+
</ul>
42+
</div>
43+
"""
4544

4645

4746
def generate_menu(all_items, submit_btn_txt=None, submit_btn_link=None):
@@ -64,18 +63,18 @@ def generate_menu(all_items, submit_btn_txt=None, submit_btn_link=None):
6463

6564
def build_from_items(items, filename, title='Gallery', subtitle=None, subtext=None, menu_html='', max_descr_len=300):
6665
# Build the gallery file
67-
panels_body = []
66+
grid_body = []
6867
for item in items:
6968
if not item.get('thumbnail'):
70-
item['thumbnail'] = '/_static/images/ebp-logo.png'
71-
thumbnail = item['thumbnail']
69+
item['thumbnail'] = '_static/images/ebp-logo.png'
70+
thumbnail = item['thumbnail'][1:] if item['thumbnail'].startswith('/') else item['thumbnail']
7271
tag_list = sorted((itertools.chain(*item['tags'].values())))
7372
tag_list_f = [tag.replace(' ', '-') for tag in tag_list]
7473

7574
tags = [f'<span class="badge bg-primary">{tag}</span>' for tag in tag_list_f]
7675
tags = '\n'.join(tags)
7776

78-
tag_class_str = ' '.join(tag_list_f)
77+
# tag_class_str = ' '.join(tag_list_f)
7978

8079
author_strs = set()
8180
affiliation_strs = set()
@@ -108,69 +107,69 @@ def build_from_items(items, filename, title='Gallery', subtitle=None, subtext=No
108107

109108
if ellipsis_str in short_description:
110109
modal_str = f"""
111-
<div class="modal">
112-
<div class="content">
113-
<img src="{thumbnail}" class="modal-img" />
114-
<h3 class="display-3">{item["title"]}</h3>
115-
{authors_str}
116-
<br/>
117-
{affiliations_str}
118-
<p class="my-2">{item['description']}</p>
119-
<p class="my-2">{tags}</p>
120-
<p class="mt-3 mb-0"><a href="{item["url"]}" class="btn btn-outline-primary btn-block">Visit Website</a></p>
121-
</div>
122-
</div>
123-
"""
110+
<div class="modal">
111+
<div class="content">
112+
<img src="{thumbnail}" class="modal-img" />
113+
<h3 class="display-3">{item["title"]}</h3>
114+
{authors_str}
115+
<br/>
116+
{affiliations_str}
117+
<p class="my-2">{item['description']}</p>
118+
<p class="my-2">{tags}</p>
119+
<p class="mt-3 mb-0"><a href="{item["url"]}" class="btn btn-outline-primary btn-block">Visit Website</a></p>
120+
</div>
121+
</div>
122+
"""
123+
modal_str = '\n'.join([m.lstrip() for m in modal_str.split('\n')])
124124
else:
125125
modal_str = ''
126+
new_card = f"""\
127+
:::{{grid-item-card}}
128+
:shadow: md
129+
:class-footer: card-footer
130+
<div class="d-flex gallery-card">
131+
<img src="{thumbnail}" class="gallery-thumbnail" />
132+
<div class="container">
133+
<a href="{item["url"]}" class="text-decoration-none"><h4 class="display-4 p-0">{item["title"]}</h4></a>
134+
<p class="card-subtitle">{authors_str}<br/>{affiliations_str}</p>
135+
<p class="my-2">{short_description} </p>
136+
</div>
137+
</div>
138+
{modal_str}
126139
127-
panels_body.append(
128-
f"""\
129-
---
130-
:column: + tagged-card {tag_class_str}
140+
+++
131141
132-
<div class="d-flex gallery-card">
133-
<img src="{thumbnail}" class="gallery-thumbnail" />
134-
<div class="container">
135-
<a href="{item["url"]}" class="text-decoration-none"><h4 class="display-4 p-0">{item["title"]}</h4></a>
136-
<p class="card-subtitle">{authors_str}<br/>{affiliations_str}</p>
137-
<p class="my-2">{short_description}</p>
138-
</div>
139-
</div>
140-
{modal_str}
142+
{tags}
141143
142-
+++
144+
:::
143145
144-
{tags}
146+
"""
145147

146-
"""
147-
)
148+
grid_body.append('\n'.join([m.lstrip() for m in new_card.split('\n')]))
148149

149-
panels_body = '\n'.join(panels_body)
150+
grid_body = '\n'.join(grid_body)
150151

151152
stitle = f'#### {subtitle}' if subtitle else ''
152153
stext = subtext if subtext else ''
153154

154-
panels = f"""
155-
# {title}
155+
grid = f"""\
156+
{title}
157+
{'=' * len(title)}
156158
157-
{stitle}
158-
{stext}
159+
{stitle}
160+
{stext}
159161
160-
{menu_html}
162+
{menu_html}
161163
162-
````{{panels}}
163-
:column: col-12
164-
:card: +mb-4 w-100
165-
:header: d-none
166-
:body: p-3 m-0
167-
:footer: p-1
164+
::::{{grid}} 1
165+
:gutter: 4
168166
169-
{dedent(panels_body)}
170-
````
167+
{grid_body}
171168
172-
<div class="modal-backdrop"></div>
173-
<script src="/_static/custom.js"></script>
174-
"""
169+
<div class="modal-backdrop"></div>
170+
<script src="/_static/custom.js"></script>
171+
"""
175172

176-
pathlib.Path(f'{filename}.md').write_text(panels)
173+
grid = '\n'.join([m.lstrip() for m in grid.split('\n')])
174+
175+
pathlib.Path(f'{filename}.md').write_text(grid)

portal/_static/custom.css

+27-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1+
:root {
2+
--pst-color-border: rgba(0, 0, 0, 0.125) !important;
3+
}
4+
5+
.bd-main .bd-content .bd-article-container {
6+
max-width: 100%; /* default is 60em */
7+
}
8+
.bd-page-width {
9+
max-width: 100%; /* default is 88rem */
10+
}
11+
12+
.sd-card-footer {
13+
background: rgba(var(--spt-color-gray-100), 1) !important;
14+
padding: 4px;
15+
}
16+
117
main.banner-main #project-pythia {
218
padding-top: 1rem;
319
padding-bottom: 1rem;
420
}
521

622
main.banner-main #project-pythia p {
7-
font-size: 1.4rem; /* default: 1.25rem */
23+
font-size: 1.4rem; /* default: 1.25rem * /
824
/* font-weight: 700; default: 300 */
925
}
1026

@@ -74,12 +90,22 @@ main.banner-main #project-pythia a.btn-light {
7490
margin: auto 0;
7591
padding: 0;
7692
max-width: 160px;
93+
background: transparent !important;
7794
}
7895

7996
.card-subtitle {
8097
font-size: 0.8rem;
8198
}
8299

100+
.my-2 {
101+
color: inherit;
102+
}
103+
104+
.text-decoration-none {
105+
text-decoration: none;
106+
color: inherit;
107+
}
108+
83109
@media (max-width: 576px) {
84110
.modal {
85111
padding: 2rem;

portal/_static/images/logos/NCAR-contemp-logo-blue.svg

-1
This file was deleted.
Loading

0 commit comments

Comments
 (0)