Skip to content

Commit

Permalink
noaa-onms/cinms#69 added test site functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
superjai committed Dec 12, 2020
1 parent b00a4ff commit 0d924cf
Show file tree
Hide file tree
Showing 143 changed files with 23,693 additions and 222 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export(get_dates)
export(get_figure_info)
export(get_modal_info)
export(get_nms_polygons)
export(initial_build)
export(map_nms_sites)
export(md_caption)
export(plot_SST_anomaly)
Expand Down
21 changes: 21 additions & 0 deletions R/utilities.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#' Create new site from template
#'
#' This function creates a new site from a template stored within the package.
#'
#' @param directory_name The directory where the new site should be located.
#' @return The output is a directory containing the template version of a site.
#' @export
#' @examples \dontrun{
#' directory_name("test_location")
#' }
#'

initial_build <- function(directory_name){
if (dir.exists(directory_name)){
stop(paste("Error: the directory -", directory_name, "- already exists."))

}
directory_to_copy <- system.file("template", package = "nms4r")
dir.create(directory_name)
file.copy(directory_to_copy, directory_name, recursive = T)
}
222 changes: 0 additions & 222 deletions inst/statistics_sst_cinms.csv

This file was deleted.

23 changes: 23 additions & 0 deletions inst/template/_site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Template info"
output_dir: "."
description: |
Template info
navbar:
title: "Template"
icon: fa-info
left:
- text: "Subject 1"
href: index.html
- text: "Subject 2"
href: subject2.html
right:
- text: "About"
href: https://marinebon.org/sanctuaries/
output:
html_document:
theme: lumen # darkly # cosmo # https://bootswatch.com
self_contained: no
css: libs/styles.css
mathjax: null
anchor_sections: FALSE

29 changes: 29 additions & 0 deletions inst/template/_svg-html_child.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script src="libs/d3.v5.min.js"></script>
<script src="libs/infographiq.js"></script>
<link href="libs/bootstrap-toggle.min.css" rel="stylesheet">
<script src="libs/bootstrap-toggle.min.js"></script>


<div class = "col-md-9">
<div id = "svg"></div>
</div>

<div class = "col-md-3">

Text: <input id="toggle-text" type="checkbox" data-toggle="toggle" data-size="mini">
<div id="toggle-text-event"></div>
<ul id = "svg_list"></ul>
</div>

<script>
link_svg(svg = "`r params$svg`", csv = "`r params$csv`", debug = true);
</script>

<script>
$(function() {
$('#toggle-text').change(function() {
display = this.checked ? "inline" : "none";
d3.select("#text").attr("display", display);
})
})
</script>
12 changes: 12 additions & 0 deletions inst/template/index.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: "Subject 1"
params:
csv: "svg/svg_links_template.csv"
svg: "svg/example1.svg"
---

Replace with your text.

```{r svg, child = '_svg-html_child.Rmd'}
```

Loading

0 comments on commit 0d924cf

Please sign in to comment.