Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

fix(pages): set breadcrumbs for changelog and feedback pages (#2889)

Kenrick Tandrian6148cd463917
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index 6cc87f5e5f..5bd3ec0ccc 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -78,6 +78,7 @@ class PagesController < ApplicationController
end
def changelog
+ @breadcrumbs = [ [ t("breadcrumbs.home"), root_path ], [ t("breadcrumbs.changelog"), nil ] ]
@release_notes = github_provider.fetch_latest_release_notes
# Fallback if no release notes are available
@@ -95,6 +96,7 @@ class PagesController < ApplicationController
end
def feedback
+ @breadcrumbs = [ [ t("breadcrumbs.home"), root_path ], [ t("breadcrumbs.feedback"), nil ] ]
render layout: "settings"
end
diff --git a/app/views/layouts/shared/_breadcrumbs.html.erb b/app/views/layouts/shared/_breadcrumbs.html.erb
index bbe191b28e..f9739921cf 100644
--- a/app/views/layouts/shared/_breadcrumbs.html.erb
+++ b/app/views/layouts/shared/_breadcrumbs.html.erb
@@ -1,6 +1,6 @@
<%# locals: (breadcrumbs:) %>
-<div class="py-2 flex items-center gap-2">
+<div data-breadcrumbs class="py-2 flex items-center gap-2">
<% breadcrumbs.each_with_index do |(name, path), index| %>
<% if index > 0 %>
<%= icon("chevron-right", color: "gray", size: "sm") %>
diff --git a/config/locales/breadcrumbs/en.yml b/config/locales/breadcrumbs/en.yml
index a6cb9886a0..72ba7d7551 100644
--- a/config/locales/breadcrumbs/en.yml
+++ b/config/locales/breadcrumbs/en.yml
@@ -16,6 +16,7 @@ en:
budgets: Budgets
categories: Categories
categorize: Categorize
+ changelog: What's new
chats: Chats
coinbase_items: Coinbase
coinstats_items: CoinStats
@@ -29,6 +30,7 @@ en:
exports: Exports
family_exports: Exports
family_merchants: Merchants
+ feedback: Feedback
guides: Guides
holdings: Holdings
home: Home
diff --git a/test/controllers/pages_controller_test.rb b/test/controllers/pages_controller_test.rb
index 0159730ed3..c0f149194c 100644
--- a/test/controllers/pages_controller_test.rb
+++ b/test/controllers/pages_controller_test.rb
@@ -259,6 +259,7 @@ class PagesControllerTest < ActionDispatch::IntegrationTest
VCR.use_cassette("git_repository_provider/fetch_latest_release_notes") do
get changelog_path
assert_response :ok
+ assert_select "[data-breadcrumbs]", text: /What's new/
end
end
@@ -293,6 +294,12 @@ class PagesControllerTest < ActionDispatch::IntegrationTest
# Should not crash even with nil values
end
+ test "feedback" do
+ get feedback_path
+ assert_response :ok
+ assert_select "[data-breadcrumbs]", text: /Feedback/
+ end
+
private
def money_flow_bars
JSON.parse(css_select("[data-controller='bar-chart']").first["data-bar-chart-data-value"])