aboutsummaryrefslogtreecommitdiff
path: root/app/views/shared_searches/show.html.erb
blob: 30ea3f566846205d55069e6ec59a8b3dec233b58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<% unless @search.description.blank? %>
    <div>
        <%= @search.description %>
        <br />
    </div>
<% end %>

<% if @results.empty? %>
    <p><%= I18n.t('searches.none') %>.</p>
<% else %>
    <table id="public-search-table">
        <% @results.each do |res| %>
            <tr>
                <td>
                    <details>
                        <% if res.is_a? Thing %>
                            <summary><%= res.title %></summary>
                            <div class="details-flex">
                                <div><span><b><%= I18n.t('activerecord.attributes.thing.authors') %></b>: <%= authors_or_editors(res).gsub('_', '') %></span></div>
                                <div><span><b><%= I18n.t('activerecord.attributes.thing.publisher') %></b>: <%= string_maybe(res.publisher) %></span></div>
                                <div><span><b><%= I18n.t('activerecord.attributes.thing.year') %></b>: <%= string_maybe(res.year) %></span></div>
                                <div><span><b><%= I18n.t('activerecord.attributes.thing.kind') %></b>: <%= I18n.t("things.kind.#{res.kind}") %></span></div>
                                <% if res.note.present? %>
                                    <div><span><b><%= I18n.t('activerecord.attributes.thing.note') %></b>: <%= res.note %></span></div>
                                <% end %>
                                <% unless res.url.blank? %>
                                    <div><span><a href="<%= res.url %>" target="_blank"><%= I18n.t('activerecord.attributes.thing.url') %></a></span></div>
                                <% end %>
                            </div>
                        <% else %>
                            <summary><b><%= I18n.t('comments.title') %></b> <%= I18n.t('general.in') %> «<i><%= res.thing.title %></i>»</summary>
                            <div class="details-flex">
                                <%= res.content %>
                            </div>
                        <% end %>
                    </details>
                </td>
            </tr>
        <% end %>
    </table>
<% end %>