Sha256: 38e6ef5580267fc84a13433785936ed31bd16c7fcb02e93a6a0b916dd51284b4
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
module Assetable::Uploaders # Gallery preview is a set of assets. Let's loop over the assets in the # gallery and create a preview for each. def gallery_preview fieldname if modal_gallery = object.send("#{attribute_name}") gallery = "" # modal_gallery.assets.each do |asset| modal_gallery.asset_attachments.each_with_index do |asset_attachment, index| # gallery += asset_preview(asset, :gallery, fieldname) gallery += ActionController::Base.new.send(:render_to_string, partial: "assetable/shared/templates/gallery_item", locals: { asset: asset_attachment.asset, asset_attachment: asset_attachment, fieldname: fieldname, index: index }) end gallery end end def asset_preview asset, type=:asset, fieldname=nil ActionController::Base.new.send(:render_to_string, partial: "assetable/shared/templates/#{type.downcase.to_s}_item", locals: { asset: asset, fieldname: fieldname }) end def directions_html directions=nil ActionController::Base.new.send(:render_to_string, partial: 'assetable/assets/directions', locals: {directions: directions}) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
assetable-0.2.4 | lib/assetable/inputs/uploaders.rb |