From e12e32225dabbdad726cee42cd5d8ecb125e7c52 Mon Sep 17 00:00:00 2001 From: Simon Mayer Date: Thu, 6 Oct 2022 15:08:06 +0200 Subject: [PATCH] Update dataset views for including text content of articles and compound articles --- app/views/dataset/_document.html.erb | 18 ++++++++---------- app/views/dataset/_documents.html.erb | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/views/dataset/_document.html.erb b/app/views/dataset/_document.html.erb index 8ab1625..3c27f28 100644 --- a/app/views/dataset/_document.html.erb +++ b/app/views/dataset/_document.html.erb @@ -3,15 +3,13 @@ data-action="click->dataset#toggleResultSelection" data-doc-id="<%= doc.id %>">
- <% - if doc.is_a?(Article) - url = "/catalog/#{doc.issue_id}?selected=#{doc.id}" + <% if doc.is_a?(Article) + url = "/catalog/#{doc.issue_id}?selected=#{doc.id}" elsif doc.is_a?(CompoundArticle) - url = "/catalog/#{doc.issue_id}?selected_compound=#{doc.id}" + url = "/catalog/#{doc.issue_id}?selected_compound=#{doc.id}" else - url = "/catalog/#{doc.id}" - end - %> + url = "/catalog/#{doc.id}" + end %> <%= doc_index %>. <%= doc.is_a?(Article) ? doc.id : doc.title %> @@ -30,9 +28,9 @@
<% if !highlight.nil? and !highlight.first.nil? %> - <% highlight.first[1].each do |extract| %> -

...<%= extract.gsub(/\n/,'
').gsub('

','
').html_safe %>...

- <% end %> + <%# highlight.first[1].each do |extract| %> +

<%= highlight unless doc.is_a?(Issue) %><%#= extract.gsub(/\n/, "
").gsub("

", "
").html_safe %>

+ <%# end %> <% end %>
diff --git a/app/views/dataset/_documents.html.erb b/app/views/dataset/_documents.html.erb index bf97719..5ffc056 100644 --- a/app/views/dataset/_documents.html.erb +++ b/app/views/dataset/_documents.html.erb @@ -1,7 +1,7 @@
<% docs.each_with_index do |doc, idx| %> <%# Highlight will be used when searching into a dataset %> - <%= render partial: "document", locals: {doc: doc, highlight: nil, doc_index: (pagenum-1) * rows + idx + 1} %> + <%= render partial: "document", locals: { doc: doc, highlight: doc.all_text, doc_index: (pagenum - 1) * rows + idx + 1 } %>
<% end %>
\ No newline at end of file -- GitLab