spree_variant_options 0.1.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +8 -0
- data/Gemfile +2 -0
- data/LICENSE +25 -0
- data/README.md +129 -0
- data/Rakefile +26 -0
- data/Versionfile +4 -0
- data/app/models/product_decorator.rb +27 -0
- data/app/views/products/_cart_form.html.erb +32 -0
- data/app/views/products/_variant_options.html.erb +43 -0
- data/config/cucumber.yml +8 -0
- data/features/step_definitions/variant_options.rb +125 -0
- data/features/step_definitions/web_steps.rb +138 -0
- data/features/support/env.rb +56 -0
- data/features/support/factories.rb +45 -0
- data/features/support/helper_methods.rb +28 -0
- data/features/support/paths.rb +36 -0
- data/features/support/selectors.rb +39 -0
- data/features/variant_options.feature +108 -0
- data/lib/dummy_hooks/after_migrate.rb.sample +1 -0
- data/lib/dummy_hooks/before_migrate.rb +1 -0
- data/lib/spree_variant_options.rb +26 -0
- data/lib/spree_variant_options/version.rb +3 -0
- data/public/images/out-of-stock.png +0 -0
- data/public/javascripts/product.js +38 -0
- data/public/javascripts/variant_options.js +211 -0
- data/public/stylesheets/variant_options.css +68 -0
- data/spree_variant_options.gemspec +37 -0
- data/test/test_helper.rb +22 -0
- data/test/unit/product_test.rb +46 -0
- metadata +217 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
#product-variants {
|
2
|
+
|
3
|
+
}
|
4
|
+
|
5
|
+
#product-details .price.unselected {
|
6
|
+
color: #bbb;
|
7
|
+
}
|
8
|
+
|
9
|
+
.variant-option-type {
|
10
|
+
margin-bottom: 0;
|
11
|
+
}
|
12
|
+
#product-variants ul.variant-option-values {
|
13
|
+
list-style-type: none;
|
14
|
+
margin-bottom: 1em;
|
15
|
+
}
|
16
|
+
.variant-option-values li {
|
17
|
+
display: block;
|
18
|
+
position: relative;
|
19
|
+
float: left;
|
20
|
+
}
|
21
|
+
.variant-option-values li a {
|
22
|
+
display: block;
|
23
|
+
background-color: #f9f9f9;
|
24
|
+
border: 2px solid #eee;
|
25
|
+
padding: 2px 9px;
|
26
|
+
margin: 3px 3px 0 0;
|
27
|
+
text-decoration: none;
|
28
|
+
cursor: pointer;
|
29
|
+
-webkit-border-radius: 4px;
|
30
|
+
-moz-border-radius: 4px;
|
31
|
+
border-radius: 4px;
|
32
|
+
}
|
33
|
+
.variant-option-values li.clear {
|
34
|
+
border: 0;
|
35
|
+
float: none;
|
36
|
+
clear: both;
|
37
|
+
}
|
38
|
+
li.clear-option a.clear-button {
|
39
|
+
display: none;
|
40
|
+
font-weight: bold;
|
41
|
+
background-color: #fff;
|
42
|
+
border-color: #FDE2E2;
|
43
|
+
color: #c00e0e;
|
44
|
+
}
|
45
|
+
li.clear-option a.clear-button:hover {
|
46
|
+
border-color: #c00e0e;
|
47
|
+
background-color: #EF2E2E;
|
48
|
+
color: #fff;
|
49
|
+
}
|
50
|
+
.option-value.selected,
|
51
|
+
.option-value.in-stock:hover {
|
52
|
+
background-color: #1491EB;
|
53
|
+
border-color: #1072B9;
|
54
|
+
color: #fff;
|
55
|
+
}
|
56
|
+
.option-value.out-of-stock {
|
57
|
+
display: block;
|
58
|
+
background: transparent url(/images/out-of-stock.png) 0 0 repeat;
|
59
|
+
color: #aaa;
|
60
|
+
cursor: default;
|
61
|
+
}
|
62
|
+
.option-value.locked,
|
63
|
+
.option-value.locked:hover {
|
64
|
+
background-color: #fff;
|
65
|
+
border-color: #f0f0f0;
|
66
|
+
color: #ddd;
|
67
|
+
cursor: default;
|
68
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "spree_variant_options/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "spree_variant_options"
|
7
|
+
s.version = SpreeVariantOptions::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Spencer Steffen"]
|
10
|
+
s.email = ["spencer@citrusme.com"]
|
11
|
+
s.homepage = "https://github.com/citrus/spree_variant_options"
|
12
|
+
s.summary = %q{Spree Variant Options is a very simple Spree extension that breaks your variants down into their option types and option values.}
|
13
|
+
s.description = %q{Spree Variant Options is a very simple Spree extension that breaks your variants down into their option types and option values. Please see the documentation for more details.}
|
14
|
+
|
15
|
+
s.rubyforge_project = "spree_variant_options"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
# Spree
|
23
|
+
s.add_dependency('spree_core', '>= 0.30.1')
|
24
|
+
|
25
|
+
# Development
|
26
|
+
s.add_development_dependency('spree_sample', '>= 0.60.0')
|
27
|
+
s.add_development_dependency('dummier', '>= 0.1.1')
|
28
|
+
s.add_development_dependency('shoulda', '>= 2.11.3')
|
29
|
+
s.add_development_dependency('spork', '>= 0.9.0.rc8')
|
30
|
+
s.add_development_dependency('spork-testunit', '>= 0.0.5')
|
31
|
+
s.add_development_dependency('factory_girl', '>= 2.0.0.beta2')
|
32
|
+
s.add_development_dependency('cucumber-rails', '>= 0.4.1')
|
33
|
+
s.add_development_dependency('database_cleaner', '>= 0.6.7')
|
34
|
+
s.add_development_dependency('capybara', '>= 0.4.1')
|
35
|
+
s.add_development_dependency('sqlite3', '>= 1.3.3')
|
36
|
+
|
37
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Configure Rails Envinronment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
require 'spork'
|
4
|
+
|
5
|
+
Spork.prefork do
|
6
|
+
|
7
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
8
|
+
require "rails/test_help"
|
9
|
+
require "shoulda"
|
10
|
+
require "factory_girl"
|
11
|
+
require "sqlite3"
|
12
|
+
require "faker"
|
13
|
+
|
14
|
+
# Run any available migration if needed
|
15
|
+
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
16
|
+
end
|
17
|
+
|
18
|
+
Spork.each_run do
|
19
|
+
|
20
|
+
load File.expand_path("../../features/support/factories.rb", __FILE__)
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
class ProductTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
setup do
|
6
|
+
@methods = %w(option_values grouped_option_values variant_options_hash)
|
7
|
+
end
|
8
|
+
|
9
|
+
context "any product" do
|
10
|
+
|
11
|
+
setup do
|
12
|
+
@product = Factory.create(:product)
|
13
|
+
end
|
14
|
+
|
15
|
+
should "have proper methods" do
|
16
|
+
@methods.each do |m|
|
17
|
+
assert @product.respond_to?(m)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
context "a product with variants" do
|
25
|
+
|
26
|
+
setup do
|
27
|
+
@product = Factory.create(:product_with_variants)
|
28
|
+
end
|
29
|
+
|
30
|
+
should "have variants and option types and values" do
|
31
|
+
assert_equal 2, @product.option_types.count
|
32
|
+
assert_equal 12, @product.option_values.count
|
33
|
+
assert_equal 32, @product.variants.count
|
34
|
+
end
|
35
|
+
|
36
|
+
should "have values grouped by type" do
|
37
|
+
expected = { "size" => 4, "color" => 8 }
|
38
|
+
assert_equal 2, @product.grouped_option_values.count
|
39
|
+
@product.grouped_option_values.each do |type, values|
|
40
|
+
assert_equal expected[type.name], values.length
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,217 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spree_variant_options
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: 6
|
5
|
+
version: 0.1.0.rc1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Spencer Steffen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-06-14 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: spree_core
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.30.1
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: spree_sample
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.60.0
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: dummier
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.1
|
46
|
+
type: :development
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: shoulda
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 2.11.3
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: spork
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.9.0.rc8
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: spork-testunit
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 0.0.5
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: factory_girl
|
84
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.0.0.beta2
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: cucumber-rails
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 0.4.1
|
101
|
+
type: :development
|
102
|
+
prerelease: false
|
103
|
+
version_requirements: *id008
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: database_cleaner
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 0.6.7
|
112
|
+
type: :development
|
113
|
+
prerelease: false
|
114
|
+
version_requirements: *id009
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: capybara
|
117
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 0.4.1
|
123
|
+
type: :development
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: *id010
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: sqlite3
|
128
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 1.3.3
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: *id011
|
137
|
+
description: Spree Variant Options is a very simple Spree extension that breaks your variants down into their option types and option values. Please see the documentation for more details.
|
138
|
+
email:
|
139
|
+
- spencer@citrusme.com
|
140
|
+
executables: []
|
141
|
+
|
142
|
+
extensions: []
|
143
|
+
|
144
|
+
extra_rdoc_files: []
|
145
|
+
|
146
|
+
files:
|
147
|
+
- .gitignore
|
148
|
+
- Gemfile
|
149
|
+
- LICENSE
|
150
|
+
- README.md
|
151
|
+
- Rakefile
|
152
|
+
- Versionfile
|
153
|
+
- app/models/product_decorator.rb
|
154
|
+
- app/views/products/_cart_form.html.erb
|
155
|
+
- app/views/products/_variant_options.html.erb
|
156
|
+
- config/cucumber.yml
|
157
|
+
- features/step_definitions/variant_options.rb
|
158
|
+
- features/step_definitions/web_steps.rb
|
159
|
+
- features/support/env.rb
|
160
|
+
- features/support/factories.rb
|
161
|
+
- features/support/helper_methods.rb
|
162
|
+
- features/support/paths.rb
|
163
|
+
- features/support/selectors.rb
|
164
|
+
- features/variant_options.feature
|
165
|
+
- lib/dummy_hooks/after_migrate.rb.sample
|
166
|
+
- lib/dummy_hooks/before_migrate.rb
|
167
|
+
- lib/spree_variant_options.rb
|
168
|
+
- lib/spree_variant_options/version.rb
|
169
|
+
- public/images/out-of-stock.png
|
170
|
+
- public/javascripts/product.js
|
171
|
+
- public/javascripts/variant_options.js
|
172
|
+
- public/stylesheets/variant_options.css
|
173
|
+
- spree_variant_options.gemspec
|
174
|
+
- test/test_helper.rb
|
175
|
+
- test/unit/product_test.rb
|
176
|
+
has_rdoc: true
|
177
|
+
homepage: https://github.com/citrus/spree_variant_options
|
178
|
+
licenses: []
|
179
|
+
|
180
|
+
post_install_message:
|
181
|
+
rdoc_options: []
|
182
|
+
|
183
|
+
require_paths:
|
184
|
+
- lib
|
185
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - ">="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
hash: -1055832908222487425
|
191
|
+
segments:
|
192
|
+
- 0
|
193
|
+
version: "0"
|
194
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
|
+
none: false
|
196
|
+
requirements:
|
197
|
+
- - ">"
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: 1.3.1
|
200
|
+
requirements: []
|
201
|
+
|
202
|
+
rubyforge_project: spree_variant_options
|
203
|
+
rubygems_version: 1.6.2
|
204
|
+
signing_key:
|
205
|
+
specification_version: 3
|
206
|
+
summary: Spree Variant Options is a very simple Spree extension that breaks your variants down into their option types and option values.
|
207
|
+
test_files:
|
208
|
+
- features/step_definitions/variant_options.rb
|
209
|
+
- features/step_definitions/web_steps.rb
|
210
|
+
- features/support/env.rb
|
211
|
+
- features/support/factories.rb
|
212
|
+
- features/support/helper_methods.rb
|
213
|
+
- features/support/paths.rb
|
214
|
+
- features/support/selectors.rb
|
215
|
+
- features/variant_options.feature
|
216
|
+
- test/test_helper.rb
|
217
|
+
- test/unit/product_test.rb
|