Sha256: 71290ab70150ff00aa8df7b6f79c282a2778de8670495c839488019e527880af
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
module SpudBannersHelper def spud_banners_for_set(set_or_identifier, options = {}) if set_or_identifier.is_a?(SpudBannerSet) banner_set = set_or_identifier else banner_set = SpudBannerSet.find_by_identifier(set_or_identifier) end return '' if banner_set.blank? if block_given? banner_set.banners.each do |banner| yield(banner) end else content_tag(:div, :class => 'spud_banner_set', 'data-id' => banner_set.id) do banner_set.banners.map do |banner| concat(content_tag(:div, :class => 'spud_banner_set_banner', 'data-id' => banner.id){ spud_banner_tag(banner) }) end end end end def spud_banner_tag(banner) if banner.link_to.blank? spud_banner_image_tag(banner) else link_to(banner.link_to, :target => banner.link_target) do spud_banner_image_tag(banner) end end end def spud_banner_image_tag(banner) image_tag(banner.banner.url(:banner), :alt => banner.alt, :title => banner.title) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spud_banners-0.9.0.1 | app/helpers/spud_banners_helper.rb |
spud_banners-0.9.0 | app/helpers/spud_banners_helper.rb |
spud_banners-0.0.1 | app/helpers/spud_banners_helper.rb |