Module: BrickLayer::ViewHelper

Defined in:
app/helpers/brick_layer/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#list_of_sizes_for(data_set, image_attribute) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'app/helpers/brick_layer/view_helper.rb', line 2

def list_of_sizes_for(data_set, image_attribute)
  if data_set.class.custom_field_options && data_set.class.custom_field_options[image_attribute.to_sym]
    sizes = data_set.class.custom_field_options[image_attribute.to_sym][:sizes]
    if !sizes.blank?
      html = ""
      sizes.each do |k,v|
        html += (:li, link_to("#{k.to_s.titlecase} #{image_attribute.titlecase}", data_set.send(image_attribute).thumb(v).url, { :target => "_blank"}))
      end
      (:ul, raw(html), { :class => "image-links"} )
    end
  end
end