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

Moved impersonate message to top of the page, put it in a red box #5802

Merged
merged 3 commits into from
Jun 12, 2024
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
7 changes: 7 additions & 0 deletions app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<header class="header pt-0">
<%= render 'layouts/banner' %>

<% if current_user != true_user %>
<%= link_to stop_impersonating_volunteers_path, method: :post, class: "pt-4 pb-4 bg-danger", style: "padding-left: 15px; display: block;" do %>
You (<%= true_user.display_name %>) are signed in as <%= current_user.display_name %>.
Click here to stop impersonating.
<% end %>
<% end %>

<div class="container-fluid pt-30">
<div class="row">
<div class="col-lg-5 col-md-5 col-6">
Expand Down
8 changes: 0 additions & 8 deletions app/views/layouts/_sidebar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@
{ title: "Edit Organization", icon: "cogs", path: edit_casa_org_path(current_organization), render_check: policy(:application).modify_organization? }
]) %>
<% end %>
<li>
<% if current_user != true_user %>
<%= link_to stop_impersonating_volunteers_path, method: :post, class: "mr-10 ml-10" do %>
You (<%= true_user.display_name %>) are signed in as <%= current_user.display_name %>.
Click here to stop impersonating.
<% end %>
<% end %>
</li>
</ul>
</nav>
</nav>
Expand Down
4 changes: 2 additions & 2 deletions spec/system/volunteers/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@

click_on "Impersonate"

within(".sidebar-nav-wrapper") do
within(".header") do
expect(page).to have_text(
"You (#{admin.display_name}) are signed in as John Doe. " \
"Click here to stop impersonating."
Expand All @@ -579,7 +579,7 @@

click_on "Impersonate"

within(".sidebar-nav-wrapper") do
within(".header") do
expect(page).to have_text(
"You (#{supervisor.display_name}) are signed in as John Doe. " \
"Click here to stop impersonating."
Expand Down
8 changes: 8 additions & 0 deletions spec/views/layouts/header.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,13 @@ def true_user

expect(rendered).to match "<strong>Role: Volunteer</strong>"
end

it "renders a stop impersonating link when impersonating" do
allow(view).to receive(:true_user).and_return(true_user)

render partial: "layouts/header"

expect(rendered).to have_link(href: "/volunteers/stop_impersonating")
end
end
end
13 changes: 0 additions & 13 deletions spec/views/layouts/sidebar.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,4 @@ def true_user
expect(rendered).to_not have_link("Emancipation Checklist", href: "/emancipation_checklists")
end
end

context "impersonation" do
let(:user) { build_stubbed :volunteer }
let(:true_user) { build_stubbed :casa_admin }

it "renders a stop impersonating link when impersonating" do
allow(view).to receive(:true_user).and_return(true_user)

render partial: "layouts/sidebar"

expect(rendered).to have_link(href: "/volunteers/stop_impersonating")
end
freestylebit marked this conversation as resolved.
Show resolved Hide resolved
end
end
Loading