# Solidus Product Attachments This Solidus extension allows the administrator to upload files to a product or to a variant. [![Build Status](https://semaphoreci.com/api/v1/projects/c5f055f7-da80-440c-9f7b-c9c6c4a87bfa/2535219/shields_badge.svg)](https://semaphoreci.com/renuo/solidus_product_attachments) [![Gem Version](https://badge.fury.io/rb/solidus_product_attachments.svg)](https://badge.fury.io/rb/solidus_product_attachments) ## Installation Add `solidus_product_attachments` to your `Gemfile`: ```ruby gem 'solidus_product_attachments' ``` Bundle your dependencies and run the installation generator: ```shell bundle bundle exec rails g solidus_product_attachments:install ``` ## Usage ### Backend The usage of this extension is made very easy. All you have to do is to include it in your `Gemfile` and run the installer. After doing this, you can go to a product's page in the admin view and you'll notice a new `Documents` tab. Product documents tab The functionality of the documents upload is very similar to the images upload. You can upload a document per drag and drop or you can choose a file manually. ### Frontend This extension does not come with a frontend implementation of a download option for the users. It's completely up to you to add it, but you can inspire yourself from the following example: Download option example And the code (only for the product downloads, without css): ```erb <% if @product.attachments.any? %>

I18n.t('spree.product_download_title')

<% end %> ``` ## Testing First bundle your dependencies, then run `bundle exec rake`. This command will default to building the dummy app if it does not exist, then it will run the specs and [Rubocop](https://github.com/bbatsov/rubocop) static code analysis. The dummy app can be regenerated by using `bundle exec rake test_app`. ```shell bundle bundle exec rake ``` When testing your application's integration with this extension, you may use its factories. In order to do this, simply add this require statement to your spec_helper: ```ruby require 'solidus_product_attachments/testing_support/factories' ``` ## Copyright Copyright (c) 2024 [Renuo AG](https://www.renuo.ch/en), released under the New BSD License.