piggybak 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/app/models/piggybak/line_item.rb +1 -1
- data/app/models/piggybak/order.rb +0 -1
- data/lib/acts_as_sellable.rb +1 -8
- data/lib/piggybak.rb +11 -2
- data/lib/piggybak/version.rb +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -137,7 +137,7 @@ module Piggybak
|
|
137
137
|
end
|
138
138
|
|
139
139
|
def self.sorted_line_item_types
|
140
|
-
Piggybak::Config.line_item_types.sort { |a, b| a[1][:sort] <=> b[1][:sort] }.collect { |a| a[0] }
|
140
|
+
Piggybak::Config.line_item_types.sort { |a, b| (a[1][:sort] || 100) <=> (b[1][:sort] || 100) }.collect { |a| a[0] }
|
141
141
|
end
|
142
142
|
end
|
143
143
|
end
|
@@ -160,7 +160,6 @@ module Piggybak
|
|
160
160
|
else
|
161
161
|
if self.to_be_cancelled
|
162
162
|
self.status = "cancelled"
|
163
|
-
# TODO: line items scope doesn't work here, maybe on new items? Fix if possible.
|
164
163
|
elsif line_items.select { |li| li.line_item_type == "shipment" }.any? && line_items.select { |li| li.line_item_type == "shipment" }.all? { |s| s.shipment.status == "shipped" }
|
165
164
|
self.status = "shipped"
|
166
165
|
elsif line_items.select { |li| li.line_item_type == "shipment" }.any? && line_items.select { |li| li.line_item_type == "shipment" }.all? { |s| s.shipment.status == "processing" }
|
data/lib/acts_as_sellable.rb
CHANGED
@@ -3,19 +3,12 @@ module Piggybak
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
module ClassMethods
|
6
|
-
|
7
6
|
def acts_as_sellable
|
8
|
-
|
9
|
-
has_one :piggybak_sellable, :as => "item", :class_name => "::Piggybak::Sellable"
|
10
|
-
|
7
|
+
has_one :piggybak_sellable, :as => "item", :class_name => "::Piggybak::Sellable", :inverse_of => :item
|
11
8
|
accepts_nested_attributes_for :piggybak_sellable, :allow_destroy => true
|
12
|
-
|
13
9
|
end
|
14
|
-
|
15
10
|
end
|
16
11
|
end
|
17
12
|
end
|
18
13
|
|
19
14
|
::ActiveRecord::Base.send :include, Piggybak::ActsAsSellable
|
20
|
-
|
21
|
-
|
data/lib/piggybak.rb
CHANGED
@@ -51,8 +51,6 @@ module Piggybak
|
|
51
51
|
end
|
52
52
|
Piggybak::Order.class_eval do
|
53
53
|
define_method "#{k}_charge" do
|
54
|
-
# Scope doesn't work here for lookup of unsaved elements
|
55
|
-
# TODO: Figure out if we can fix, or specify behavior
|
56
54
|
charge = 0
|
57
55
|
self.line_items.each do |li|
|
58
56
|
next if li._destroy || li.line_item_type.to_sym != k
|
@@ -112,7 +110,18 @@ module Piggybak
|
|
112
110
|
end
|
113
111
|
|
114
112
|
config.model Piggybak::Sellable do
|
113
|
+
label "Sellable"
|
114
|
+
object_label_method :admin_label
|
115
115
|
visible false
|
116
|
+
edit do
|
117
|
+
field :sku
|
118
|
+
field :description
|
119
|
+
field :price
|
120
|
+
field :active
|
121
|
+
field :unlimited_inventory do
|
122
|
+
help "If true, backorders on this variant will be allowed, regardless of quantity on hand."
|
123
|
+
end
|
124
|
+
end
|
116
125
|
end
|
117
126
|
|
118
127
|
config.model Piggybak::Order do
|
data/lib/piggybak/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: piggybak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-10-
|
14
|
+
date: 2012-10-22 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -208,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
208
208
|
version: '0'
|
209
209
|
segments:
|
210
210
|
- 0
|
211
|
-
hash:
|
211
|
+
hash: 1894853370905249501
|
212
212
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
213
213
|
none: false
|
214
214
|
requirements:
|
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
217
|
version: '0'
|
218
218
|
segments:
|
219
219
|
- 0
|
220
|
-
hash:
|
220
|
+
hash: 1894853370905249501
|
221
221
|
requirements: []
|
222
222
|
rubyforge_project:
|
223
223
|
rubygems_version: 1.8.23
|