Skip to content

Commit

Permalink
fix: hide register button in conference when no registration types (#…
Browse files Browse the repository at this point in the history
…1221)

* fix: hide register button in conference when no registration types

* lint: add missing space in conference show view page
  • Loading branch information
Stef-Rousset authored Apr 19, 2024
1 parent 5a3bb1f commit 6f092fe
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<% if current_participatory_space.registrations_enabled? %>
<% if current_participatory_space.has_registration_for?(current_user) %>
<%= link_to t("layouts.decidim.conference_hero.manage_registration"), decidim_conferences.conference_registration_types_path(current_participatory_space), class: "button button__lg button__primary" %>
<% else %>
<% elsif current_participatory_space.registration_types.present? %>
<%= link_to t("layouts.decidim.conference_hero.register"), decidim_conferences.conference_registration_types_path(current_participatory_space), class: "button button__lg button__secondary" %>
<% end %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ edit_link(
<% if current_participatory_space.registrations_enabled? %>
<% if current_participatory_space.has_registration_for?(current_user) %>
<%= link_to t("decidim.conferences.conferences.show.manage_registration"), decidim_conferences.conference_registration_types_path(current_participatory_space), class: "button button__lg button__primary" %>
<% else %>
<% elsif current_participatory_space.registration_types.present? %>
<%= link_to t("decidim.conferences.conferences.show.register"), decidim_conferences.conference_registration_types_path(current_participatory_space), class: "button button__lg button__secondary" %>
<% end %>
<% end %>
Expand All @@ -85,7 +85,9 @@ edit_link(

<% if current_participatory_space.registrations_enabled? %>
<section class="content-block">
<h2 class="h2 decorator"><%= t("decidim.conferences.conferences.show.register") %></h2>
<% if current_participatory_space.registration_types.present? %>
<h2 class="h2 decorator"><%= t("decidim.conferences.conferences.show.register") %></h2>
<% end %>
<% if current_user.present? %>
<div class="conference__box">
<div>
Expand All @@ -96,7 +98,7 @@ edit_link(
<div>
<% if current_participatory_space.has_registration_for?(current_user) %>
<%= link_to t("decidim.conferences.conferences.show.manage_registration"), decidim_conferences.conference_registration_types_path(current_participatory_space), class: "button button__lg button__primary" %>
<% else %>
<% elsif current_participatory_space.registration_types.present? %>
<%= link_to t("decidim.conferences.conferences.show.register"), decidim_conferences.conference_registration_types_path(current_participatory_space), class: "button button__lg button__secondary" %>
<% end %>
</div>
Expand Down
17 changes: 13 additions & 4 deletions decidim-conferences/spec/system/conference_registrations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,24 @@ def visit_conference_registration_type
end
end

context "and there is no registrations types" do
let!(:registration_types) { [] }

context "and there is registrations types" do
it "allows to register" do
visit_conference
within ".conference__hero" do
expect(page).to have_content "Register"
click_on "Register"
expect(page).to have_content "CHOOSE YOUR REGISTRATION OPTION:"
end
expect(page).to have_content "CHOOSE YOUR REGISTRATION OPTION:"
end
end

context "and there is no registrations types" do
let(:registration_types) { [] }

it "does not show register button" do
visit_conference
within ".conference__hero" do
expect(page).to have_no_content "Register"
end
end
end
Expand Down

0 comments on commit 6f092fe

Please sign in to comment.