Sha256: 0a7a440ea8d9f7c1fccb72be654f96e53d1c2e86adde80f7a45f0552d02678c7

Contents?: true

Size: 1.13 KB

Versions: 105

Compression:

Stored size: 1.13 KB

Contents

# -*- encoding : utf-8 -*-
# not needed here, since this is only used in the views InlineForms::SPECIAL_COLUMN_TYPES[:info]=:string

# this will NOT stay in inline_forms, it belongs in an app.

def chicas_family_photo_list_show(object, attribute)
  # the attribute should be like members_photos
  # then it will look for object.family.members.photos
  # I know it's crappy.
  members, photos = attribute.to_s.split('_')
  photo_list = {}
  object.family.send(members).each do |member|
    member.send(photos).each do |photo|
      photo_list[photo.rating] ||= []
      photo_list[photo.rating] << photo
    end
  end
  out = ''
  if photo_list.empty?
    out = "<div class='row #{cycle('odd', 'even')}'>no photos</div>"
  else
    out << "<div class='row #{cycle('odd', 'even')}'>"
    photo_list.sort.reverse.each do |rating, photos|
      photos.each do |photo|
        out << image_tag(photo.image.url(:thumb), 
        	onclick: "this.src='#{photo.image.url(:palm)}'", 
        	onmouseout: "this.src='#{photo.image.url(:thumb)}'",
        	alt: photo.name,
        	title: photo.name)
      end
    end
    out << '</div>'
  end
  out.html_safe
end

Version data entries

105 entries across 105 versions & 1 rubygems

Version Path
inline_forms-6.2.14 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.2.12 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.2.11 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.2.10 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.2.9 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.2.7 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.2.6 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.2.5 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.2.4 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.2.3 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.2.2 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.2.1 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.1.1 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.1.0 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.0.8 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.0.7 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.0.6 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.0.5 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.0.4 app/helpers/form_elements/chicas_family_photo_list.rb
inline_forms-6.0.3 app/helpers/form_elements/chicas_family_photo_list.rb