summaryrefslogtreecommitdiff
path: root/inst/app/www
diff options
context:
space:
mode:
authorNaeem Model <me@nmode.ca>2024-05-26 02:38:19 +0000
committerNaeem Model <me@nmode.ca>2024-05-26 02:38:19 +0000
commit9cf25e707fbd49d357cf295ad62f83d805c59c2c (patch)
tree30154c5e964dbe7f8975527e48a1e1a5d042107e /inst/app/www
parentbd2bfa90dc7bb75cc6cbe8c6b674b7bcf486b519 (diff)
Update Shiny app
- Refactor data upload and sample data - Create custom data upload button - Create script.js - Change Shiny notification colour - Bug fix: ensure the case counts in bulk data that have only one row are treated as a data frame, by wrapping them in 'data.frame' before passing to 'apply'
Diffstat (limited to 'inst/app/www')
-rw-r--r--inst/app/www/script.js21
-rw-r--r--inst/app/www/styles.css6
2 files changed, 26 insertions, 1 deletions
diff --git a/inst/app/www/script.js b/inst/app/www/script.js
new file mode 100644
index 0000000..c31584f
--- /dev/null
+++ b/inst/app/www/script.js
@@ -0,0 +1,21 @@
+$(document).ready(() => {
+ // Enable tooltips.
+ $('[data-bs-toggle="tooltip"]').tooltip();
+
+ // Toggle the text in the bulk data help button.
+ $('#bulk-help-toggle').on('click', event => {
+ btn = $(event.target);
+ show_format = 'Show required format';
+ btn.text(btn.text() === show_format ? 'Hide required format' : show_format);
+ });
+
+ // Trigger the file selector via a custom button.
+ $('#data-upload-select').on('click', () => {
+ $('#data_upload').trigger('click');
+ });
+
+ // Display the name of the uploaded file.
+ $('#data_upload').on('change', event => {
+ $('#data-upload-name').attr('placeholder', event.target.files[0].name);
+ });
+});
diff --git a/inst/app/www/styles.css b/inst/app/www/styles.css
index f6c4407..d53a387 100644
--- a/inst/app/www/styles.css
+++ b/inst/app/www/styles.css
@@ -20,7 +20,11 @@ noscript {
margin-top: -0.5rem;
}
-td.selected {
+td.selected, .shiny-notification {
background-color: black;
color: white;
}
+
+#data_upload {
+ display: none;
+}