Sha256: b7c64e84e90267de44ae7bd6dce5106791e7b801a68322da35ffff94fee6bf5c
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 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_photo_list_show(object, attribute) # the attribute should be like members_photos # then it will look for object.members.photos # I know it's crappy. members, photos = attribute.to_s.split('_') photo_list = {} object.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)}'") end end out << '</div>' end out.html_safe end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
inline_forms-3.0.21 | lib/app/helpers/form_elements/chicas_photo_list.rb |