Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/USGS-VIZLAB/vizlab
Browse files Browse the repository at this point in the history
  • Loading branch information
wdwatkins committed Jul 19, 2018
2 parents e5b1394 + 20bf560 commit 25e7e11
Show file tree
Hide file tree
Showing 26 changed files with 189 additions and 32 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ env:

repos:
CRAN: https://cloud.r-project.org
GRAN: http://owi.usgs.gov/R
GRAN: https://owi.usgs.gov/R

r_packages: devtools

r_github_packages:
- jimhester/covr
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: vizlab
Type: Package
Title: Utilities for building online data visualizations
Version: 0.3.4
Date: 2018-04-24
Version: 0.3.6
Date: 2018-05-24
Author: Jordan Walker, Alison Appling, Lindsay Carr, Luke Winslow, Jordan Read, Laura DeCicco, Marty Wernimont
Maintainer: Alison Appling <[email protected]>
Description: Provides utility functions to organize, develop, and publish
Expand Down
15 changes: 10 additions & 5 deletions R/publish.R
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,16 @@ publish.img <- function(viz) {
alt.text <- viz[['alttext']]
relative.path <- viz[['relpath']]
title.text <- viz[['title']]
img.datasrc <- ifelse(is.null(viz[['data-src']]), "",
paste0(" data-src=\"",
paste0(viz[['data-src']], collapse=" "),
"\""))
img.class <- ifelse(is.null(viz[['class']]), "",
paste0(" class=\"",
paste0(viz[['class']], collapse=" "),
"\""))
html <- sprintf('<img src="%s?_c=%s" alt="%s" title="%s"%s />', relative.path, uniqueness(),
alt.text, title.text, img.class)
html <- sprintf('<img src="%s?_c=%s" alt="%s" title="%s"%s%s />', relative.path, uniqueness(),
alt.text, title.text, img.datasrc, img.class)
}
return(html)
}
Expand Down Expand Up @@ -456,12 +460,13 @@ publish.header <- function(viz) {
#' @rdname publish
#' @export
publish.landing <- function(viz){

repos <- setdiff(getRepoNames(viz[['org']]), c('vizlab', 'D3Learners', 'viz-scratch')) # we know some aren't vizzies
viz_info <- lapply(setNames(nm=repos), function(repo) {
tryCatch(getVizInfo(repo, org=viz[['org']], viz[['dev']]),
error=function(e) message(paste0("in getVizInfo(", repo, "): ", e$message), appendLF=TRUE),
warning=function(w) if(grepl("\\. is not a real", w$message)) return() else warning(w))
error=function(e) message(paste0("in getVizInfo(", repo, "): ", e$message), appendLF=TRUE)
# warning=function(w) if(grepl("\\. is not a real", w$message)) return() else warning(w)
)
})
# rm null
viz_info <- viz_info[!sapply(viz_info, is.null)]
Expand Down
27 changes: 14 additions & 13 deletions R/publishLandingPage.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,27 @@ getVizInfo <- function(org, repo, dev){
# the warning "NAs introduced by coercion: . is not a real" can be avoided by
# not setting any value to .; for example, in hurricane-harvey's data-sources
# item, we have "line6: .", which introduces this error.
viz.yaml <- yaml.load_file(viz.yaml_url)
viz.yaml <- yaml.load_file(url(viz.yaml_url))

has_publish_date <- !is.null(viz.yaml$info$`publish-date`)
if(!dev){
if(has_publish_date){
publish_date <- as.Date(viz.yaml$info$`publish-date`)
if(has_publish_date) {
publish_date <- as.Date(viz.yaml$info$`publish-date`)
if(!dev){
# for prod, verify that the publish date is today or already past
is_published <- publish_date <= Sys.Date()
if(!is_published){
return()
}
} else {
return()
# for dev, publish anything that actually has a date in the field
is_published <- TRUE
}
} else {
publish_date <- as.Date(viz.yaml$info$`publish-date`)
is_published <- TRUE
if(is.null(publish_date) | is.na(publish_date)){
publish_date <- Sys.Date()
}
is_published <- FALSE
}

if(!is_published){
# if it is not going to be published, jump out of this function
return()
}

viz_info <- viz.yaml$info

viz_url <- viz_info$url
Expand Down
17 changes: 9 additions & 8 deletions inst/css/footer.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
footer{
background:#414042;
min-height:200px;
color:#fff;
border-top:5px solid rgb(210,210,210);
margin-top:20px;
font-family:"Source Sans Pro", sans-serif;
padding-bottom: 10px;
}
background:#414042;
min-height:200px;
color:#fff;
border-top:5px solid rgb(210,210,210);
margin-top:20px;
font-family:"Source Sans Pro", sans-serif;
padding-bottom: 10px;
}

footer a{
background:#414042;
text-decoration:none;
}

Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions inst/js/d3-modules/d3-array.v1.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions inst/js/d3-modules/d3-collection.v1.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 25e7e11

Please sign in to comment.