Skip to content

Commit

Permalink
update link icons
Browse files Browse the repository at this point in the history
  • Loading branch information
sheridar committed Feb 25, 2024
1 parent dfff5e8 commit b5c9d52
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 35 deletions.
2 changes: 1 addition & 1 deletion atlases/2021-carpentier-34618370/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: MARCO+ lymphatic endothelial cells sequester arthritogenic alphaviruses to limit viremia and viral dissemination

image: /images/2021-carpentier-34618370.jpg
subtitle: '[Atlas](https://morrison-lnsc-browser.s3.amazonaws.com/index.html){.link-box-large}'
subtitle: '[<i class="bi bi-compass"></i> Atlas](https://morrison-lnsc-browser.s3.amazonaws.com/index.html){.link-box-large}'
date: 'November 15, 2021'
categories: [Project-1, Project-2, Core-C, Core-D, 2021]
about:
Expand Down
2 changes: 1 addition & 1 deletion atlases/2021-walsh-33843587/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Molecular tracking devices quantify antigen distribution and archiving in the murine lymph node

image: /images/2021-walsh-33843587.jpg
subtitle: '[Atlas](https://d3898ys7yh3545.cloudfront.net/){.link-box-large}'
subtitle: '[<i class="bi bi-compass"></i> Atlas](https://d3898ys7yh3545.cloudfront.net/){.link-box-large}'
date: 'April 12, 2021'
categories: [Project-2, Core-C, Core-D, 2021]
about:
Expand Down
2 changes: 1 addition & 1 deletion atlases/2024-lucas-38194268/index.qmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Chikungunya virus infection disrupts lymph node lymphatic endothelial cell composition and function via MARCO

subtitle: '[Atlas](https://morrison-lnsc-browser.s3.amazonaws.com/index.html){.link-box-large}'
subtitle: '[<i class="bi bi-compass"></i> Atlas](https://morrison-lnsc-browser.s3.amazonaws.com/index.html){.link-box-large}'
date: 'January 09, 2024'
categories: [Project-1, Project-2, Core-C, Core-D, 2024]
about:
Expand Down
47 changes: 39 additions & 8 deletions funs.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Create links for a project
#' Create links for a project section
#'
#' links to atlases, publications, investigators
.create_project_links <- function(proj_yml, athr_yml, pub_yml, lnk_cls) {
Expand Down Expand Up @@ -34,7 +34,8 @@

if (any(pubs)) {
lnks <- str_c(
lnks, " [Publications](pubs.qmd#category=", proj_lnk, ")",
lnks, " [<i class='bi bi-file-earmark'></i> Publications]",
"(pubs.qmd#category=", proj_lnk, ")",
lnk_cls
)
}
Expand All @@ -45,7 +46,8 @@

if (any(atlases)) {
lnks <- str_c(
lnks, " [Atlases](atlases.qmd#category=", proj_lnk, ")",
lnks, " [<i class='bi bi-compass'></i> Atlases]",
"(atlases.qmd#category=", proj_lnk, ")",
lnk_cls
)
}
Expand All @@ -60,17 +62,45 @@
#'
#' links to the project page
.create_project_link <- function(proj_title, lnk_name = proj_title,
lnk_cls = "{.link-bold}", max_len = 64) {
lnk_cls = "{.link-bold}", max_len = 40,
return_id = FALSE) {
res <- proj_title %>%
str_to_lower() %>%
str_replace_all("( |, )", "-") %>%
str_trunc(max_len, "right", ellipsis = "") %>%
str_remove("-$") %>%
str_remove("-$")

if (return_id) return(res)

res <- res %>%
str_c("[", lnk_name, "](projects.qmd#", ., ")", lnk_cls)

res
}

#' Add icon to link
.icon_key <- list(
publications = "bi bi-file-earmark",
atlases = "bi bi-compass",
atlas = "bi bi-compass",
email = "bi bi-envelope",
website = "bi bi-house"
# website = "bi bi-globe"
)

.add_link_icon <- function(lnk_text, icon_key = .icon_key) {

icon <- .icon_key[[lnk_text]]

if (!is.null(icon)) icon <- str_c("<i class='", icon, "'></i> ")

res <- lnk_text %>%
str_to_title() %>%
str_c("[", icon, ., "]")

res
}

#' Create publication page
#'
#' * Check publication information and scrape missing information from pubmed
Expand Down Expand Up @@ -133,9 +163,10 @@
return(NULL)
}

subttl <- links %>%
pluck("atlas") %>%
str_c("[Atlas](", ., "){.link-box-large}")
subttl <- links %>% # use double quotes single subtitle will be wrapped
pluck("atlas") %>% # in single quotes
str_c(.add_link_icon("atlas"), "(", ., "){.link-box-large}") %>%
str_replace_all("'", "\\\"")

links <- links[names(links) != "atlas"]
}
Expand Down
17 changes: 6 additions & 11 deletions investigators.qmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: "Investigators"
toc: true
---

```{r, echo = FALSE, include = FALSE}
Expand Down Expand Up @@ -29,12 +28,13 @@ proj_lnks <- proj_yml %>%
imap(~ .create_project_link(.x$title, str_to_title(.y), "{.link-box-fade}"))
# Create page text
# unable to include table of contents and have the image inline with heading
text <- athr_yml %>%
imap(~ {
lnks <- .x$links %>% # links to project pages
imap(~ str_c("[", str_to_title(.y), "](", .x, ")", lnk_cls)) %>%
imap(~ str_c(.add_link_icon(.y), "(", .x, ")", lnk_cls)) %>%
str_c(collapse = " ")
lnks <- proj_lnks[.x$project] %>%
str_c(collapse = " ") %>%
str_c(lnks, " ", .)
Expand All @@ -45,8 +45,8 @@ text <- athr_yml %>%
res <- str_c(
"<h2>", .y, sfx, "</h2>\n\n",
lnks, "\n\n",
.x$bio, "\n\n"
lnks, "\n\n",
.x$bio, "\n\n"
)
# Add image for each investigator
Expand All @@ -58,12 +58,7 @@ text <- athr_yml %>%
" <img src='", img, "'>\n"
)
html_foot <- "</div>"
res <- str_c(
html_head, res,
html_foot, "\n\n"
)
res <- str_c(html_head, res, "</div>\n\n")
}
res
Expand Down
6 changes: 5 additions & 1 deletion pre-build.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,13 @@ tl_dat <- tl_dat %>%
mutate(
pmid = str_remove(pmid, "/$"),
pmid = str_c("PMID", pmid),
lab = str_c(proj, "\n", pmid),
year = as.character(year(date)),
url = file.path(pub_dir, key)
) %>%
pivot_longer(c(proj, pmid), values_to = "lab") %>%
mutate(
style = ifelse(name == "pmid", "bold", "normal"),
style = map(style, ~ list(`font-weight` = .x))
)

# Save as json file
Expand Down
12 changes: 8 additions & 4 deletions projects.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ toc: true
library(yaml)
library(tidyverse)
library(here)
source(here("funs.R"))
# Read yamls
Expand Down Expand Up @@ -39,10 +38,15 @@ text <- proj_yml %>%
# Conditional add hypothesis
hyp <- .x$hypothesis
if (!is.null(hyp)) hyp <- str_c("*", hyp, "*\n\n")
if (!is.null(hyp)) hyp <- str_c("<i>", hyp, "</i>\n\n")
# Set heading IDs
# need this since the first h2 heading ID after h1 gets mixed up during
# rendering
id <- .create_project_link(.x$title, return_id = TRUE)
res <- str_c(
"<h2>", .x$title, "</h2>\n\n",
"<h2 id=", id, ">", .x$title, "</h2>\n\n",
links[[.y]], "\n\n",
hyp
)
Expand All @@ -65,7 +69,7 @@ text <- proj_yml %>%
body <- str_c(
"<div class='project-image'>\n",
" <img src='", img, "'>\n",
body, "\n\n",
body, "\n",
"</div>"
)
}
Expand Down
3 changes: 2 additions & 1 deletion pubs.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ file.copy("timeline.json", "_site")
.mapping({
'timestamp': 'year',
'text': 'lab',
'url': 'url'
'url': 'url',
'textStyle': 'style'
})
.parseTime('%Y')
.aggregateBy('year')
Expand Down
13 changes: 7 additions & 6 deletions theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ div.sidebar-item-container .active, div.sidebar-item-container .show>.nav-link,
}

.link-box-large {
display: inline-block; // Ensures the box wraps the content
text-decoration: none; // Removes the underline from the link
display: inline-block; // Ensures the box wraps the content
text-decoration: none; // Removes the underline from the link
color: $link-color;
border: 1px solid $link-color;
border-radius: 5px; // Rounded corners; adjust radius as needed
padding: 0px 8px; // Padding inside box around the text
border-radius: 7px; // Rounded corners; adjust radius as needed
padding: 0.125rem 0.25rem; // Padding inside box around the text
margin: 1.5px;
margin-top: 5px;
margin-bottom: 5px;
Expand All @@ -74,6 +74,7 @@ div.sidebar-item-container .active, div.sidebar-item-container .show>.nav-link,
.link-box {
@extend .link-box-large;
font-size: 0.8rem;
border-radius: 0.25rem;
}

.link-box-fade {
Expand Down Expand Up @@ -153,7 +154,7 @@ p.subtitle {

// Timeline
#timeline {
margin-right: 80px;
margin-right: 100px;
margin-bottom: 50px;
}

Expand All @@ -180,5 +181,5 @@ p.subtitle {

.milestones-label.milestones-link-label {
@extend .link-bw;
font-size: 0.75rem !important;
font-size: 0.65rem !important;
}
2 changes: 1 addition & 1 deletion timeline.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"key":"2021-walsh-33843587","date":"2021-01-01","proj":"Project-2, Core-C, Core-D","authors":"Sheridan, Hesselberth, Tamburini","pmid":"PMID33843587","lab":"Project-2, Core-C, Core-D\nPMID33843587","year":"2021","url":"pubs/2021-walsh-33843587"},{"key":"2017-kedl-29229919","date":"2017-01-01","proj":"Project-2","authors":"Tamburini","pmid":"PMID29229919","lab":"Project-2\nPMID29229919","year":"2017","url":"pubs/2017-kedl-29229919"},{"key":"2021-carpentier-34618370","date":"2021-01-01","proj":"Project-1, Project-2, Core-C, Core-D","authors":"Sheridan, Tamburini, Hesselberth, Morrison","pmid":"PMID34618370","lab":"Project-1, Project-2, Core-C, Core-D\nPMID34618370","year":"2021","url":"pubs/2021-carpentier-34618370"},{"key":"2022-doan-35505125","date":"2022-01-01","proj":"Project-2","authors":"Tamburini","pmid":"PMID35505125","lab":"Project-2\nPMID35505125","year":"2022","url":"pubs/2022-doan-35505125"},{"key":"2024-lucas-38194268","date":"2024-01-01","proj":"Project-1, Project-2, Core-C, Core-D","authors":"Sheridan, Hesselberth, Tamburini, Morrison","pmid":"PMID38194268","lab":"Project-1, Project-2, Core-C, Core-D\nPMID38194268","year":"2024","url":"pubs/2024-lucas-38194268"},{"key":"2018-mccarthy-29997290","date":"2018-01-01","proj":"Project-1, Project-2","authors":"Tamburini, Morrison","pmid":"PMID29997290","lab":"Project-1, Project-2\nPMID29997290","year":"2018","url":"pubs/2018-mccarthy-29997290"},{"key":"2018-lucas-30045970","date":"2018-01-01","proj":"Project-1, Project-2","authors":"Morrison, Tamburini","pmid":"PMID30045970","lab":"Project-1, Project-2\nPMID30045970","year":"2018","url":"pubs/2018-lucas-30045970"},{"key":"2019-tamburini-31156626","date":"2019-01-01","proj":"Project-2, Core-C, Core-D","authors":"Tamburini, Hesselberth","pmid":"PMID31156626","lab":"Project-2, Core-C, Core-D\nPMID31156626","year":"2019","url":"pubs/2019-tamburini-31156626"},{"key":"2020-lucas-33053342","date":"2020-01-01","proj":"Project-2, Core-B","authors":"Matsuda, Tamburini","pmid":"PMID33053342","lab":"Project-2, Core-B\nPMID33053342","year":"2020","url":"pubs/2020-lucas-33053342"},{"key":"2023-tamburini-37841845","date":"2023-01-01","proj":"Project-1, Project-2, Core-C, Core-D","authors":"Tamburini, Hesselberth, Morrison","pmid":"PMID37841845","lab":"Project-1, Project-2, Core-C, Core-D\nPMID37841845","year":"2023","url":"pubs/2023-tamburini-37841845"},{"key":"2024-kim-38307020","date":"2024-01-01","proj":"Project-1, Core-B","authors":"Morrison, Matsuda","pmid":"PMID38307020","lab":"Project-1, Core-B\nPMID38307020","year":"2024","url":"pubs/2024-kim-38307020"},{"key":"2014-tamburini-24905362","date":"2014-01-01","proj":"Project-2","authors":"Tamburini","pmid":"PMID24905362","lab":"Project-2\nPMID24905362","year":"2014","url":"pubs/2014-tamburini-24905362"}]
[{"key":"2021-walsh-33843587","date":"2021-01-01","authors":"Sheridan, Hesselberth, Tamburini","year":"2021","url":"pubs/2021-walsh-33843587","name":"proj","lab":"Project-2, Core-C, Core-D","style":{"font-weight":["normal"]}},{"key":"2021-walsh-33843587","date":"2021-01-01","authors":"Sheridan, Hesselberth, Tamburini","year":"2021","url":"pubs/2021-walsh-33843587","name":"pmid","lab":"PMID33843587","style":{"font-weight":["bold"]}},{"key":"2017-kedl-29229919","date":"2017-01-01","authors":"Tamburini","year":"2017","url":"pubs/2017-kedl-29229919","name":"proj","lab":"Project-2","style":{"font-weight":["normal"]}},{"key":"2017-kedl-29229919","date":"2017-01-01","authors":"Tamburini","year":"2017","url":"pubs/2017-kedl-29229919","name":"pmid","lab":"PMID29229919","style":{"font-weight":["bold"]}},{"key":"2021-carpentier-34618370","date":"2021-01-01","authors":"Sheridan, Tamburini, Hesselberth, Morrison","year":"2021","url":"pubs/2021-carpentier-34618370","name":"proj","lab":"Project-1, Project-2, Core-C, Core-D","style":{"font-weight":["normal"]}},{"key":"2021-carpentier-34618370","date":"2021-01-01","authors":"Sheridan, Tamburini, Hesselberth, Morrison","year":"2021","url":"pubs/2021-carpentier-34618370","name":"pmid","lab":"PMID34618370","style":{"font-weight":["bold"]}},{"key":"2022-doan-35505125","date":"2022-01-01","authors":"Tamburini","year":"2022","url":"pubs/2022-doan-35505125","name":"proj","lab":"Project-2","style":{"font-weight":["normal"]}},{"key":"2022-doan-35505125","date":"2022-01-01","authors":"Tamburini","year":"2022","url":"pubs/2022-doan-35505125","name":"pmid","lab":"PMID35505125","style":{"font-weight":["bold"]}},{"key":"2024-lucas-38194268","date":"2024-01-01","authors":"Sheridan, Hesselberth, Tamburini, Morrison","year":"2024","url":"pubs/2024-lucas-38194268","name":"proj","lab":"Project-1, Project-2, Core-C, Core-D","style":{"font-weight":["normal"]}},{"key":"2024-lucas-38194268","date":"2024-01-01","authors":"Sheridan, Hesselberth, Tamburini, Morrison","year":"2024","url":"pubs/2024-lucas-38194268","name":"pmid","lab":"PMID38194268","style":{"font-weight":["bold"]}},{"key":"2018-mccarthy-29997290","date":"2018-01-01","authors":"Tamburini, Morrison","year":"2018","url":"pubs/2018-mccarthy-29997290","name":"proj","lab":"Project-1, Project-2","style":{"font-weight":["normal"]}},{"key":"2018-mccarthy-29997290","date":"2018-01-01","authors":"Tamburini, Morrison","year":"2018","url":"pubs/2018-mccarthy-29997290","name":"pmid","lab":"PMID29997290","style":{"font-weight":["bold"]}},{"key":"2018-lucas-30045970","date":"2018-01-01","authors":"Morrison, Tamburini","year":"2018","url":"pubs/2018-lucas-30045970","name":"proj","lab":"Project-1, Project-2","style":{"font-weight":["normal"]}},{"key":"2018-lucas-30045970","date":"2018-01-01","authors":"Morrison, Tamburini","year":"2018","url":"pubs/2018-lucas-30045970","name":"pmid","lab":"PMID30045970","style":{"font-weight":["bold"]}},{"key":"2019-tamburini-31156626","date":"2019-01-01","authors":"Tamburini, Hesselberth","year":"2019","url":"pubs/2019-tamburini-31156626","name":"proj","lab":"Project-2, Core-C, Core-D","style":{"font-weight":["normal"]}},{"key":"2019-tamburini-31156626","date":"2019-01-01","authors":"Tamburini, Hesselberth","year":"2019","url":"pubs/2019-tamburini-31156626","name":"pmid","lab":"PMID31156626","style":{"font-weight":["bold"]}},{"key":"2020-lucas-33053342","date":"2020-01-01","authors":"Matsuda, Tamburini","year":"2020","url":"pubs/2020-lucas-33053342","name":"proj","lab":"Project-2, Core-B","style":{"font-weight":["normal"]}},{"key":"2020-lucas-33053342","date":"2020-01-01","authors":"Matsuda, Tamburini","year":"2020","url":"pubs/2020-lucas-33053342","name":"pmid","lab":"PMID33053342","style":{"font-weight":["bold"]}},{"key":"2023-tamburini-37841845","date":"2023-01-01","authors":"Tamburini, Hesselberth, Morrison","year":"2023","url":"pubs/2023-tamburini-37841845","name":"proj","lab":"Project-1, Project-2, Core-C, Core-D","style":{"font-weight":["normal"]}},{"key":"2023-tamburini-37841845","date":"2023-01-01","authors":"Tamburini, Hesselberth, Morrison","year":"2023","url":"pubs/2023-tamburini-37841845","name":"pmid","lab":"PMID37841845","style":{"font-weight":["bold"]}},{"key":"2024-kim-38307020","date":"2024-01-01","authors":"Morrison, Matsuda","year":"2024","url":"pubs/2024-kim-38307020","name":"proj","lab":"Project-1, Core-B","style":{"font-weight":["normal"]}},{"key":"2024-kim-38307020","date":"2024-01-01","authors":"Morrison, Matsuda","year":"2024","url":"pubs/2024-kim-38307020","name":"pmid","lab":"PMID38307020","style":{"font-weight":["bold"]}},{"key":"2014-tamburini-24905362","date":"2014-01-01","authors":"Tamburini","year":"2014","url":"pubs/2014-tamburini-24905362","name":"proj","lab":"Project-2","style":{"font-weight":["normal"]}},{"key":"2014-tamburini-24905362","date":"2014-01-01","authors":"Tamburini","year":"2014","url":"pubs/2014-tamburini-24905362","name":"pmid","lab":"PMID24905362","style":{"font-weight":["bold"]}}]

0 comments on commit b5c9d52

Please sign in to comment.