diff --git a/app/components/admin/stats/sdg_component.html.erb b/app/components/admin/stats/sdg_component.html.erb index 754380b4b..c8900eb52 100644 --- a/app/components/admin/stats/sdg_component.html.erb +++ b/app/components/admin/stats/sdg_component.html.erb @@ -1,4 +1,4 @@ -<%= back_link_to %> +<%= back_link_to admin_stats_path %> <%= header %> diff --git a/app/views/admin/stats/direct_messages.html.erb b/app/views/admin/stats/direct_messages.html.erb index df5621a13..ff9ccbc8c 100644 --- a/app/views/admin/stats/direct_messages.html.erb +++ b/app/views/admin/stats/direct_messages.html.erb @@ -1,4 +1,4 @@ -<%= back_link_to %> +<%= back_link_to admin_stats_path %>

<%= t("admin.stats.direct_messages.title") %>

diff --git a/app/views/admin/stats/polls.html.erb b/app/views/admin/stats/polls.html.erb index 178d06bcb..7c30c0093 100644 --- a/app/views/admin/stats/polls.html.erb +++ b/app/views/admin/stats/polls.html.erb @@ -1,4 +1,4 @@ -<%= back_link_to %> +<%= back_link_to admin_stats_path %>

<%= t("admin.stats.polls.title") %>

diff --git a/app/views/admin/stats/proposal_notifications.html.erb b/app/views/admin/stats/proposal_notifications.html.erb index 4a5501177..4c66ca46e 100644 --- a/app/views/admin/stats/proposal_notifications.html.erb +++ b/app/views/admin/stats/proposal_notifications.html.erb @@ -1,4 +1,4 @@ -<%= back_link_to %> +<%= back_link_to admin_stats_path %>

<%= t("admin.stats.proposal_notifications.title") %>

diff --git a/app/views/admin/stats/show.html.erb b/app/views/admin/stats/show.html.erb index 286ded1f0..c0c6d0706 100644 --- a/app/views/admin/stats/show.html.erb +++ b/app/views/admin/stats/show.html.erb @@ -1,3 +1,7 @@ +<% content_for :head do %> + <%= javascript_include_tag "stat_graphs", "data-turbolinks-track" => "reload" %> +<% end %> +
diff --git a/spec/components/admin/stats/sdg_component_spec.rb b/spec/components/admin/stats/sdg_component_spec.rb new file mode 100644 index 000000000..2f222b44f --- /dev/null +++ b/spec/components/admin/stats/sdg_component_spec.rb @@ -0,0 +1,11 @@ +require "rails_helper" + +describe Admin::Stats::SDGComponent do + include Rails.application.routes.url_helpers + + it "renders a links to go back to the admin stats index" do + render_inline Admin::Stats::SDGComponent.new(SDG::Goal.all) + + expect(page).to have_link "Go back", href: admin_stats_path + end +end diff --git a/spec/system/admin/stats_spec.rb b/spec/system/admin/stats_spec.rb index fe6103b75..9ac12611c 100644 --- a/spec/system/admin/stats_spec.rb +++ b/spec/system/admin/stats_spec.rb @@ -183,6 +183,8 @@ describe "Stats", :admin do visit admin_stats_path click_link "Proposal notifications" + expect(page).to have_link "Go back", href: admin_stats_path + within("#proposal_notifications_count") do expect(page).to have_content "3" end @@ -232,6 +234,8 @@ describe "Stats", :admin do visit admin_stats_path click_link "Direct messages" + expect(page).to have_link "Go back", href: admin_stats_path + within("#direct_messages_count") do expect(page).to have_content "3" end @@ -253,6 +257,8 @@ describe "Stats", :admin do click_link "Polls" end + expect(page).to have_link "Go back", href: admin_stats_path + within("#web_participants") do expect(page).to have_content "3" end