aboutsummaryrefslogtreecommitdiff
path: root/app/helpers/shared_searches_helper.rb
blob: dbbc67d8d0aefcf77aed81fdbd1bfd4dbdded59b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module SharedSearchesHelper
  # Returns `arg` as is if not blank, otherwise it returns '-'.
  def string_maybe(arg)
    arg.presence || '-'
  end

  # Format `ae.authors` depending on whether they are editors or not.
  def authors_or_editors(ae)
    if ae.editors
      "#{ae.authors} (eds.)"
    else
      ae.authors
    end
  end
end