Sha256: 15b7513b8b33e8dd0d1e1983701a8681649204f7f445fd6bd08779a4beeac39c

Contents?: true

Size: 721 Bytes

Versions: 23

Compression:

Stored size: 721 Bytes

Contents

class Formtastic::Inputs::GridInput
  include Formtastic::Inputs::Base

  def to_html
    object = builder.object
    assets = object.send(method)

    ul = template.content_tag :ul do
      html = template.raw("")

      assets.each do |asset|
        html += template.content_tag :li do
          builder.fields_for(method, asset) do |f|
            thumbnail_html = template.image_tag f.object.asset.thumb.url
            template.link_to thumbnail_html, f.object.asset.url
          end
        end
      end

      html += template.content_tag :li do
        builder.fields_for(method, assets.build) do |f|
          f.file_field :asset
        end
      end

      html
    end

    input_wrapping { ul }
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
lalala-4.0.0.dev.94 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.92 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.90 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.84 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.80 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.79 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.78 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.77 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.74 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.73 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.72 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.71 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.66 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.65 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.64 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.63 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.62 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.61 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.60 lib/formtastic/inputs/grid_input.rb
lalala-4.0.0.dev.59 lib/formtastic/inputs/grid_input.rb