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

Ajout de helpers pour les icônes dsfr #4974

Open
wants to merge 1 commit into
base: production
Choose a base branch
from
Open
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
28 changes: 28 additions & 0 deletions app/helpers/dsfr_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,34 @@ def dsfr_image_tag(path, alt, html_options = {})
end
end

def icon(icon_name, html_options = {})
tag.span("", class: "#{icon_name} #{html_options.delete(:class)}", "aria-hidden": "true", **html_options)
end

def motif_icon(html_options = {})
icon("fr-icon-draft-fill", html_options)
end

def lieu_icon(html_options = {})
icon("fr-icon-building-fill", html_options)
end

def visio_icon(html_options = {})
icon("fr-icon-mac-fill", html_options)
end

def phone_icon(html_options = {})
icon("fr-icon-phone-fill", html_options)
end

def back_icon(html_options = {})
icon("fr-icon-arrow-left-line", html_options)
end

def home_icon(html_options = {})
icon("fr-icon-home-4-fill", html_options)
end

def external_link_to(name, url, html_options = {})
link_to(name, url, { target: "_blank", rel: "noopener", title: "#{name} - nouvel onglet" }.merge(html_options))
end
Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/_left_menu.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ nav.left-side-menu-wrapper
- unless current_agent_role.admin?
li
= active_link_to admin_organisation_lieux_path(current_organisation), class: "side-menu__item"
span.fr-icon-building-fill.fr-icon--sm.fr-mr-1w[aria-hidden="true"]
= lieu_icon(class: "fr-icon--sm fr-mr-1w")
| Lieux
li
= active_link_to admin_organisation_motifs_path(current_organisation), class: "side-menu__item"
span.fr-icon-draft-fill.fr-icon--sm.fr-mr-1w[aria-hidden="true"]
= motif_icon(class: "fr-icon--sm fr-mr-1w")
| Motifs

- if current_agent_role.admin?
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/rdvs/_rdv.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ul.list-group.list-group-flush.fr-mb-3w
- elsif rdv.motif.visio?
li.list-group-item.fr-pl-0.fr-py-2w
.fr-mb-1w
span.fr-icon-mac-fill.fr-mr-1w[aria-hidden="true"]
= visio_icon(class: "fr-mr-1w")
= "RDV par visioconférence "
.fr-ml-4w
= link_to("rejoindre la visioconférence", rdv.visio_url, target: :_blank)
Expand Down
Loading