SpreeProductDocuments

Spree_product_documents is an Spree extension to attach documents related to a Product. Spree::Document class inherits from Spree::Resource and use spree_assets table, so no additional tables or assets are required.

This extension is heavily inspired in https://github.com/mosaic/spree_product_documents but has been adapted in order to work with Spree 2.4-stable branch.

Installation

Add spree_product_documents to your Gemfile:

gem 'spree_product_documents'

Bundle your dependencies and run the installation generator:

bundle

No generator is needed as no additional assets or tables are required.

Configuration

Currently, this extension supports application/pdf and application/zip content types. If you wish to support other content_types, you can create a new app_configuration_decorator.rb and override defined ones:

Spree::AppConfiguration.class_eval do
  preference :allowed_document_content_types, :array, :default => %w(application/pdf application/zip)
end

and be sure to restart your server.

After installation, a new tab "Documents" will appear in product tabs. It works exactly the same as images, you can attach as many documents as you want, related to a product or a specific variant.
Bear in mind that, nowadays, this extension does not include any overrides in the frontend.

Testing

First bundle your dependencies, then run rake. rake will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app.

bundle
bundle exec rake

When testing your applications integration with this extension you may use it's factories.
Simply add this require statement to your spec_helper:

require 'spree_product_documents/factories'

Copyright (c) 2015 Tania Rubio taniarubiov@gmail.com, released under the New BSD License

Comments

No comments yet

Please login to add comment.