Skip to content

Commit

Permalink
review help
Browse files Browse the repository at this point in the history
  • Loading branch information
DivadNojnarg committed Sep 19, 2018
1 parent f3280ef commit a4212da
Show file tree
Hide file tree
Showing 33 changed files with 184 additions and 84 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export(tileCountRow)
export(tileCountUI)
export(timeline)
export(timelineItem)
export(trackingTags)
export(updateTileCount)
export(userList)
export(userListItem)
Expand Down
10 changes: 10 additions & 0 deletions R/boxes.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
box <- function(..., width = 4, height = NULL,
title = "Box title", subtitle = NULL, collapsible = TRUE,
Expand Down Expand Up @@ -141,6 +143,8 @@ box <- function(..., width = 4, height = NULL,
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
socialBox <- function(..., width = 3, height = 390,
title = NULL, url_1 = NULL, url_2 = NULL,
Expand Down Expand Up @@ -223,6 +227,8 @@ socialBox <- function(..., width = 3, height = 390,
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
ribbonBox <- function(..., width = 3, height = 390, ribbon_text = NULL,
title = NULL, ribbon_color = NULL) {
Expand Down Expand Up @@ -286,6 +292,8 @@ ribbonBox <- function(..., width = 3, height = 390, ribbon_text = NULL,
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
valueBox <- function(value, title = NULL, description = NULL, icon = NULL, width = 3) {
shiny::div(
Expand Down Expand Up @@ -340,6 +348,8 @@ valueBox <- function(value, title = NULL, description = NULL, icon = NULL, width
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
contactBox <- function(..., head_title = NULL, main_title = NULL,
img = NULL, footer_left = NULL,
Expand Down
5 changes: 2 additions & 3 deletions R/gentelellaGallery.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ gentelellaGallery <- function() {
if (!requireNamespace(package = "gentelellaShiny"))
message("Package 'gentelellaShiny' is required to run this function")

#browseURL(system.file("www", "login.html", package = "gentelellaShiny"))
shiny::shinyAppFile(
system.file(
paste0("example/app.R"),
package = 'gentelellaShiny'#,
#mustWork = TRUE
package = 'gentelellaShiny',
mustWork = TRUE
)
)

Expand Down
2 changes: 1 addition & 1 deletion R/gentelellaSidebar.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ sidebarDate <- function() {
#' @param ... Slot for \link{sidebarItem}
#' @param title Menu section title
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#' @author Mark Edmondson, \email{m@@sunholo.com}
#'
#' @export
sidebarMenu <- function(..., title = NULL) {
Expand Down
102 changes: 52 additions & 50 deletions R/template.R
Original file line number Diff line number Diff line change
@@ -1,50 +1,52 @@
#' Tracking tags for your app
#'
#' @param tag_template Tracking tag template
#' @param tag_code If GA, the UA code. If GTM, the GTM code.
#'
#' tag_code depends on what tag_template is:
#'
#' \itemize{
#' \item ga: The UA code (UA-xxxxxx-x)
#' \item gtm The GTM code (GTM-xxxxx)
#' \item freeform The JS code
#' }
#' If you select a tag template, you can put UA-xxxx-x as tag_code
#'
#' @return JavaScript for tracking
#' @export
trackingTags <- function(tag_template = c("ga","gtm","freeform"),
tag_code){

tag_template <- match.arg(tag_template)

out <- switch(tag_template,
ga = sprintf("<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '%s', 'auto');
ga('send', 'pageview');
</script>", tag_code),
gtm = sprintf("<!-- Google Tag Manager -->
<noscript><iframe src=\"//www.googletagmanager.com/ns.html?id=%s\"
height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','%s');</script>
<!-- End Google Tag Manager -->", tag_code, tag_code),
freeform = tag_code



)

shiny::HTML(out)

}
# #' Tracking tags for your app
# #'
# #' @param tag_template Tracking tag template
# #' @param tag_code If GA, the UA code. If GTM, the GTM code.
# #'
# #' tag_code depends on what tag_template is:
# #'
# #' \itemize{
# #' \item ga: The UA code (UA-xxxxxx-x)
# #' \item gtm The GTM code (GTM-xxxxx)
# #' \item freeform The JS code
# #' }
# #' If you select a tag template, you can put UA-xxxx-x as tag_code
# #'
# #' @author Mark Edmondson, \email{m@@sunholo.com}
# #'
# #' @return JavaScript for tracking
# #' @export
# trackingTags <- function(tag_template = c("ga","gtm","freeform"),
# tag_code){
#
# tag_template <- match.arg(tag_template)
#
# out <- switch(tag_template,
# ga = sprintf("<script>
# (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
# (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
# m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
# })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
#
# ga('create', '%s', 'auto');
# ga('send', 'pageview');
#
# </script>", tag_code),
# gtm = sprintf("<!-- Google Tag Manager -->
# <noscript><iframe src=\"//www.googletagmanager.com/ns.html?id=%s\"
# height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe></noscript>
# <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
# new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
# j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
# '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
# })(window,document,'script','dataLayer','%s');</script>
# <!-- End Google Tag Manager -->", tag_code, tag_code),
# freeform = tag_code
#
#
#
# )
#
# shiny::HTML(out)
#
# }
43 changes: 43 additions & 0 deletions R/useful-items.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@
#'
#' @param ... slot for socialStatsItem
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
socialStats <- function(...) {
shiny::tags$ul(class = "list-inline count2", ...)
Expand All @@ -126,6 +128,8 @@ socialStats <- function(...) {
#' @param value Item value
#' @param name Item name
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
socialStatsItem <- function(value = NULL, name = NULL) {
shiny::tags$li(
Expand Down Expand Up @@ -182,6 +186,8 @@ socialStatsItem <- function(value = NULL, name = NULL) {
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
pieChart <- function(id, value, height = 220, width = 220,
barColor = "#ef1e25", trackColor = "#f2f2f2",
Expand Down Expand Up @@ -271,6 +277,8 @@ pieChart <- function(id, value, height = 220, width = 220,
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
timeline <- function(...) {
shiny::tags$ul(
Expand All @@ -289,6 +297,8 @@ timeline <- function(...) {
#' @param author timeline item author, if any
#' @param tag timeline item tag
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
timelineItem <- function(..., title = NULL, url = NULL, date = NULL, author = NULL,
tag = NULL) {
Expand Down Expand Up @@ -354,6 +364,8 @@ timelineItem <- function(..., title = NULL, url = NULL, date = NULL, author = NU
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
quickList <- function(...) {
shiny::tags$ul(class = "quick-list", ...)
Expand All @@ -365,6 +377,8 @@ quickList <- function(...) {
#' @param icon item icon
#' @param name item name
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
quickListItem <- function(icon, name = NULL) {
shiny::tags$li(shiny::icon(icon), shiny::tags$a(name))
Expand Down Expand Up @@ -420,6 +434,8 @@ quickListItem <- function(icon, name = NULL) {
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
boxWidget <- function(..., title = NULL, width = NULL) {
shiny::tags$div(
Expand Down Expand Up @@ -472,6 +488,8 @@ boxWidget <- function(..., title = NULL, width = NULL) {
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
userList <- function(...) {
shiny::tags$ul(class = "list-unstyled msg_list", ...)
Expand All @@ -485,6 +503,8 @@ userList <- function(...) {
#' @param title item title
#' @param subtitle item subtitle
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
userListItem <- function(..., user_img = NULL, title = NULL, subtitle = NULL) {
shiny::tags$li(
Expand Down Expand Up @@ -548,6 +568,8 @@ userListItem <- function(..., user_img = NULL, title = NULL, subtitle = NULL) {
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
progressBar <- function(value, side = "left", status = NULL, striped = FALSE,
color = NULL){
Expand Down Expand Up @@ -604,6 +626,8 @@ progressBar <- function(value, side = "left", status = NULL, striped = FALSE,
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
jumbotron <- function(..., title = NULL) {
shiny::tags$div(
Expand Down Expand Up @@ -645,6 +669,8 @@ jumbotron <- function(..., title = NULL) {
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
alert <- function(..., title = NULL, status = "primary", dismissible = TRUE, width = 3) {

Expand Down Expand Up @@ -755,6 +781,8 @@ alert <- function(..., title = NULL, status = "primary", dismissible = TRUE, wid
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
activityList <- function(...) {
shiny::tags$ul(class = "messages", ...)
Expand All @@ -771,6 +799,8 @@ activityList <- function(...) {
#' @param month month of publication
#' @param url external link
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
activityItem <- function(..., title = NULL, img = NULL,
day = NULL, month = NULL, url = NULL) {
Expand Down Expand Up @@ -821,6 +851,8 @@ activityItem <- function(..., title = NULL, img = NULL,
#' )
#' }
#'
#' @author Mark Edmondson, \email{m@@sunholo.com}
#'
#' @export
tileCountRow <- function(...){
shiny::tags$div(class = "row tile_count", shiny::tagList(...))
Expand All @@ -838,6 +870,9 @@ tileCountRow <- function(...){
#' @param highlight color to highlight value
#'
#' @return a tileCountRow for use within \link{tileCountRow}
#'
#' @author Mark Edmondson, \email{m@@sunholo.com}
#'
#' @export
tileCountElement <- function(value = 2500, change_value = "4%", going_well = TRUE,
tile_title = " Total Users", width = 3,
Expand Down Expand Up @@ -866,6 +901,9 @@ tileCountElement <- function(value = 2500, change_value = "4%", going_well = TRU
#' @param id Shiny id
#'
#' @return Shiny UI
#'
#' @author Mark Edmondson, \email{m@@sunholo.com}
#'
#' @export
tileCountUI <- function(id){
ns <- shiny::NS(id)
Expand All @@ -891,6 +929,9 @@ tileCountUI <- function(id){
#' @param highlight [reactive] color to highlight value
#'
#' @return NULL
#'
#' @author Mark Edmondson, \email{m@@sunholo.com}
#'
#' @export
updateTileCount <- function(input, output, session, value, change_value,
going_well, tile_title = " Total Users",
Expand Down Expand Up @@ -944,6 +985,8 @@ updateTileCount <- function(input, output, session, value, change_value,
#' )
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
label <- function(name = NULL, status = "primary",
position = NULL, mode = "label") {
Expand Down
3 changes: 3 additions & 0 deletions man/activityItem.Rd

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

3 changes: 3 additions & 0 deletions man/activityList.Rd

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

3 changes: 3 additions & 0 deletions man/alert.Rd

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

3 changes: 3 additions & 0 deletions man/box.Rd

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

3 changes: 3 additions & 0 deletions man/boxWidget.Rd

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

Loading

0 comments on commit a4212da

Please sign in to comment.