-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implementation footer_dsfr (#142)
* feat: implementation footer_dsfr tags: docs, test pourquoi: - avoir un footer conforme au dsfr quoi: - ajout de fonction footer_dsfr - possibilite d'ajouter des url supplementaire a celles par defaut - ajout du pied de page dans l'app shiny demo Issue #141 --------- Co-authored-by: Juliette Engelaere-Lefebvre <[email protected]>
- Loading branch information
1 parent
fe7f7f9
commit d3ffe50
Showing
26 changed files
with
1,214 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# WARNING - Generated by {fusen} from /dev/flat_composants/flat_footer.Rmd: do not edit by hand | ||
|
||
#' footer_bottom_dsfr | ||
#' | ||
#' Il se compose des éléments suivants: | ||
#'- la liste de liens liés aux obligations légales. Cette liste doit être définie en fonction du site, toutefois les liens & contenus suivants sont obligatoires : “accessibilité : non/partiellement/totalement conforme”, mentions légales, données personnelles et gestion des cookies. - obligatoire. | ||
#' - une mention de la licence - obligatoire “Sauf mention contraire, tous les contenus de ce site sont sous licence etalab-2.0” | ||
#' | ||
#' @param accessibilite le type d'accessibilité (non/partiellement/totalement conforme) | ||
#' @param lien_accessibilite lien url vers l'accessibilite | ||
#' @param lien_mentions_legales lien url vers les mentions légales | ||
#' @param lien_donnees_personnelles lien url vers les données personnelles | ||
#' @param lien_gestion_cookies lien url vers la gestion des cookies | ||
#' @param ... d'autre liens de références (voir `footer_li_dsfr()`) | ||
#' | ||
#' @return html | ||
#' @rdname footer_dsfr | ||
#' @export | ||
footer_bottom_dsfr <- | ||
function(accessibilite = "non", | ||
..., | ||
lien_accessibilite = "#", | ||
lien_mentions_legales = "#", | ||
lien_donnees_personnelles = "#", | ||
lien_gestion_cookies = "#") { | ||
|
||
|
||
assertthat::assert_that(is.character(accessibilite)) | ||
assertthat::assert_that(is.character(lien_accessibilite)) | ||
assertthat::assert_that(is.character(lien_mentions_legales)) | ||
assertthat::assert_that(is.character(lien_donnees_personnelles)) | ||
assertthat::assert_that(is.character(lien_gestion_cookies)) | ||
|
||
if ( isFALSE(accessibilite %in% c("non", "partiellement", "totalement conforme"))){ | ||
stop("l accessibilite doit etre 'non', 'partiellement' ou 'totalement conforme'") | ||
} | ||
|
||
contenu <- list(...) | ||
htmltools::htmlTemplate( | ||
filename = system.file( | ||
get_dsfr_version(with_v = TRUE), | ||
"composant", | ||
"piedpage_bottom.html", | ||
package = "shinygouv" | ||
), | ||
accessibilite = accessibilite, | ||
lien_accessibilite = lien_accessibilite, | ||
lien_mentions_legales = lien_mentions_legales, | ||
lien_donnees_personnelles = lien_donnees_personnelles, | ||
lien_gestion_cookies = lien_gestion_cookies, | ||
bottom_list = purrr::map(contenu, ~ { | ||
footer_one_li( | ||
id = .x$id, | ||
href = .x$href, | ||
titre = .x$titre, | ||
texte = .x$texte, | ||
type = "bottom" | ||
) | ||
}) | ||
) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
# WARNING - Generated by {fusen} from /dev/flat_composants/flat_footer.Rmd: do not edit by hand | ||
|
||
#' footer_dsfr | ||
|
||
#' Il se compose des éléments suivants: | ||
#' - un bloc marque, voir la charte de marque | ||
#' - un texte de présentation - optionnel. | ||
#' - 4 liens de références de l'écosystème institutionnel - obligatoires. | ||
#'- la liste de liens liés aux obligations légales. Cette liste doit être définie en fonction du site, toutefois les liens & contenus suivants sont obligatoires : “accessibilité : non/partiellement/totalement conforme”, mentions légales, données personnelles et gestion des cookies. - obligatoire. | ||
#' - une mention de la licence - obligatoire “Sauf mention contraire, tous les contenus de ce site sont sous licence etalab-2.0” | ||
#' | ||
#' Il est possible d'ajouter des url supplémentaires dans le corps et le bas du pied de page. | ||
#' | ||
#' @param intitule la partie "intitule" du bloc marque | ||
#' @param description un texte de présentation - optionnel | ||
#' @param accessibilite le type d'accessibilité (non/partiellement/totalement conforme) | ||
#' @param lien_accessibilite lien url vers l'accessibilite | ||
#' @param lien_mentions_legales lien url vers les mentions légales | ||
#' @param lien_donnees_personnelles lien url vers les données personnelles | ||
#' @param lien_gestion_cookies lien url vers la gestion des cookies | ||
#' @param add_extra_url_body url supplementaire a ajouter au corps du pied de page (voir `footer_extra_url_body_dsfr()`) | ||
#' @param add_extra_url_bottom url supplementaire a ajouter au bas du pied de page (voir `footer_extra_url_bottom_dsfr()`) | ||
#' | ||
#' @return html | ||
#' @export | ||
#' @rdname footer_dsfr | ||
#' @examples | ||
#' if (interactive()) { | ||
#' library(shiny) | ||
#' shinyApp( | ||
#' ui = fluidPage_dsfr( | ||
#' footer = footer_dsfr( | ||
#' intitule = "Territoire", | ||
#' description = "une description", | ||
#' accessibilite = "non", | ||
#' add_extra_url_body = footer_extra_url_body_dsfr( | ||
#' footer_li_dsfr( | ||
#' href = "https://siteinternet.fr", | ||
#' titre = "siteinternet.fr.fr - nouvelle fenêtre", | ||
#' texte = "siteinternet.fr.fr", type = "body" | ||
#' ), | ||
#' footer_li_dsfr( | ||
#' href = "https://siteinternet.fr", | ||
#' titre = "siteinternet.fr.fr - nouvelle fenêtre", | ||
#' texte = "siteinternet.fr.fr", type = "body" | ||
#' ) | ||
#' ), | ||
#' add_extra_url_bottom = footer_extra_url_bottom_dsfr( | ||
#' | ||
#' footer_li_dsfr( | ||
#' href = "https://siteinternet.fr", | ||
#' titre = "siteinternet.fr.fr - nouvelle fenêtre", | ||
#' texte = "siteinternet.fr.fr", type = "bottom" | ||
#' ) | ||
#' ) | ||
#' ), | ||
#' tabsetPanel_dsfr( | ||
#' "coucou", | ||
#' tabPanel_dsfr( | ||
#' id = "tab1", | ||
#' title = "Une prems tab", | ||
#' content = tagList(h3("Coucou"), | ||
#' plotOutput("plot")) | ||
#' ), | ||
#' tabPanel_dsfr( | ||
#' id = "tab2", | ||
#' title = "Une deuxieme tab", | ||
#' content = tagList(h3("Salut"), | ||
#' plotOutput("plot2")) | ||
#' ) | ||
#' ) | ||
#' ), | ||
#' server = function(input, output) { | ||
#' output$plot <- renderPlot({ | ||
#' plot(cars) | ||
#' }) | ||
#' output$plot2 <- renderPlot({ | ||
#' plot(iris) | ||
#' }) | ||
#' } | ||
#' ) | ||
#' } | ||
footer_dsfr <- function( | ||
intitule = NULL , | ||
description = NULL , | ||
accessibilite = "non", | ||
lien_accessibilite = "#", | ||
lien_mentions_legales = "#", | ||
lien_donnees_personnelles = "#", | ||
lien_gestion_cookies = "#", | ||
add_extra_url_body = NULL, | ||
add_extra_url_bottom = NULL) { | ||
|
||
|
||
if ( isFALSE(accessibilite %in% c("non", "partiellement", "totalement conforme"))){ | ||
stop("l accessibilite doit etre 'non', 'partiellement' ou 'totalement conforme'") | ||
} | ||
|
||
assertthat::assert_that(is.character(lien_accessibilite)) | ||
assertthat::assert_that(is.character(lien_mentions_legales)) | ||
assertthat::assert_that(is.character(lien_donnees_personnelles)) | ||
assertthat::assert_that(is.character(lien_gestion_cookies)) | ||
|
||
|
||
|
||
footer_dsfr_template( | ||
intitule = intitule, | ||
description = description, | ||
footer_body = add_extra_url_body, | ||
footer_bottom = add_extra_url_bottom, | ||
accessibilite = accessibilite, | ||
lien_accessibilite = lien_accessibilite, | ||
lien_mentions_legales = lien_mentions_legales, | ||
lien_donnees_personnelles = lien_donnees_personnelles, | ||
lien_gestion_cookies = lien_gestion_cookies | ||
) | ||
} | ||
|
||
|
||
#' footer_extra_url_body_dsfr | ||
#' | ||
#' Permet d'ajouter des liends/url dans le corps du pied de page | ||
#' | ||
#' @param ... d'autres liens de références (voir `footer_li_dsfr()`) | ||
#' | ||
#' @return html | ||
#' @rdname footer_dsfr | ||
#' @export | ||
#' @examples | ||
#' footer_extra_url_body_dsfr( | ||
#' footer_li_dsfr(href = "http://siteinternet.fr", texte = "siteinternet.fr", type = "body"), | ||
#' footer_li_dsfr(href = "http://siteinternet.fr", texte = "siteinternet.fr", type = "body")) | ||
footer_extra_url_body_dsfr <- function(...) { | ||
tagList(...) | ||
|
||
} | ||
|
||
|
||
|
||
#' footer_li_dsfr | ||
#' | ||
#' Permet de créer la balise html pour ajouter un lien en fonction de sa destination (body/bottom) | ||
#' | ||
#' @param href une url | ||
#' @param texte le texte | ||
#' @param id un identifiant (optionnel) | ||
#' @param titre le titre de l infobulle (optionnel) | ||
#' @param type le type de rendu de l url (body/bottom, par defaut body) | ||
#' | ||
#' @rdname footer_dsfr | ||
#' | ||
#' @return html | ||
#' | ||
#' @export | ||
#' @examples | ||
#' footer_li_dsfr(href = "http://siteinternet.fr", texte = "siteinternet.fr", type = "body") | ||
#' footer_li_dsfr(href = "http://siteinternet.fr", texte = "siteinternet.fr", type = "bottom") | ||
footer_li_dsfr <- function(id = NULL, | ||
href, | ||
titre = NULL, | ||
texte, | ||
type = "body") { | ||
|
||
if (type == "body"){ | ||
target = "target='_blank'" | ||
ttype = "content" | ||
} else if (type == "bottom"){ | ||
target = NULL | ||
ttype = "bottom" | ||
} else { | ||
stop("Dans footer_li_dsfr, type doit etre 'body' ou 'bottom'") | ||
} | ||
|
||
htmltools::htmlTemplate( | ||
filename = system.file( | ||
get_dsfr_version(with_v = TRUE), | ||
"composant", | ||
"piedpage_content.html", | ||
package = "shinygouv" | ||
), | ||
id = id, | ||
href = href, | ||
titre = titre, | ||
texte = texte, | ||
type = ttype, | ||
target = target | ||
) |> parse_html() | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# WARNING - Generated by {fusen} from /dev/flat_composants/flat_footer.Rmd: do not edit by hand | ||
|
||
#' footer_dsfr_template | ||
#' | ||
#' @param intitule la partie "intitule" du bloc marque | ||
#' @param description un texte de présentation - optionnel | ||
#' @param footer_body le corps du footer | ||
#' @param footer_bottom le bas du footer | ||
#' @param accessibilite le type d'accessibilité (non/partiellement/totalement conforme) | ||
#' @param lien_accessibilite lien url vers l'accessibilite | ||
#' @param lien_mentions_legales lien url vers les mentions légales | ||
#' @param lien_donnees_personnelles lien url vers les données personnelles | ||
#' @param lien_gestion_cookies lien url vers la gestion des cookies | ||
#' | ||
#' @importFrom htmltools htmlTemplate | ||
#' @return html | ||
#' @noRd | ||
footer_dsfr_template <- function( | ||
intitule , | ||
description , | ||
footer_body, footer_bottom, | ||
accessibilite = "non", | ||
lien_accessibilite = "#", | ||
lien_mentions_legales = "#", | ||
lien_donnees_personnelles = "#", | ||
lien_gestion_cookies = "#" | ||
) { | ||
|
||
htmltools::htmlTemplate( | ||
filename = system.file( | ||
get_dsfr_version(with_v = TRUE), | ||
"composant", | ||
"piedpage.html", | ||
package = "shinygouv" | ||
), | ||
intitule = intitule , | ||
description = description, | ||
footer_body = footer_body, | ||
footer_bottom = footer_bottom, | ||
accessibilite = accessibilite, | ||
lien_accessibilite = lien_accessibilite, | ||
lien_mentions_legales = lien_mentions_legales, | ||
lien_donnees_personnelles = lien_donnees_personnelles, | ||
lien_gestion_cookies = lien_gestion_cookies | ||
) |> parse_html() | ||
} | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# WARNING - Generated by {fusen} from /dev/flat_composants/flat_footer.Rmd: do not edit by hand | ||
|
||
#' footer_extra_url_bottom_dsfr | ||
#' | ||
#' Permet d'ajouter des liends/url dans le bas du pied de page | ||
#' | ||
#' @param ... d'autre liens de références (voir `footer_li_dsfr()`) | ||
#' | ||
#' @return html | ||
#' @rdname footer_dsfr | ||
#' @export | ||
footer_extra_url_bottom_dsfr <- | ||
function(...) { | ||
tagList(...) | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.