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

Migration des icônes RDV usager au DSFR #4939

Merged
merged 3 commits into from
Jan 6, 2025
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
4 changes: 2 additions & 2 deletions app/helpers/rdvs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def human_location(rdv)

def rdv_tag(rdv)
if rdv.cancelled_at || current_user&.participation_for(rdv)&.cancelled?
tag.span("Annulé", class: "badge badge-warning")
tag.span("Annulé", class: "fr-badge fr-badge--sm fr-badge--warning fr-badge--no-icon fr-ml-1w")
elsif rdv.starts_at.future?
tag.span("À venir", class: "badge bg-info")
tag.span("À venir", class: "fr-badge fr-badge--sm fr-badge--info fr-badge--no-icon fr-ml-1w")
end
end

Expand Down
20 changes: 10 additions & 10 deletions app/views/users/participations/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@

ul.list-group.fr-mb-3w
li.list-group-item
i.fa.fa-info-circle>
span.fr-icon.fr-icon-draft-fill.fr-mr-1w[aria-hidden="true"]
= @rdv.motif_name

li.list-group-item
.fa.fa-calendar>
span.fr-icon.fr-icon-calendar-fill.fr-mr-1w[aria-hidden="true"]
= rdv_title(@rdv)
= rdv_tag(@rdv)

- if @rdv.home?
li.list-group-item
.fa.fa-home>
span.fr-icon.fr-icon-home-4-fill.fr-mr-1w[aria-hidden="true"]
| Ce RDV se déroulera à domicile

- elsif @rdv.public_office?
li.list-group-item
.fa.fa-map-marker-alt>
span.fr-icon.fr-icon-building-fill.fr-mr-1w[aria-hidden="true"]
= human_location(@rdv)
- if @rdv.lieu&.phone_number
span>
span.fa.fa-phone>
br
span.fr-icon.fr-icon-phone-fill.fr-mr-1w[aria-hidden="true"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

et peut-être que ça pourrait être utile d'avoir un petit helper qui permette de faire un truc dans ce genre :

Suggested change
span.fr-icon.fr-icon-phone-fill.fr-mr-1w[aria-hidden="true"]
= dsfr_icon("fr-icon-phone-fill", class: "fr-mr-1w")

et pour faciliter l'utilisation de la bonne icône, on pourrait même avoir des versions spécifiques de ce helper pour les icônes dont on a fixé la sémantique du genre

def dsfr_icon_for_motifs(class: nil)
  dsfr_icon("fr-icon-draft-fill", class:)
end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes effectivement, j'y ai pensé et c’est dans ma todo
Je n'ai pas encore proposé d’implémentation parce que ça me semblait curieux qu’on soit toujours obligé de faire ça, mais je n’ai pas encore trouvé de meilleurs moyens nativement dans le DSFR
Je ferai certainement ça dans une PR prochainement

= link_to @rdv.lieu.phone_number, "tel:#{@rdv.lieu.phone_number_formatted}"

- elsif @rdv.phone?
li.list-group-item
.fa.fa-phone>
span.fr-icon.fr-icon-phone-fill.fr-mr-1w[aria-hidden="true"]
| RDV Téléphonique

- if @rdv.motif.instruction_for_rdv.present?
li.list-group-item
i.fa.fa-exclamation-triangle>
span.fr-icon.fr-icon-warning-fill.fr-mr-1w[aria-hidden="true"]
strong Informations supplémentaires :
.pl-3.pt-1
= instruction_for_rdv_to_html(@rdv.motif)

li.list-group-item
i.fa.fa-users>
span.fr-icon.fr-icon-team-fill.fr-mr-1w[aria-hidden="true"]
| Participant

= form_tag users_rdv_participations_path(@rdv) do
Expand All @@ -51,4 +51,4 @@ ul.list-group.fr-mb-3w
.form-group
= link_to "Ajouter un proche", new_relative_path(ants_pre_demande_number_required: @rdv.requires_ants_predemande_number?), data: { modal: true }
.form-group
= submit_tag "Enregistrer", class: "btn btn-primary"
= submit_tag "Enregistrer", class: "fr-btn"
2 changes: 1 addition & 1 deletion app/views/users/rdvs/_file_attente.html.slim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- if rdv.available_to_file_attente?
li.list-group-item
i.fa.fa-bell>
span.fr-icon.fr-icon-notification-3-fill.fr-mr-1w[aria-hidden="true"]
| Vous souhaitez prendre RDV plus tôt ?
- fa = rdv.file_attentes.where(user: current_user).first || FileAttente.new(user: current_user, rdv: rdv)
= simple_form_for fa, url: users_file_attente_path, html: { method: :post, class: "form-inline" }, wrapper: :inline_form, remote: false do |f|
Expand Down
24 changes: 12 additions & 12 deletions app/views/users/rdvs/_rdv.html.slim
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
ul.list-group.list-group-flush.fr-mb-3w
li.list-group-item
.fa.fa-calendar>
span.fr-icon.fr-icon-calendar-fill.fr-mr-1w[aria-hidden="true"]
= rdv_title(rdv)
= rdv_tag(rdv)

- if rdv.motif.restriction_for_rdv.present?
li.list-group-item.alert.alert-warning
.fa.fa-warning>
span.fr-icon.fr-icon-warning-fill.fr-mr-1w[aria-hidden="true"]
= restriction_for_rdv_to_html(rdv.motif)

- if rdv.home?
li.list-group-item
.fa.fa-home>
span.fr-icon.fr-icon-home-4-fill.fr-mr-1w[aria-hidden="true"]
| Ce RDV se déroulera à domicile

- elsif rdv.public_office?
li.list-group-item
.fa.fa-map-marker-alt>
span.fr-icon.fr-icon-building-fill.fr-mr-1w[aria-hidden="true"]
= human_location(rdv)
- if rdv.lieu&.phone_number
span>
span.fa.fa-phone>
br
span.fr-icon.fr-icon-phone-fill.fr-mr-1w[aria-hidden="true"]
= link_to rdv.lieu.phone_number, "tel:#{rdv.lieu.phone_number_formatted}"

- elsif rdv.phone?
li.list-group-item
.fa.fa-phone>
span.fr-icon.fr-icon-phone-fill.fr-mr-1w[aria-hidden="true"]
| RDV Téléphonique

- elsif rdv.motif.visio?
li.list-group-item
.fa.fa-video-camera>
span.fr-icon.fr-icon-mac-fill.fr-mr-1w[aria-hidden="true"]
= "RDV par visioconférence "
= link_to("rejoindre la visioconférence", rdv.visio_url, target: :_blank)

li.list-group-item
.row
.col
.fa.fa-user>
span.fr-icon.fr-icon-user-fill.fr-mr-1w[aria-hidden="true"]
= users_to_sentence(rdv.users)
- if policy(rdv, policy_class: User::RdvPolicy).can_change_participants?
.col-auto
span>
= link_to "modifier", users_rdv_participations_path(rdv)
- if @can_see_rdv_motif
li.list-group-item
i.fa.fa-info-circle>
span.fr-icon.fr-icon-draft-fill.fr-mr-1w[aria-hidden="true"]
= rdv.motif_name
- if rdv.motif.instruction_for_rdv.present?
li.list-group-item
i.fa.fa-exclamation-triangle>
span.fr-icon.fr-icon-warning-fill.fr-mr-1w[aria-hidden="true"]
strong Informations supplémentaires :
.pl-3.pt-1
= instruction_for_rdv_to_html(rdv.motif)
Expand All @@ -63,7 +63,7 @@ ul.list-group.list-group-flush.fr-mb-3w
rdv.in_the_past?

li.list-group-item.font-italic
i.fa.fa-ban>
span.fr-icon.fr-icon-close-circle-fill.fr-mr-1w[aria-hidden="true"]
| Ce rendez-vous n'est pas annulable en ligne. Prenez contact avec le secrétariat.

ul.fr-btns-group.fr-btns-group--inline.fr-mb-0
Expand Down
12 changes: 6 additions & 6 deletions spec/features/users/user_can_manage_collective_rdv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ def select_lieu

def expect_cancel_participation
expect do
expect(page).to have_content("À venir")
expect(page).to have_content(/À venir/i)
click_on("Annuler votre participation")
click_link("Oui, annuler votre participation", match: :first)
expect(page).to have_content("Participation annulée")
expect(page).to have_content("Annulé")
expect(page).to have_content(/Annulé/i)
end
end

Expand Down Expand Up @@ -200,13 +200,13 @@ def expect_webhooks_for(user)
fill_in(:letter1, with: "N")
fill_in(:letter2, with: "V")

expect(page).to have_content("Annulé")
expect(page).to have_content(/Annulé/i)
create(:participation, rdv: rdv2, user: user, status: "revoked")
rdv2.status = "revoked"
rdv2.save

visit users_rdv_path(rdv2, invitation_token: rdv2.participation_token(user.id))
expect(page).to have_content("Annulé")
expect(page).to have_content(/Annulé/i)
end

it "doesnt send notifications email to user if notif is unchecked" do
Expand Down Expand Up @@ -356,13 +356,13 @@ def expect_webhooks_for(user)

visit users_rdv_path(rdv)

expect(page).to have_content("Annulé")
expect(page).to have_content(/Annulé/i)
create(:participation, rdv: rdv2, user: user, status: "revoked")
rdv2.status = "revoked"
rdv2.save

visit users_rdv_path(rdv2)
expect(page).to have_content("Annulé")
expect(page).to have_content(/Annulé/i)
end

it "doesnt send notifications email to user if notif is unchecked" do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/users/user_can_manage_rdv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
click_on("Annuler le RDV")
expect(page).to have_content("Confirmation")
click_link("Oui, annuler le rendez-vous")
expect(page).to have_selector(".badge", text: "Annulé")
expect(page).to have_selector(".fr-badge", text: "ANNULÉ")
end
end

Expand Down
Loading