mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Generalize get_logo helper for all classes
This commit is contained in:
parent
aee1f58607
commit
b2e1eb5fa9
4 changed files with 58 additions and 53 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
module SponsorsHelper
|
||||
# returns the url to be used for logo on basis of sponsorship level position
|
||||
def get_logo(sponsor)
|
||||
if sponsor.sponsorship_level.position == 1
|
||||
sponsor.picture.first.url
|
||||
elsif sponsor.sponsorship_level.position == 2
|
||||
sponsor.picture.second.url
|
||||
else
|
||||
sponsor.picture.others.url
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue