Skip to content

Commit

Permalink
Ne pas afficher le bouton "Prendre un RDV" sur l'instance RDV-SP (#4808)
Browse files Browse the repository at this point in the history
* Ne pas afficher le bouton "Prendre un RDV" sur l'instance RDV-SP

* Ne pas montrer la barre de recherche sur RDV_MAIRIE

* Update specs

* Il va falloir s'occuper de séparer / et /prendre_rdv

* Ne pas afficher _address_selection.html.slim si on est sur un domaine qui n'offre pas la sélection d'adresse

* Bring back familiar matcher

* Bring back rubocop disable (will fix in next PR)
  • Loading branch information
francois-ferrandis authored Nov 20, 2024
1 parent a99f182 commit 3fd54e6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
9 changes: 8 additions & 1 deletion app/controllers/search_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def home
end
end

# rubocop:disable Metrics/PerceivedComplexity
def search_rdv
# TODO : public_link_organisation_id has to work if agent is logged in ?
if current_agent && params[:prescripteur] == Prescripteur::INTERNE && session[:agent_prescripteur_organisation_id]
Expand All @@ -24,9 +25,15 @@ def search_rdv
else
WebSearchContext.new(user: current_user, query_params: query_params)
end
render :search_rdv

if !current_domain.provides_address_selection? && @context.current_step == :address_selection
redirect_to root_path
else
render :search_rdv
end
end
end
# rubocop:enable Metrics/PerceivedComplexity

def public_link_with_internal_organisation_id
organisation = Organisation.find(params[:organisation_id])
Expand Down
6 changes: 5 additions & 1 deletion app/models/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Domain
dark_logo_path: "logos/logo_sombre_rdv_service_public.svg",
name: "RDV Service Public",
presentation_for_agents_template_name: "presentation_for_mairie",
address_selection_template_name: "search/address_selection/rdv_mairie",
address_selection_template_name: nil,
search_banner_template_name: "search/banners/rdv_mairie",
online_reservation_with_public_link: true,
can_sync_to_outlook: false,
Expand All @@ -80,6 +80,10 @@ class Domain
),
].freeze

def provides_address_selection?
address_selection_template_name.present?
end

def documentation_url
"https://rdv-service-public-1.gitbook.io/rdv-service-public"
end
Expand Down
12 changes: 0 additions & 12 deletions app/views/search/address_selection/_rdv_mairie.html.slim

This file was deleted.

3 changes: 2 additions & 1 deletion app/views/users/rdvs/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
= link_to "Voir vos prochains RDV", users_rdvs_path, class: "btn btn-outline-primary"
- else
= link_to "Voir vos RDV passés", users_rdvs_path(past: true), class: "btn btn-outline-primary"
= render "prendre_rdv_button"
- if current_domain.provides_address_selection?
= render "prendre_rdv_button"

- if @rdvs.any?
- @rdvs.each do |rdv|
Expand Down
6 changes: 4 additions & 2 deletions spec/features/users/online_booking/on_rdv_mairie_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ def json_response
expect(user.reload.ants_pre_demande_number).to eq("1122334455")
end

it "displays the organisation name for a public link and a generic name otherwise" do
it "redirects to the home page if visiting /prendre_rdv without params" do
visit prendre_rdv_url
expect(page).to have_content "Prenez rendez-vous avec votre mairie"
expect(page).to have_current_path("/")
end

it "displays the organisation name for a public link" do
visit public_link_to_org_url(organisation_id: organisation.id)
expect(page).to have_content "Prenez rendez-vous avec Mairie de Wavignies"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/models/domain_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RSpec.describe Domain do
it "has domains initialized with all the required keys" do
Domain::ALL.each do |domain|
expect(domain.to_h.compact.keys).to match_array(described_class.members)
expect(domain.to_h.keys).to match_array(described_class.members)
end
end

Expand Down

0 comments on commit 3fd54e6

Please sign in to comment.