Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Paperclip into an extension #2328

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0be9c82
Remove images from product display permission
swcraig Sep 20, 2017
49f610a
Remove image from product management permission
swcraig Sep 20, 2017
aca060d
Remove images from product duplicator
swcraig Sep 20, 2017
2269b1c
Remove images from variant model
swcraig Sep 20, 2017
391c929
Remove images from Spree::Product
swcraig Sep 20, 2017
e63a3d8
Remove Paperclip attachment from Spree::Taxon
swcraig Sep 20, 2017
f118201
Remove image tab from products page in backend
swcraig Sep 20, 2017
7fead87
Remove shared image partial from backend
swcraig Sep 20, 2017
7494e42
Remove image scopes from API variants controller
swcraig Sep 22, 2017
e8210d4
Remove images from products controller spec
swcraig Sep 21, 2017
839a2d7
Remove images from orders controller spec
swcraig Sep 21, 2017
8426443
Remove image related translations
swcraig Sep 21, 2017
ac1ecad
Remove all JavaScript related to uploading images
swcraig Sep 21, 2017
20b59df
Remove image handlebars template from backend
swcraig Sep 21, 2017
a5abdda
Remove include_images variable in core search base
swcraig Sep 22, 2017
732b07f
Remove image stuff from permitted attributes
swcraig Sep 22, 2017
515e3b6
Remove image from API testing support helpers
swcraig Sep 22, 2017
4690656
Remove images from API base controller
swcraig Sep 22, 2017
4f7b484
Remove image-placeholder styles
swcraig Sep 26, 2017
82ff980
Remove images from order confirm line items
swcraig Sep 26, 2017
234ef2a
Remove image styles for stock table
swcraig Sep 27, 2017
8cd2173
Remove image-placeholder include for spree admin
swcraig Sep 27, 2017
2075d89
Remove images from backend products controller
swcraig Oct 6, 2017
f4dc9c5
Remove images from backend stock items controller
swcraig Oct 6, 2017
2b95fbb
Remove images from taxons form
swcraig Sep 29, 2017
db84d1c
Remove routes related to images in API
swcraig Oct 2, 2017
fdf32ee
Remove routes related to images in backend
swcraig Oct 4, 2017
d39fdf2
Remove the frontend shared partial for images
swcraig Oct 25, 2017
8c19b40
Remove images from frontend views
swcraig Oct 2, 2017
94a6411
Remove images from frontend product spec
swcraig Oct 2, 2017
d897d0f
Update README after pulling out Paperclip
swcraig Oct 3, 2017
0d76f9c
Remove paperclip as a dependency of core
swcraig Oct 3, 2017
6b275f0
Remove the images for the sample application
swcraig Oct 16, 2017
83b408a
Revise solidus_sample gemspec
swcraig Oct 16, 2017
7e9fde7
Remove backend sections products CSS
swcraig Oct 17, 2017
ad53b3d
Add solidus_paperclip to the sandbox
swcraig Oct 25, 2017
2df6997
Add galleries to Variants and Products
swcraig Oct 25, 2017
e50b894
Use `#gallery` in JBuilder templates
swcraig Oct 25, 2017
58634cc
Remove images from Spree::Product
swcraig Jun 6, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,13 @@ Try out Solidus with one-click on Heroku:

Getting started
---------------

Begin by making sure you have [Imagemagick](http://imagemagick.org/script/download.php) installed, which is required for Paperclip. (You can install it using [Homebrew](https://brew.sh) if you're on a Mac.)

To add solidus, begin with a Rails 5 application and a database configured and created. Add the following to your
Gemfile.

```ruby
gem 'solidus'
gem 'solidus_auth_devise'
gem 'solidus_paperclip'
```

Run the `bundle` command to install.
Expand Down
2 changes: 1 addition & 1 deletion api/app/controllers/spree/api/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def product_scope
end

def variants_associations
[{ option_values: :option_type }, :default_price, :images]
[{ option_values: :option_type }, :default_price]
end

def product_includes
Expand Down
2 changes: 1 addition & 1 deletion api/app/controllers/spree/api/variants_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def variant_params
end

def include_list
[{ option_values: :option_type }, :product, :default_price, :images, { stock_items: :stock_location }]
[{ option_values: :option_type }, :product, :default_price, { stock_items: :stock_location }]
end
end
end
Expand Down
6 changes: 0 additions & 6 deletions api/app/helpers/spree/api/api_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module ApiHelpers
:product_attributes,
:product_property_attributes,
:variant_attributes,
:image_attributes,
:option_value_attributes,
:order_attributes,
:line_item_attributes,
Expand Down Expand Up @@ -69,11 +68,6 @@ def required_fields_for(model)
:id, :property_id, :value, :property_name
]

@@image_attributes = [
:id, :position, :attachment_content_type, :attachment_file_name, :type,
:attachment_updated_at, :attachment_width, :attachment_height, :alt
]

@@option_value_attributes = [
:id, :name, :presentation, :option_type_name, :option_type_id,
:option_type_presentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ json.cache! [I18n.locale, line_item] do
json.variant do
json.partial!("spree/api/variants/small", variant: line_item.variant)
json.(line_item.variant, :product_id)
json.images(line_item.variant.images) do |image|
json.images(line_item.variant.gallery) do |image|
json.partial!("spree/api/images/image", image: image)
end
end
Expand Down
2 changes: 1 addition & 1 deletion api/app/views/spree/api/shipments/_big.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ json.cache! [I18n.locale, shipment] do
json.variant do
json.partial!("spree/api/variants/small", variant: inventory_unit.variant)
json.(inventory_unit.variant, :product_id)
json.images(inventory_unit.variant.images) do |image|
json.images(inventory_unit.variant.gallery) do |image|
json.partial!("spree/api/images/image", image: image)
end
end
Expand Down
2 changes: 1 addition & 1 deletion api/app/views/spree/api/variants/_small.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ json.cache! [I18n.locale, variant] do
json.option_values(variant.option_values) do |option_value|
json.(option_value, *option_value_attributes)
end
json.images(variant.images) do |image|
json.images(variant.gallery) do |image|
json.partial!("spree/api/images/image", image: image)
end
end
5 changes: 1 addition & 4 deletions api/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
resources :promotions, only: [:show]

resources :products do
resources :images
resources :variants
resources :product_properties
end
Expand Down Expand Up @@ -50,9 +49,7 @@
end
end

resources :variants do
resources :images
end
resources :variants

resources :option_types do
resources :option_values
Expand Down
8 changes: 0 additions & 8 deletions api/lib/spree/api/testing_support/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ def stub_authentication!
def current_api_user
@current_api_user ||= stub_model(Spree::LegacyUser, email: "spree@example.com", spree_roles: [])
end

def image(filename)
File.open(Spree::Api::Engine.root + "spec/fixtures" + filename)
end

def upload_image(filename)
fixture_file_upload(image(filename).path, 'image/jpg')
end
end
end
end
Expand Down
8 changes: 0 additions & 8 deletions api/spec/requests/spree/api/orders_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -598,14 +598,6 @@ module Spree
expect(order.adjustments).to be_empty
end

it "can list its line items with images" do
order.line_items.first.variant.images.create!(attachment: image("thinking-cat.jpg"))

get spree.api_order_path(order)

expect(json_response['line_items'].first['variant']).to have_attributes([:images])
end

it "lists variants product id" do
get spree.api_order_path(order)

Expand Down
12 changes: 0 additions & 12 deletions api/spec/requests/spree/api/products_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ module Spree
end

it "gets a single product" do
product.master.images.create!(attachment: image("thinking-cat.jpg"))
product.variants.create!
product.variants.first.images.create!(attachment: image("thinking-cat.jpg"))
product.set_property("spree", "rocks")
product.taxons << create(:taxon)

Expand All @@ -137,18 +135,8 @@ module Spree
expect(json_response['variants'].first).to have_attributes([:name,
:is_master,
:price,
:images,
:in_stock])

expect(json_response['variants'].first['images'].first).to have_attributes([:attachment_file_name,
:attachment_width,
:attachment_height,
:attachment_content_type,
:mini_url,
:small_url,
:product_url,
:large_url])

expect(json_response["product_properties"].first).to have_attributes([:value,
:product_id,
:property_name])
Expand Down
29 changes: 0 additions & 29 deletions api/spec/requests/spree/api/variants_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,6 @@ module Spree
:option_type_id])
end

it "variants returned contain images data" do
variant.images.create!(attachment: image("thinking-cat.jpg"))

get spree.api_variants_path

expect(json_response["variants"].last).to have_attributes([:images])
expect(json_response['variants'].first['images'].first).to have_attributes([:attachment_file_name,
:attachment_width,
:attachment_height,
:attachment_content_type,
:mini_url,
:small_url,
:product_url,
:large_url])
end

# Regression test for https://github.com/spree/spree/issues/2141
context "a deleted variant" do
before do
Expand Down Expand Up @@ -209,19 +193,6 @@ module Spree
:option_type_id])
end

it "can see a single variant with images" do
variant.images.create!(attachment: image("thinking-cat.jpg"))

subject

expect(json_response).to have_attributes(show_attributes + [:images])
option_values = json_response["option_values"]
expect(option_values.first).to have_attributes([:name,
:presentation,
:option_type_name,
:option_type_id])
end

context "variant doesn't have variant properties" do
before { subject }

Expand Down
2 changes: 0 additions & 2 deletions backend/app/assets/javascripts/spree/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
//= require spree/backend/flash
//= require spree/backend/gateway
//= require spree/backend/handlebars_extensions
//= require spree/backend/images/index
//= require spree/backend/images/upload
//= require spree/backend/locale_selection
//= require spree/backend/navigation
//= require spree/backend/option_type_autocomplete
Expand Down
27 changes: 0 additions & 27 deletions backend/app/assets/javascripts/spree/backend/images/upload.js

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//= require spree/backend/models/image_upload
//= require spree/backend/models/line_item
//= require spree/backend/models/order
//= require spree/backend/models/shipment
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
//= require spree/backend/templates/_image
//= require spree/backend/templates/orders/customer_details/autocomplete
//= require spree/backend/templates/orders/details_adjustment_row
//= require spree/backend/templates/orders/line_item
//= require spree/backend/templates/orders/shipment_tracking
//= require spree/backend/templates/orders/shipping_method
//= require spree/backend/templates/products/sortable
//= require spree/backend/templates/products/upload_progress
//= require spree/backend/templates/promotions/calculators/fields/tiered_flat_rate
//= require spree/backend/templates/promotions/calculators/fields/tiered_percent
//= require spree/backend/templates/promotions/rules/option_values
Expand Down

This file was deleted.

Loading