diff --git a/src/library/title.cr b/src/library/title.cr index 52e9838..d72bb48 100644 --- a/src/library/title.cr +++ b/src/library/title.cr @@ -108,8 +108,18 @@ class Title ary.reverse end - def size - @entries.size + @title_ids.size + # Returns a string the describes the content of the title + # e.g., - 3 titles and 1 entry + # - 4 entries + # - 1 title + def content_label + ary = [] of String + tsize = titles.size + esize = entries.size + + ary << "#{tsize} #{tsize > 1 ? "titles" : "title"}" if tsize > 0 + ary << "#{esize} #{esize > 1 ? "entries" : "entry"}" if esize > 0 + ary.join " and " end def get_entry(eid) diff --git a/src/views/components/card.html.ecr b/src/views/components/card.html.ecr index a116fee..b85d39e 100644 --- a/src/views/components/card.html.ecr +++ b/src/views/components/card.html.ecr @@ -76,7 +76,7 @@ <% end %> <% if item.is_a? Title %> <% if grouped_count == 1 %> -
+ <% else %> <% end %> diff --git a/src/views/title.html.ecr b/src/views/title.html.ecr index 9d22f22..53db6ab 100644 --- a/src/views/title.html.ecr +++ b/src/views/title.html.ecr @@ -32,7 +32,7 @@ <%- end -%>