aboutsummaryrefslogtreecommitdiff
path: root/app/helpers/shared_searches_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/shared_searches_helper.rb')
-rw-r--r--app/helpers/shared_searches_helper.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/helpers/shared_searches_helper.rb b/app/helpers/shared_searches_helper.rb
new file mode 100644
index 0000000..dbbc67d
--- /dev/null
+++ b/app/helpers/shared_searches_helper.rb
@@ -0,0 +1,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