Skip to content
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
6 changes: 3 additions & 3 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions engine/app/views/coplan/welcome/_default_landing.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<div class="landing__cta-row">
<% if signed_in? %>
<%= link_to "Browse plans", plans_path, class: "btn btn--primary" %>
<% elsif main_app.respond_to?(:sign_in_path) %>
<%= link_to "Sign in", main_app.sign_in_path, class: "btn btn--primary" %>
Comment on lines +13 to +14

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use configured sign-in path for anonymous CTAs

In hosts that configure CoPlan's existing CoPlan.configuration.sign_in_path to something like Devise's /users/sign_in but do not define a route helper literally named sign_in_path, this condition stays false, so the signed-out landing page still renders without the new primary sign-in CTA. Protected engine pages already redirect via CoPlan.configuration.sign_in_path in CoPlan::ApplicationController#authenticate_coplan_user!, so this public CTA should use the same configured path instead of requiring a specific host helper name.

Useful? React with 👍 / 👎.

<% end %>
<%= link_to "Read the agent API", agent_instructions_path, class: "btn btn--secondary" %>
</div>
Expand Down
7 changes: 7 additions & 0 deletions engine/app/views/layouts/coplan/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@
<% end %>
</div>
</div>
<% elsif main_app.respond_to?(:sign_in_path) %>
<%# Signed-out visitors need a way in when the host exposes its own
sign-in route (hosts gating at the perimeter never render this
state — they arrive authenticated). %>
<div class="site-nav__right">
<%= link_to "Sign in", main_app.sign_in_path, class: "btn btn--primary btn--sm" %>
</div>
<% end %>
</div>
</nav>
Expand Down
14 changes: 14 additions & 0 deletions spec/requests/welcome_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@
end
end

context "anonymous visitor" do
it "offers a way to sign in (host exposes sign_in_path)" do
get root_path
expect(response).to have_http_status(:ok)
expect(response.body).to include(main_app.sign_in_path)
expect(response.body).to include("Sign in")
end

it "does not show the signed-in 'Browse plans' CTA" do
get root_path
expect(response.body).not_to include("Browse plans")
end
end

context "signed-in user with at least one plan" do
before do
sign_in_as(alice)
Expand Down
Loading