Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

104 amelioration header intitule vecteur #149

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Imports:
XML (>= 3.99.0.10)
Suggests:
desc (>= 1.4.1),
dplyr,
DT (>= 0.23),
knitr (>= 1.39),
readxl (>= 1.4.0),
Expand All @@ -46,7 +47,7 @@ Suggests:
withr (>= 2.5.0)
VignetteBuilder:
knitr
Config/fusen/version: 0.5.0.9001
Config/fusen/version: 0.5.1
Config/testthat/edition: 3
Encoding: UTF-8
LazyData: true
Expand Down
2 changes: 1 addition & 1 deletion R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ app_ui <- function(request) {
title = "shinygouv",
id = "nav",
header = header_dsfr(
intitule = span("D\u00e9mo", br(), "de", br(), "{shinygouv}"),
intitule = c("D\u00e9mo", "de", "{shinygouv}"),
nom_site_service = "Bienvenue sur l\'application de d\u00e9monstration de {shinygouv}",
baseline = "https://github.com/spyrales/shinygouv"
),
Expand Down
2 changes: 1 addition & 1 deletion R/convert_file_to_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ convert_file_to_dsfr <- function(file, tab_corresp) {

message(glue::glue("scan {file}"))
file_read <- readLines(file)

if (isTRUE(grep("tabPanel", file_read) > 0)) {
message(glue::glue("Attention le {file} contient un 'tabPanel': \n - Si celui ci \u00e9tait dans un navbarPage alors le remplacer par un navbarPanel_dsfr. \n - Si celui ci \u00e9tait dans un 'tabsetPanel', alors le remplacer par un 'tabPanel_dsfr'"))
}
Expand Down
63 changes: 42 additions & 21 deletions R/footer_dsfr.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# WARNING - Generated by {fusen} from /dev/flat_composants/flat_footer.Rmd: do not edit by hand
# WARNING - Generated by {fusen} from dev/flat_composants/flat_footer.Rmd: do not edit by hand

#' footer_dsfr

Expand All @@ -11,7 +11,7 @@
#'
#' 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 intitule la partie "intitule" du bloc marque. Utiliser un `shiny::tags$span()`pour mettre l'intitulé sur plusieurs lignes ou un vecteur.
#' @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
Expand All @@ -30,7 +30,7 @@
#' shinyApp(
#' ui = fluidPage_dsfr(
#' footer = footer_dsfr(
#' intitule = "Territoire",
#' intitule = c("Territoire", "Service"),
#' description = "une description",
#' accessibilite = "non",
#' add_extra_url_body = footer_extra_url_body_dsfr(
Expand All @@ -46,7 +46,7 @@
#' )
#' ),
#' add_extra_url_bottom = footer_extra_url_bottom_dsfr(
#'
#'
#' footer_li_dsfr(
#' href = "https://siteinternet.fr",
#' titre = "siteinternet.fr.fr - nouvelle fenêtre",
Expand Down Expand Up @@ -81,8 +81,8 @@
#' )
#' }
footer_dsfr <- function(
intitule = NULL ,
description = NULL ,
intitule = NULL,
description = NULL,
accessibilite = "non",
lien_accessibilite = "#",
lien_mentions_legales = "#",
Expand All @@ -92,27 +92,30 @@ footer_dsfr <- function(
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))


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))

if(is.vector(intitule) & length(intitule) > 1){
intitule <- span(HTML(paste0(intitule, collapse = "<br/>")))
}


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
accessibilite = accessibilite,
lien_accessibilite = lien_accessibilite,
lien_mentions_legales = lien_mentions_legales,
lien_donnees_personnelles = lien_donnees_personnelles,
lien_gestion_cookies = lien_gestion_cookies
)
}

Expand All @@ -137,6 +140,24 @@ footer_extra_url_body_dsfr <- function(...) {



#' 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
#' @examples
#' footer_extra_url_bottom_dsfr(footer_li_dsfr(href = "http://siteinternet.fr", texte = "siteinternet.fr"))
footer_extra_url_bottom_dsfr <-
function(...) {
tagList(...)

}


#' footer_li_dsfr
#'
#' Permet de créer la balise html pour ajouter un lien en fonction de sa destination (body/bottom)
Expand Down
14 changes: 9 additions & 5 deletions R/header_dsfr.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# WARNING - Generated by {fusen} from dev/flat_composants/flat_header.Rmd: do not edit by hand
# WARNING - Generated by {fusen} from /dev/flat_composants/flat_header.Rmd: do not edit by hand

#' header_dsfr
#'
#' @param intitule la partie "intitule" du bloc marque
#' Vous pouvez ajouter le header officiel dans votre application avec `header_dsfr()`.
#' @param intitule la partie "intitule" du bloc marque. Utiliser un `shiny::tags$span()`pour mettre l'intitulé sur plusieurs lignes ou un vecteur.
#' @param url l url de redirection - optionnel
#' @param titre le texte de description de l url - optionnel
#' @param nom_site_service le nom du site ou du service - optionnel
Expand All @@ -15,11 +15,11 @@
#' if(interactive()) {
#' library(shiny)
#' header_dsfr(
#' intitule = span("Prefet", br(), "de", br(), "Bretagne")
#' intitule = c("Pr\u00e9fet", "de", "Bretagne")
#' )
#' }
header_dsfr <- function(
intitule,
intitule = c("intitul\u00e9", "du", 'bloc-marque'),
url = "/",
titre = NULL,
nom_site_service = NULL,
Expand All @@ -29,6 +29,10 @@ header_dsfr <- function(
# check les params
# assertthat::assert_that(is.character(intitule))
# TODO verifier que l url est valide

if(is.vector(intitule) & length(intitule) > 1){
intitule <- span(HTML(paste0(intitule, collapse = "<br/>")))
}

res <- header_dsfr_template(
class = class,
Expand Down
2 changes: 1 addition & 1 deletion R/header_dsfr_template.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# WARNING - Generated by {fusen} from dev/flat_composants/flat_header.Rmd: do not edit by hand
# WARNING - Generated by {fusen} from /dev/flat_composants/flat_header.Rmd: do not edit by hand

#' header_dsfr_template
#' @param intitule la partie "intitule" du bloc marque. Utiliser un `shiny::tags$span()`pour mettre l'intitulé sur plusieurs lignes
Expand Down
Loading
Loading