Skip to content

Commit

Permalink
Fix titles
Browse files Browse the repository at this point in the history
  • Loading branch information
stitching-coder committed Nov 26, 2023
1 parent 7a31842 commit 4b969ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions public/app/models/solr_results.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def parse_record(result, full)
record.criteria = @search_opts
unless @raw['highlighting'][result['id']].nil?
record.highlights = @raw['highlighting'][result['id']]
record['title'][0..record.highlights["title"][0].length] = record.highlights["title"][0] unless record.highlights["title"].nil?
end
record
end
Expand Down
18 changes: 9 additions & 9 deletions public/app/views/shared/_idbadge.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,26 @@ end
<% else %>
<% url = result.uri %>
<% end %>
<%= rr %>
<%= (props.fetch(:full,false)? '<h1>' : '<h3>').html_safe %>
<% if !props.fetch(:full,false) %>
<a class="record-title" href="<%= app_prefix(url) %>">
<% if !rr.nil? %>
<% if !result.highlights.empty? && !result.highlights["title"].nil? %>
<%== result["title"].gsub(/<em>/, '<span class="searchterm">').gsub(/<\/em>/, '</span>') %>
<% elsif !rr.nil? %>
<% rr.each do |k| %>
<% highlights(k, result["title"]) %>
<% end %>
<%= result["title"].html_safe %>
<% elsif !@search.nil? %>
<% @search[:q].each do |q| %>
<% q.split(' ').each do |k| %>
<% highlights(k, result["title"]) %>
<% end %>
<% end %>
<%= result["title"].html_safe %>
<% else %>
<%== props.fetch(:infinite_item, false) ? result.parse_full_title(true) : result.display_string %>
<% end %>
</a>
<% elsif !rr.nil? %>
<% rr.each do |k| %>
<% highlights(k, result.display_string) %>
<% end %>
<%= result.display_string.html_safe %>
<% else %>
<%== result.display_string %>
<% end %>
Expand Down

0 comments on commit 4b969ad

Please sign in to comment.