Skip to content

Commit

Permalink
Merge pull request openSUSE#17272 from hellcp-work/label-filtering-fix
Browse files Browse the repository at this point in the history
Distinguish the link badge from labels
  • Loading branch information
hellcp-work authored Jan 15, 2025
2 parents e3c1489 + 8ba1b78 commit 0a5a1c6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/api/app/datatables/package_datatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def data
def name_with_link(record)
name = []
name << link_to(record.name, package_show_path(package: record, project: @project))
name << tag.span('Link', class: 'badge text-bg-info') if record.package_kinds.any? { |package_kind| package_kind.kind == 'link' }
name << link_tag if record.package_kinds.any? { |package_kind| package_kind.kind == 'link' }
safe_join(name, ' ')
end

Expand All @@ -51,4 +51,15 @@ def labels_list(labels)
list = labels.map { |label| tag.span(label.name, class: "badge label-#{label.id}") }
safe_join(list, ' ')
end

private

def link_tag
tag.span(class: 'badge text-body border') do
# Using String Concatenation changes the behavior of this line
# rubocop:disable Style/StringConcatenation
tag.i(class: 'fas fa-link') + ' Link'
# rubocop:enable Style/StringConcatenation
end
end
end

0 comments on commit 0a5a1c6

Please sign in to comment.