radiant-shop-extension 0.94.5 → 0.94.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.94.5
1
+ 0.94.6
@@ -1,7 +1,6 @@
1
1
  class ShopCategory < ActiveRecord::Base
2
2
 
3
- default_scope :joins => 'JOIN pages AS page ON page.id = shop_categories.page_id JOIN pages AS parent ON page.parent_id = parent.id',
4
- :order => 'parent.position, page.position ASC'
3
+ default_scope :order => 'shop_categories.position ASC'
5
4
 
6
5
  belongs_to :page, :dependent => :destroy
7
6
  belongs_to :created_by, :class_name => 'User'
@@ -68,9 +67,9 @@ class ShopCategory < ActiveRecord::Base
68
67
 
69
68
  # Sorts a group of categories based on their ID and position in an array
70
69
  def sort(category_ids)
71
- category_ids.each_with_index do |id, index|
72
- ShopCategory.find(id).page.update_attributes!(
73
- :position => index+1
70
+ category_ids.each_with_index do |id,index|
71
+ ShopCategory.find(id).update_attributes!(
72
+ :position => index
74
73
  )
75
74
  end
76
75
  end
@@ -6,7 +6,7 @@
6
6
  - body.name do
7
7
  %span.name.attribute= link_to category.name, edit_admin_shop_category_path(category)
8
8
  - body.handle do
9
- %span.handle.attribute= category.handle
9
+ %span.handle.attribute= category.page.url
10
10
  - body.modify do
11
11
  .modify
12
12
  %span.add_child= link_to t('add_product'), new_admin_shop_category_product_path(category)
@@ -0,0 +1,9 @@
1
+ class AddPositionToShopCategory < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :shop_categories, :position, :integer
4
+ end
5
+
6
+ def self.down
7
+ remove_column :shop_categories, :position
8
+ end
9
+ end
@@ -30,7 +30,12 @@ module Shop
30
30
 
31
31
  [:id, :name, :phone, :email, :unit, :street_1, :street_2, :city, :state, :country, :postcode].each do |method|
32
32
  tag "shop:cart:#{of_type}:#{method}" do |tag|
33
- tag.locals.send(of_type).send(method) rescue nil # Rescue is so we can have null inputs if no address exists
33
+ # Rescue is so we can have null inputs if no address exists
34
+ result = (tag.locals.send(of_type).send(method) rescue nil)
35
+ result = (Forms::Tags::Responses.current(tag,request).result[of_type.to_sym][method] rescue nil) unless result.present?
36
+ result = (UserActionObserver.current_user.send(of_type).send(method) rescue nil) unless result.present?
37
+
38
+ result
34
39
  end
35
40
  end
36
41
  end
@@ -48,6 +48,12 @@ module Shop
48
48
  :conditions => [ "pages.slug = ?", tag.attr['handle'] ]
49
49
  )
50
50
 
51
+ elsif tag.locals.page.shop_category.present?
52
+ result = tag.locals.page.shop_category
53
+
54
+ elsif tag.locals.page.shop_product.present?
55
+ result = tag.locals.page.shop_product.category
56
+
51
57
  # Returns the current shop_category
52
58
  elsif tag.locals.shop_category.present?
53
59
  result = tag.locals.shop_category
@@ -55,12 +61,6 @@ module Shop
55
61
  # Returns the category of the current shop_product
56
62
  elsif tag.locals.shop_product.present?
57
63
  result = tag.locals.shop_product.category
58
-
59
- elsif tag.locals.page.shop_category.present?
60
- result = tag.locals.page.shop_category
61
-
62
- elsif tag.locals.page.shop_product.present?
63
- result = tag.locals.page.shop_product.category
64
64
 
65
65
  end
66
66
 
@@ -73,7 +73,7 @@ module Shop
73
73
  if tag.attr['category']
74
74
  result = ShopCategory.first(
75
75
  :joins => :page,
76
- :conditions => [ 'page.slug = ?', tag.attr['category'] ]
76
+ :conditions => [ 'pages.slug = ?', tag.attr['category'] ]
77
77
  ).products
78
78
 
79
79
  elsif tag.locals.shop_products.present?
@@ -109,6 +109,9 @@ module Shop
109
109
  :joins => :page,
110
110
  :conditions => [ "pages.slug = ?", tag.attr['sku'] ]
111
111
  )
112
+
113
+ elsif tag.locals.page.shop_product.present?
114
+ result = tag.locals.page.shop_product
112
115
 
113
116
  elsif tag.locals.shop_product.present?
114
117
  result = tag.locals.shop_product
@@ -120,9 +123,6 @@ module Shop
120
123
 
121
124
  elsif tag.locals.shop_line_item.present? and tag.locals.shop_line_item.item_type === 'ShopProduct'
122
125
  result = tag.locals.shop_line_item.item
123
-
124
- elsif tag.locals.page.shop_product.present?
125
- result = tag.locals.page.shop_product
126
126
 
127
127
  end
128
128
 
@@ -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.94.5"
8
+ s.version = "0.94.6"
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{2011-01-27}
12
+ s.date = %q{2011-02-21}
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 = [
@@ -142,6 +142,7 @@ Gem::Specification.new do |s|
142
142
  "db/migrate/20101208045754_address_changes.rb",
143
143
  "db/migrate/20101208121105_move_to_page_attachments.rb",
144
144
  "db/migrate/20101214023052_fix_addressable_column_type.rb",
145
+ "db/migrate/20110119095350_add_position_to_shop_category.rb",
145
146
  "db/seed.rb",
146
147
  "db/seeds/forms.rb",
147
148
  "db/seeds/layouts.rb",
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: 365
4
+ hash: 363
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 94
9
- - 5
10
- version: 0.94.5
9
+ - 6
10
+ version: 0.94.6
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: 2011-01-27 00:00:00 +08:00
20
+ date: 2011-02-21 00:00:00 +08:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -299,6 +299,7 @@ files:
299
299
  - db/migrate/20101208045754_address_changes.rb
300
300
  - db/migrate/20101208121105_move_to_page_attachments.rb
301
301
  - db/migrate/20101214023052_fix_addressable_column_type.rb
302
+ - db/migrate/20110119095350_add_position_to_shop_category.rb
302
303
  - db/seed.rb
303
304
  - db/seeds/forms.rb
304
305
  - db/seeds/layouts.rb