docbrown/app/views/dashboards/analytics.erb
Monica Mateiu dbdd24c729
add org analytics menu if user has organizations (#13995)
* add organizations menu to analytics page

* Update app/views/dashboards/analytics.erb

Co-authored-by: rhymes <github@rhymes.dev>

* replace querySelector with getElementsByClassName for better performance

* Update app/javascript/packs/analyticsDashboard.js

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/views/dashboards/analytics.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* refactor analytics view and add specs

* skip flakey analyticsNavigation spec

Co-authored-by: rhymes <github@rhymes.dev>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-06-23 14:35:23 +02:00

43 lines
1.8 KiB
Text

<% title "Analytics" %>
<main id="main-content">
<div class="dashboard-container analytics-container crayons-layout" id="user-dashboard">
<% 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>
<li>
<a class="rounded-btn crayons-link--block organization"
href="<%= dashboard_analytics_path %>"
<%= params[:org_id] ? "" : 'aria-current="page"'.html_safe %>>
Your Dashboard
</a>
</li>
<% @organizations.each do |org| %>
<li>
<a
class="rounded-btn crayons-link--block organization"
href="<%= dashboard_analytics_org_path(org.id) %>"
data-organization-id="<%= org.id %>"
<%= params[:org_id].to_i == org.id ? 'aria-current="page"'.html_safe : "" %>>
<%= org.name %> Analytics Dashboard
</a>
</li>
<% 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>
<p>Welcome to the Analytics Dashboard, the home of in-depth user metrics so that authors can make data-driven decisions about the <%= Settings::Community.member_label %> ecosystem.</p>
<p>This dashboard highlights deep insights especially relevant to <%= Settings::Community.member_label %> relations, authors, and serious bloggers.</p>
</div>
<%= render "shared/stats" %>
</div>
</main>
<%= javascript_packs_with_chunks_tag "analyticsDashboard", defer: true %>