Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

fix[#50499] Add first-breadcrumb-element css class in BreadcrumbHelper

Dominic Bräunleine333664faffc
diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb
index 6ba26624ab2..93e95b99ebb 100644
--- a/app/helpers/breadcrumb_helper.rb
+++ b/app/helpers/breadcrumb_helper.rb
@@ -30,13 +30,13 @@ module BreadcrumbHelper
def full_breadcrumbs
items = breadcrumb_paths.compact
render(Primer::Beta::Breadcrumbs.new(data: { 'test-selector': "op-breadcrumb" })) do |breadcrumbs|
- items.each do |item|
+ items.each_with_index do |item, index|
item = anchor_string_to_object(item) if item.is_a?(String) && item.start_with?("\u003c")
if item.is_a?(Hash)
- breadcrumbs.with_item(href: item[:href]) { item[:text] }
+ breadcrumbs.with_item(href: item[:href], classes: index == 0 ? "first-breadcrumb-element" : nil) { item[:text] }
else
- breadcrumbs.with_item(href: "#") { item }
+ breadcrumbs.with_item(href: "#", classes: index == 0 ? "first-breadcrumb-element" : nil) { item }
end
end
end