Fix Analytics Dashboard Page missing "Back To Dashboard" button (#14310)

* fix analytic page have no back-to-dashboard button when user have no organization

* resolve conflict with main

* remove dump

* add test for back to dashboard button
This commit is contained in:
zeotuan 2021-08-11 20:57:01 +10:00 committed by GitHub
parent 3d1727b3a8
commit 991f8b4baa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View file

@ -1,12 +1,12 @@
<% title "Analytics" %>
<main class="dashboard-container analytics-container crayons-layout" id="main-content">
<% if @organizations.any? %>
<nav aria-label="Dashboards">
<ul class="list-none">
<li>
<a href="<%= dashboard_path %>" class="rounded-btn crayons-link--block rounded-btn--transparent">👈 Back to Main Dashboard</a>
</li>
<nav aria-label="Dashboards">
<ul class="list-none">
<li>
<a href="<%= dashboard_path %>" class="rounded-btn crayons-link--block rounded-btn--transparent">👈 Back to Main Dashboard</a>
</li>
<% if @organizations.any? %>
<li>
<a class="rounded-btn crayons-link--block organization"
href="<%= dashboard_analytics_path %>"
@ -25,9 +25,10 @@
</a>
</li>
<% end %>
<% end %>
</ul>
</nav>
<% end %>
<div class="crayons-card p-3 mt-5">
<h1 class="fs-4xl fw-medium">Analytics Dashboard for <%= @user_or_org.name %></h1>

View file

@ -268,6 +268,14 @@ RSpec.describe "Dashboards", type: :request do
get "/dashboard/analytics"
expect(response.body).to include("Analytics")
end
it "page always contain back to dashboard button" do
sign_in user
get "/dashboard/analytics"
within "nav" do
expect(page).to have_selector("a[href='/dashboard']")
end
end
end
context "when user is an org admin" do