Skip to content

Commit

Permalink
Merge pull request #586 from CDLUC3/feature/remove-user-entered-value…
Browse files Browse the repository at this point in the history
…-from-typeahead

Updated the typeahead controller to remove the user-entered value fro…
  • Loading branch information
jupiter007 authored May 13, 2024
2 parents 88f3247 + 7f1d8c0 commit 6726ea1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
7 changes: 0 additions & 7 deletions app/controllers/api/v3/typeaheads_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,6 @@ def process_results(term:, matches: [])
results = deduplicate(term: term, list: matches)
results.map(&:name).flatten.compact.uniq
out = paginate_response(results: results)

# Add the search term if it was not included in the results already
term_matched = results.select do |it|
it.name&.split(' (')&.first&.downcase&.strip == term.split(' (')&.first&.downcase&.strip
end
out.unshift(Org.new(name: term)) unless term_matched.any?
out
end

# Weighs the result. The greater the weight the closer the match, preferring Orgs already in use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ function ResearchOutputs() {
disabled={dataObj.repository.isLocked}
hidden={dataObj.repository.isLocked}
/>
<p class="dmpui-field-help">(e.g., "https://dataverse.org/")</p>
<p class="dmpui-field-help" hidden={dataObj.repository.isLocked}>(e.g., "https://dataverse.org/")</p>
</div>
</div>

Expand Down

0 comments on commit 6726ea1

Please sign in to comment.