Generalize get_logo helper for all classes

This commit is contained in:
James Mason 2017-11-26 20:34:27 -08:00
parent aee1f58607
commit b2e1eb5fa9
4 changed files with 58 additions and 53 deletions

View file

@ -181,4 +181,19 @@ module ApplicationHelper
title: 'Open Source Event Manager'
)
end
# returns the url to be used for logo on basis of sponsorship level position
def get_logo(object)
if object.try(:sponsorship_level)
if object.sponsorship_level.position == 1
object.picture.first.url
elsif object.sponsorship_level.position == 2
object.picture.second.url
else
object.picture.others.url
end
else
object.picture.large.url
end
end
end