radiant-shop-extension 0.92.9 → 0.92.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/shop/tags/helpers.rb +27 -27
- data/radiant-shop-extension.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.92.
|
1
|
+
0.92.10
|
data/lib/shop/tags/helpers.rb
CHANGED
@@ -7,17 +7,17 @@ module Shop
|
|
7
7
|
def current_categories(tag)
|
8
8
|
result = []
|
9
9
|
|
10
|
-
# Returns the current categories if they exist
|
11
|
-
if tag.locals.shop_categories.present?
|
12
|
-
result = tag.locals.shop_categories
|
13
|
-
|
14
10
|
# Returns categories based on the slug of their categories parent page
|
15
|
-
|
11
|
+
if tag.attr['parent']
|
16
12
|
result = ShopCategory.all(
|
17
13
|
:joins => 'JOIN pages AS page ON page.id = shop_categories.page_id JOIN pages AS parent ON page.parent_id = parent.id',
|
18
14
|
:conditions => [ 'parent.slug = ?', tag.attr['parent'] ]
|
19
15
|
)
|
20
|
-
|
16
|
+
|
17
|
+
# Returns the current categories if they exist
|
18
|
+
elsif tag.locals.shop_categories.present?
|
19
|
+
result = tag.locals.shop_categories
|
20
|
+
|
21
21
|
# Page params are protected, send is used to overcome this
|
22
22
|
# elsif tag.locals.page.send(:params).has_key? 'query'
|
23
23
|
# result = ShopCategory.search(tag.locals.page.send(:params)['query'])
|
@@ -34,12 +34,8 @@ module Shop
|
|
34
34
|
def current_category(tag)
|
35
35
|
result = nil
|
36
36
|
|
37
|
-
# Returns the current shop_category
|
38
|
-
if tag.locals.shop_category.present?
|
39
|
-
result = tag.locals.shop_category
|
40
|
-
|
41
37
|
# Returns a category based on its name (page title)
|
42
|
-
|
38
|
+
if tag.attr['name']
|
43
39
|
result = ShopCategory.first(
|
44
40
|
:joins => :page,
|
45
41
|
:conditions => [ "pages.title = ?", tag.attr['name'] ]
|
@@ -51,6 +47,10 @@ module Shop
|
|
51
47
|
:joins => :page,
|
52
48
|
:conditions => [ "pages.slug = ?", tag.attr['handle'] ]
|
53
49
|
)
|
50
|
+
|
51
|
+
# Returns the current shop_category
|
52
|
+
elsif tag.locals.shop_category.present?
|
53
|
+
result = tag.locals.shop_category
|
54
54
|
|
55
55
|
# Returns the category of the current shop_product
|
56
56
|
elsif tag.locals.shop_product.present?
|
@@ -70,14 +70,14 @@ module Shop
|
|
70
70
|
def current_products(tag)
|
71
71
|
result = nil
|
72
72
|
|
73
|
-
if tag.
|
74
|
-
result = tag.locals.shop_products
|
75
|
-
|
76
|
-
elsif tag.attr['category']
|
73
|
+
if tag.attr['category']
|
77
74
|
result = ShopCategory.first(
|
78
75
|
:joins => :page,
|
79
76
|
:conditions => [ 'page.slug = ?', tag.attr['category'] ]
|
80
77
|
).products
|
78
|
+
|
79
|
+
elsif tag.locals.shop_products.present?
|
80
|
+
result = tag.locals.shop_products
|
81
81
|
|
82
82
|
elsif tag.locals.shop_category.present?
|
83
83
|
result = tag.locals.shop_category.products
|
@@ -96,11 +96,8 @@ module Shop
|
|
96
96
|
def current_product(tag)
|
97
97
|
result = nil
|
98
98
|
|
99
|
-
if tag.locals.shop_product.present?
|
100
|
-
result = tag.locals.shop_product
|
101
|
-
|
102
99
|
# Returns a product based on its name (page title)
|
103
|
-
|
100
|
+
if tag.attr['name']
|
104
101
|
result = ShopProduct.first(
|
105
102
|
:joins => :page,
|
106
103
|
:conditions => [ "pages.title = ?", tag.attr['name'] ]
|
@@ -112,6 +109,9 @@ module Shop
|
|
112
109
|
:joins => :page,
|
113
110
|
:conditions => [ "pages.slug = ?", tag.attr['sku'] ]
|
114
111
|
)
|
112
|
+
|
113
|
+
elsif tag.locals.shop_product.present?
|
114
|
+
result = tag.locals.shop_product
|
115
115
|
|
116
116
|
elsif tag.attr['position']
|
117
117
|
children = tag.locals.shop_category.page.children
|
@@ -132,11 +132,11 @@ module Shop
|
|
132
132
|
def current_image(tag)
|
133
133
|
result = nil
|
134
134
|
|
135
|
-
if tag.
|
136
|
-
result = tag.locals.image.image rescue tag.locals.image
|
137
|
-
|
138
|
-
elsif tag.attr['position']
|
135
|
+
if tag.attr['position']
|
139
136
|
result = tag.locals.images.find_by_position(tag.attr['position'].to_i)
|
137
|
+
|
138
|
+
elsif tag.locals.image.present?
|
139
|
+
result = tag.locals.image.image rescue tag.locals.image
|
140
140
|
|
141
141
|
end
|
142
142
|
|
@@ -146,11 +146,11 @@ module Shop
|
|
146
146
|
def current_order(tag)
|
147
147
|
result = nil
|
148
148
|
|
149
|
-
if tag.
|
150
|
-
result = tag.locals.shop_order
|
151
|
-
|
152
|
-
elsif tag.attr['key'] and tag.attr['value']
|
149
|
+
if tag.attr['key'] and tag.attr['value']
|
153
150
|
result = ShopOrder.first(:conditions => { tag.attr['key'].downcase.to_sym => tag.attr['value'] })
|
151
|
+
|
152
|
+
elsif tag.locals.shop_order.present?
|
153
|
+
result = tag.locals.shop_order
|
154
154
|
|
155
155
|
elsif tag.locals.page.request.session[:shop_order].present?
|
156
156
|
session = tag.locals.page.request.session[:shop_order]
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{radiant-shop-extension}
|
8
|
-
s.version = "0.92.
|
8
|
+
s.version = "0.92.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dirk Kelly", "John Barker", "Darcy Laycock"]
|
12
|
-
s.date = %q{2010-12-
|
12
|
+
s.date = %q{2010-12-23}
|
13
13
|
s.description = %q{Radiant Shop is an attempt at a simple but complete store. It includes Products, Categories, Orders and Credit Card Payments}
|
14
14
|
s.email = %q{dk@dirkkelly.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-shop-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 379
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 92
|
9
|
-
-
|
10
|
-
version: 0.92.
|
9
|
+
- 10
|
10
|
+
version: 0.92.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dirk Kelly
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-12-
|
20
|
+
date: 2010-12-23 00:00:00 +08:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|