No commit activity in last 3 years
No release in over 3 years
Generates a simple form that is compatible with S3's form API. You can upload S3 assets directly to S3 without hitting your server.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

S3 Form Presenter

Generates a simple form that is compatible with S3's form API. You can upload S3 assets directly to S3 without hitting your server.

Usage

<% S3FormPresenter::Form.new("some/key/path.ext", "http://www.theredirecttowebsite.com/redirect/to/this/path") do %>
  <input name="file" type="file">
  <input type="submit" value="Save File">
<% end %>

Sinatra Integration (this will be put in a module one day)

helpers do
  def s3_form(*args, &block)
    buff = capture_erb(*args, &block)
    form = S3FormPresenter::Form.new(*args)
    form.inner_content = buff
    @_out_buf << form.to_html
  end

  def capture_erb(*args, &block)
    erb_with_output_buffer { block_given? && block.call(*args) }
  end

  def erb_with_output_buffer(buf = '') #:nodoc:
    @_out_buf, old_buffer = buf, @_out_buf
    yield
    @_out_buf
  ensure
    @_out_buf = old_buffer
  end
end