otwarchive-symphonyarchive/app/helpers/orphans_helper.rb

16 lines
574 B
Ruby
Raw Permalink Normal View History

2026-03-11 22:22:11 +00:00
module OrphansHelper
# Renders the appropriate partial based on the class of object to be orphaned
def render_orphan_partial(to_be_orphaned)
if to_be_orphaned.is_a?(Series)
render 'orphans/orphan_series', series: to_be_orphaned
elsif to_be_orphaned.is_a?(Pseud)
render 'orphans/orphan_pseud', pseud: to_be_orphaned
elsif to_be_orphaned.is_a?(User)
render 'orphans/orphan_user', user: to_be_orphaned
else # either a single work or an array of works
render 'orphans/orphan_work', works: [to_be_orphaned].flatten
end
end
end