Low commit activity in last 3 years
There's a lot of open issues
A long-lived project that still receives updates
Downstream Media Library Rails Engine
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
 Project Readme

DSMediaLibrary

Build Status

A reusable Media Library for Downstream projects built as a Rails Engine.

Installation

Add this line to your application's Gemfile:

gem 'ds_media_library'

And then execute:

$ bundle

Usage

  1. Mount the engine at the path of your choosing in your routes:
# config/routes.rb
Rails.application.routes.draw do
  # ...
  mount DSMediaLibrary::Engine => "/media_library"
end
  1. Require the app's JavaScript and CSS assets:
// application.sass
@import ds_media_library
# application.coffee
#= require ds_media_library
  1. Add ds_node columns to your models:
# app/models/widget.rb
class Widget < ActiveRecord::Base
  ds_resource :cat_picture
  belongs_to_many_ds_resources :dog_pictures
end
  1. Install and run the migrations
rails ds_media_library:install:migrations
rails db:migrate
  1. Use the #media_library form helper where you would normally use the #file_field form helper:
/ app/views/widgets/form.html.slim
= form_for @widget do |form|
  = form.label :cat_picture
  = form.media_library :cat_picture

  = form.label :dog_pictures
  = form.media_library :dog_pictures, multiple: true
  1. Profit!

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake to run the tests.

You can also run bin/server to start a dummy app at http://localhost:3000 that will allow you to experiment. Note that the state of the app is destroyed on exit.

To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org. You can then run bundle update ds_media_library in projects that use it to update them to the newly-released version.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/botandrose/ds_media_library.

License

The gem is available as open source under the terms of the MIT License.