Skip to content

stm9x9/spree_product_documents

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 [email protected], released under the New BSD License

About

Spree extension to attach documents to a product

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 65.6%
  • HTML 34.4%