Skip to content

Commit

Permalink
Merge pull request #17237 from opf/chore/render-short-in-value-selection
Browse files Browse the repository at this point in the history
[chore] render item shorts in value selector
  • Loading branch information
Kharonus authored Nov 20, 2024
2 parents 2d0c7fd + ce1500c commit 3c22b56
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ def _type
end

self_link path: :custom_field_item,
title_getter: ->(*) { represented.label }
title_getter: ->(*) do
if represented.short.nil?
represented.label
else
"#{represented.label} (#{represented.short})"
end
end

property :id

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
it_behaves_like "has a titled link" do
let(:link) { "self" }
let(:href) { api_v3_paths.custom_field_item(item.id) }
let(:title) { item.label }
let(:title) { "#{item.label} (#{item.short})" }
end

it_behaves_like "has a titled link" do
Expand Down Expand Up @@ -171,7 +171,7 @@
it_behaves_like "has a titled link" do
let(:link) { "self" }
let(:href) { api_v3_paths.custom_field_item(item.id) }
let(:title) { item.label }
let(:title) { "#{item.label} (#{item.short})" }
end

it_behaves_like "has a titled link" do
Expand Down

0 comments on commit 3c22b56

Please sign in to comment.