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

upgrade from 0.5.0 to 3.1.0 #1

Merged
merged 4 commits into from
May 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ test/dummy_hooks/after_migrate.rb
test/dummy
capybara-*.html
.rvmrc
spec/dummy
.byebug_history
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# encoding: UTF-8
require 'bundler'
require 'rubygems'
require 'spree/testing_support/common_rake'
begin
require 'bundler/setup'
rescue LoadError
Expand All @@ -23,4 +25,10 @@ Cucumber::Rake::Task.new do |t|
t.cucumber_opts = %w{--format pretty}
end

desc 'Generates a dummy app for testing'
task :test_app do
ENV['LIB_NAME'] = 'spree_variant_options'
Rake::Task['common:test_app'].invoke
end

task :default => [ :test, :cucumber ]
1 change: 0 additions & 1 deletion app/assets/javascripts/spree_variant_options.js

This file was deleted.

24 changes: 0 additions & 24 deletions app/assets/javascripts/store/product_variant_options.js

This file was deleted.

235 changes: 0 additions & 235 deletions app/assets/javascripts/store/variant_options.js

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/stylesheets/spree_variant_options.css

This file was deleted.

18 changes: 0 additions & 18 deletions app/controllers/spree/admin/option_values_controller.rb

This file was deleted.

4 changes: 2 additions & 2 deletions app/models/spree/app_configuration/variant_configuration.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module SpreeVariantOptions
class VariantConfiguration < Spree::Preferences::Configuration
preference :allow_select_outofstock, :boolean, :default => false
preference :default_instock, :boolean, :default => false
preference :allow_select_outofstock, :boolean, default: false
preference :default_instock, :boolean, default: false
end
end
21 changes: 7 additions & 14 deletions app/models/spree/option_value_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
Spree::OptionValue.class_eval do

attr_accessible :image

default_scope order("#{quoted_table_name}.position")

has_attached_file :image,
:styles => { :small => '40x30#', :large => '140x110#' },
:default_style => :small,
:url => "/spree/option_values/:id/:style/:basename.:extension",
:path => ":rails_root/public/spree/option_values/:id/:style/:basename.:extension"
styles: { small: '40x30#', large: '140x110#' },
default_style: :small,
url: "/spree/option_values/:id/:style/:basename.:extension",
path: ":rails_root/public/spree/option_values/:id/:style/:basename.:extension"

include Spree::Core::S3Support
supports_s3 :image
validates_attachment :image, content_type: { content_type: /\Aimage\/.*\Z/ },
size: { in: 0..1.megabytes }

def has_image?
image_file_name && !image_file_name.empty?
!!(image_file_name && !image_file_name.empty?)
end

scope :for_product, lambda { |product| select("DISTINCT #{table_name}.*").where("spree_option_values_variants.variant_id IN (?)", product.variant_ids).joins(:variants)
}
end
Loading