From 804c99fce66998ddcfd4970ff2c63141915bafd1 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 1 Jul 2025 21:11:07 +0200 Subject: searches: Add rich text description MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows for adding rich content to searches so it can be displayed in shared searches, for example. Signed-off-by: Miquel Sabaté Solà --- app/views/shared_searches/show.html.erb | 71 +++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 30 deletions(-) (limited to 'app/views/shared_searches') diff --git a/app/views/shared_searches/show.html.erb b/app/views/shared_searches/show.html.erb index d981cde..ed605bd 100644 --- a/app/views/shared_searches/show.html.erb +++ b/app/views/shared_searches/show.html.erb @@ -1,30 +1,41 @@ - - <% @search.results.values.flatten.each do |res| %> - - - - <% end %> -
-
- <% if res.is_a? Thing %> - <%= res.title %> -
-
<%= I18n.t('activerecord.attributes.thing.authors') %>: <%= authors_or_editors(res) %>
-
<%= I18n.t('activerecord.attributes.thing.publisher') %>: <%= string_maybe(res.publisher) %>
-
<%= I18n.t('activerecord.attributes.thing.year') %>: <%= string_maybe(res.year) %>
-
<%= I18n.t('activerecord.attributes.thing.kind') %>: <%= I18n.t("things.kind.#{res.kind}") %>
- <% if res.note.present? %> -
<%= I18n.t('activerecord.attributes.thing.note') %>: <%= res.note %>
- <% end %> - <% unless res.url.blank? %> - - <% end %> -
- <% else %> - <%= I18n.t('comments.title') %> <%= I18n.t('general.in') %> «<%= res.thing.title %>» -
- <%= res.content %> -
- <% end %> -
-
+<% unless @search.description.blank? %> +
+ <%= @search.description %> +
+
+<% end %> + +<% if @results.empty? %> +

<%= I18n.t('searches.none') %>.

+<% else %> + + <% @results.each do |res| %> + + + + <% end %> +
+
+ <% if res.is_a? Thing %> + <%= res.title %> +
+
<%= I18n.t('activerecord.attributes.thing.authors') %>: <%= authors_or_editors(res) %>
+
<%= I18n.t('activerecord.attributes.thing.publisher') %>: <%= string_maybe(res.publisher) %>
+
<%= I18n.t('activerecord.attributes.thing.year') %>: <%= string_maybe(res.year) %>
+
<%= I18n.t('activerecord.attributes.thing.kind') %>: <%= I18n.t("things.kind.#{res.kind}") %>
+ <% if res.note.present? %> +
<%= I18n.t('activerecord.attributes.thing.note') %>: <%= res.note %>
+ <% end %> + <% unless res.url.blank? %> + + <% end %> +
+ <% else %> + <%= I18n.t('comments.title') %> <%= I18n.t('general.in') %> «<%= res.thing.title %>» +
+ <%= res.content %> +
+ <% end %> +
+
+<% end %> -- cgit v1.2.3