Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Descriptive terms #275

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/helpers/orchid/display_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def metadata(res, label, api_field, link: true, separator: " | ")
end
end
html << dataArray
.map { |i| "<span>#{i}</span>" }
.map { |i| "<dd>#{i}</dd>" }
.join(separator)

sanitize html
Expand Down Expand Up @@ -56,7 +56,7 @@ def metadata_get_field_values(res, api_field)
# or could be used by overriding applications if desired
def metadata_label(label, length: nil)
# TODO add pluralization that uses locale
"<strong>#{label}:</strong> "
"<dt><strong>#{label}:</strong> </dt>"
end

end
20 changes: 6 additions & 14 deletions app/views/items/_search_res_items.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,27 @@
<h3><%= search_item_link(item) %></h3>
<div class="row">
<div class="<%= item["highlight"].present? ? "col-md-4" : "col-md-12" %> search_results_info">
<ul>
<dl>
<% if item["date_display"].present? %>
<li>
<%= metadata(item, t("search.results.item.date",
<%= metadata(item, t("search.results.item.date",
default: "Date"), "date_display", link: false) %>
</li>
<% end %>
<%# creator is a multivalued, nested field %>
<% if item["creator"].present? %>
<li>
<%= metadata(item, t("search.results.item.creator",
<%= metadata(item, t("search.results.item.creator",
default: "Creator"), "creator.name", link: false) %>
</li>
<% end %>
<%# format can be a multivalued or single keyword field %>
<% if item["format"].present? %>
<li>
<%= metadata(item, t("search.results.item.format",
<%= metadata(item, t("search.results.item.format",
default: "Format"), "format", link: false) %>
</li>
<% end %>
<%# source can be a multivalued or single keyword field %>
<% if item["source"].present? %>
<li>
<%= metadata(item, t("search.results.item.source",
<%= metadata(item, t("search.results.item.source",
default: "Source"), "source", link: false) %>
</li>
<% end %>
</ul>
</dl>
</div>
<% if item["highlight"].present? %>
<div class="col-md-8 search_results_text">
Expand Down
47 changes: 16 additions & 31 deletions app/views/items/_show_metadata.html.erb
Original file line number Diff line number Diff line change
@@ -1,59 +1,44 @@
<div class="metadata">
<ul>
<dl>
<% if @res["title"].present? %>
<li>
<%= metadata(@res, t("item.metadata.title", default: "Title"),
<%= metadata(@res, t("item.metadata.title", default: "Title"),
"title", link: false) %>
</li>
<% end %>
<% if @res["date_display"].present? %>
<li>
<%= metadata(@res, t("item.metadata.date", default: "Date"),
<%= metadata(@res, t("item.metadata.date", default: "Date"),
"date_display") %>
</li>
<% end %>
<% if @res["creator"].present? %>
<li>
<%= metadata(@res, t("item.metadata.creators", default: "Author(s)"),
<%= metadata(@res, t("item.metadata.creators", default: "Author(s)"),
"creator.name") %>
</li>
<% end %>
<% if @res["format"].present? %>
<li>
<%= metadata(@res, t("item.metadata.format", default: "Format"),
<%= metadata(@res, t("item.metadata.format", default: "Format"),
"format") %>
</li>
<% end %>
<% if @res["category"].present? %>
<li>
<%= metadata(@res, t("item.metadata.category", default: "Category"),
<%= metadata(@res, t("item.metadata.category", default: "Category"),
"category") %>
</li>
<% end %>
<% if @res["subcategory"].present? %>
<li>
<%= metadata(@res, t("item.metadata.subcategory",
<%= metadata(@res, t("item.metadata.subcategory",
default: "Subcategory"), "subcategory") %>
</li>
<% end %>
<% if @res["works"].present? %>
<li>
<%= metadata(@res, t("item.metadata.works", default: "Works"),
<%= metadata(@res, t("item.metadata.works", default: "Works"),
"works") %>
</li>
<% end %>
<% if @res["places"].present? %>
<li>
<%= metadata(@res, t("item.metadata.places", default: "Place(s)"),
<%= metadata(@res, t("item.metadata.places", default: "Place(s)"),
"places") %>
</li>
<% end %>
<%# When copying this template into projects, consider adding rel tag to the source link
to note the format and if the link is external %>
<% if @res["uri_data"].present? %>
<li><strong>Source Document: </strong>
<a href="<%= @res["uri_data"] %>"><%= File.basename(@res["uri_data"]) %></a>
</li>
<dt><strong>Source Document: </strong></dt>
<dl><a href="<%= @res["uri_data"] %>"><%= File.basename(@res["uri_data"]) %></a></dl>
<% end %>
</ul>
</dl>
<%# When copying this template into projects, consider adding rel tag to the source link
to note the format and if the link is external %>


</div>