Sha256: 766133449d2bb039b0a55f81ffe3004e8e783784caf38a43b7b91edf2bda38a4

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

h1. Ample Assets

AmpleAssets is a mountable engine that provides drag & drop file-management for Rails 3.2 applications.

!http://ample.github.com/ample_assets/images/assets.png!

h3. Example Usage

Add the following to your Gemfile and bundle...

<code>
gem 'ample_assets', :git => 'https://github.com/ample/ample_assets.git'
</code>

Run the generator to copy over the necessary migrations... 

<code>
rails g ample_assets:install
</code>

You'll need to create a foreign_key on the model with which you plan to integrate AmpleAssets. For the purposes of this example, let's assume your model is named @Post@...

<code>rails g migration add_file_id_to_posts file_id:integer</code>

Now you're ready to migrate... 

<code>rake db:migrate</code>

Add the following plugin to your model... 

<pre><code>class Post < ActiveRecord::Base
  ...
  has_asset
  ...
end</code></pre>

In both of your manifest files (stylesheets & javascripts) require ample_assets, for example...

<pre><code>/**
 *= require ample_assets
 */
</code></pre>

Add the engine to your app's routes.rb file... 

<code>
mount AmpleAssets::Engine => "/ample_assets", :as => "ample_assets"
</code>

To invoke the asset toolbar, include the following in any view...

<code>
<%= assets_toolbar %>
</code>

To invoke a new drop_target, include the following within a form attached to your model... 

<pre><code><%= form_for current_page do |f| %>
  <%= f.asset_drop(:file_id) %>
<% end %>
</code></pre>

h3. Configuration

<pre><code>AmpleAssets.configure do |config|
  config.mount_at = YOUR PATH PREFIX
end
</code></pre>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ample_assets-0.0.2 README.textile
ample_assets-0.0.1 README.textile