From a7791635aa98f012d35f97c3c5288494bbb28e38 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 13 Mar 2024 18:03:43 +0100 Subject: Initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- app/helpers/shared_searches_helper.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 app/helpers/shared_searches_helper.rb (limited to 'app/helpers') 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 -- cgit v1.2.3