Commit 75a2431c authored by Klaus Stein's avatar Klaus Stein
Browse files

Improve signature display (wider field in overview, better part join)

parent 1c5f7f68
module ApplicationHelper
def joined(*strs, joiner: ' • ')
strs.compact.join(joiner)
end
end
......@@ -12,6 +12,7 @@
<table>
<tr class="field"><th><%= form.label :title %></th><td><%= form.text_field :title %></td></tr>
<tr class="field"><th><%= form.label :repo_doc_ref %></th><td><%= form.text_field :repo_doc_ref %> <%= form.text_field :repo_doc_ref_part %></td></tr>
<tr class="field" data-controller="nested-form"><th>Images</th><td>
<template data-nested-form-target="template">
<%= form.fields_for :image_maps, ImageMap.new, child_index: 'NEW_RECORD' do |image_map_fields| %>
......@@ -29,7 +30,6 @@
<tr class="field"><th><%= form.label :place_id %></th><td><%= form.collection_select(:place_id, Place.with_name, :id, :name, {include_blank: true}) %></td></tr>
<tr class="field"><th><%= form.label :categories %></th><td><%= form.collection_select(:category_ids, Category.all, :id, :name, {label: 'Category(s)'}, {multiple: true}) %></td></tr>
<tr class="field"><th><%= form.label :description %></th><td><%= form.text_area :description %></td></tr>
<tr class="field"><th><%= form.label :repo_doc_ref %></th><td><%= form.text_field :repo_doc_ref %> <%= form.text_field :repo_doc_ref_part %></td></tr>
<tr class="field"><th><%= form.label :repository %></th><td><%= form.collection_select(:repository_id, Repository.order(:name), :id, :name_with_location, include_blank: true) %></td></tr>
<tr class="field" data-controller="nested-form"><th>Dates:</th>
<td><div class="instructions">[Date format: <kbd>yyyy-mm-dd</kbd> (e.g. <kbd>1944-02-11</kbd>)]</div>
......
......@@ -64,8 +64,8 @@
place = place.to_s + " (#{map.district})" unless map.district.blank?
%>
<%= td(place, a: map.place, klass: 'wide') %>
<%= td(map.categories.map{|c| c.name}.join(' • '), klass: 'narrow') %>
<%= td((map.repo_doc_ref||'') + (map.repo_doc_ref_part || '') , klass: 'full') %>
<%= td(map.categories.sort.map{|c| c.name}.join(' • '), klass: 'narrow') %>
<%= td(joined(map.repo_doc_ref, map.repo_doc_ref_part) , klass: 'full') %>
<% repo = [map.repository&.name, map.repository&.location].compact.join(', ') %>
<%= td(repo, a: map.repository , klass: 'wide') %>
<%= td(map.description, klass: 'narrow') %>
......
......@@ -10,7 +10,7 @@
<%= editlink @map %>
</header>
<p class="repo">
<span class="signature"><%= @map.repo_doc_ref || '–?–' %> <%= @map.repo_doc_ref_part %></span>
<span class="signature"><%= joined(@map.repo_doc_ref || '–?–', @map.repo_doc_ref_part) %></span>
<% if @map.repository %>
<%= link_to @map.repository.name, @map.repository, class: 'repository' %>
<% else %>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment