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