Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'rc'

  • Loading branch information...
commit a2a75a76bc39fc8f750dfb89338003cb3cd8feae 2 parents 4c190fe + d4d4d8a
Dirk Kelly authored
Showing with 1,005 additions and 5,376 deletions.
  1. +42 −0 LICENSE
  2. +0 −20 MIT-LICENSE
  3. +41 −25 README.md
  4. +1 −2  Rakefile
  5. +1 −0  app/controllers/admin/shop/categories_controller.rb
  6. +0 −44 app/controllers/admin/shop/discounts/discountables_controller.rb
  7. +0 −64 app/controllers/admin/shop/discounts_controller.rb
  8. +0 −90 app/controllers/admin/shop/packages/packings_controller.rb
  9. +0 −63 app/controllers/admin/shop/packages_controller.rb
  10. +0 −27 app/controllers/admin/shop/products/variant_templates_controller.rb
  11. +0 −60 app/controllers/admin/shop/products/variants_controller.rb
  12. +2 −7 app/controllers/admin/shop/products_controller.rb
  13. +0 −48 app/controllers/admin/shop/variants_controller.rb
  14. +5 −5 app/models/form_address.rb
  15. +25 −17 app/models/form_checkout.rb
  16. +0 −39 app/models/form_discount.rb
  17. +15 −5 app/models/shop_category.rb
  18. +0 −37 app/models/shop_discount.rb
  19. +0 −64 app/models/shop_discountable.rb
  20. +0 −15 app/models/shop_group.rb
  21. +0 −6 app/models/shop_grouping.rb
  22. +15 −24 app/models/shop_line_item.rb
  23. +0 −2  app/models/shop_order.rb
  24. +0 −74 app/models/shop_package.rb
  25. +0 −22 app/models/shop_packing.rb
  26. +14 −17 app/models/shop_product.rb
  27. +0 −34 app/models/shop_product_variant.rb
  28. +0 −23 app/models/shop_variant.rb
  29. BIN  app/views/.DS_Store
  30. +0 −4 app/views/admin/pages/_shop_category.html.haml
  31. +0 −4 app/views/admin/pages/_shop_product.html.haml
  32. +2 −0  app/views/admin/shop/categories/edit/meta/_status.html.haml
  33. +0 −11 app/views/admin/shop/discounts/edit.html.haml
  34. +0 −16 app/views/admin/shop/discounts/edit/_foot.html.haml
  35. +0 −15 app/views/admin/shop/discounts/edit/_form.html.haml
  36. +0 −4 app/views/admin/shop/discounts/edit/_head.html.haml
  37. +0 −2  app/views/admin/shop/discounts/edit/_inputs.html.haml
  38. +0 −8 app/views/admin/shop/discounts/edit/_meta.html.haml
  39. +0 −9 app/views/admin/shop/discounts/edit/_parts.html.haml
  40. +0 −4 app/views/admin/shop/discounts/edit/_popups.html.haml
  41. +0 −1  app/views/admin/shop/discounts/edit/buttons/_browse_categories.html.haml
  42. +0 −1  app/views/admin/shop/discounts/edit/buttons/_browse_products.html.haml
  43. +0 −3  app/views/admin/shop/discounts/edit/inputs/_amount.html.haml
  44. +0 −3  app/views/admin/shop/discounts/edit/inputs/_code.html.haml
  45. +0 −3  app/views/admin/shop/discounts/edit/inputs/_name.html.haml
  46. +0 −5 app/views/admin/shop/discounts/edit/meta/_finish.html.haml
  47. +0 −5 app/views/admin/shop/discounts/edit/meta/_start.html.haml
  48. +0 −3  app/views/admin/shop/discounts/edit/parts/_categories.html.haml
  49. +0 −3  app/views/admin/shop/discounts/edit/parts/_products.html.haml
  50. +0 −6 app/views/admin/shop/discounts/edit/popups/_browse_categories.html.haml
  51. +0 −6 app/views/admin/shop/discounts/edit/popups/_browse_products.html.haml
  52. +0 −11 app/views/admin/shop/discounts/edit/shared/_category.html.haml
  53. +0 −12 app/views/admin/shop/discounts/edit/shared/_product.html.haml
  54. +0 −13 app/views/admin/shop/discounts/index.html.haml
  55. +0 −13 app/views/admin/shop/discounts/index/_discount.html.haml
  56. +0 −5 app/views/admin/shop/discounts/index/_foot.html.haml
  57. +0 −2  app/views/admin/shop/discounts/index/_head.html.haml
  58. +0 −1  app/views/admin/shop/discounts/index/buttons/_new_discount.html.haml
  59. +0 −11 app/views/admin/shop/discounts/new.html.haml
  60. +0 −12 app/views/admin/shop/discounts/remove.html.haml
  61. +0 −11 app/views/admin/shop/packages/edit.html.haml
  62. +0 −17 app/views/admin/shop/packages/edit/_foot.html.haml
  63. +0 −15 app/views/admin/shop/packages/edit/_form.html.haml
  64. +0 −4 app/views/admin/shop/packages/edit/_head.html.haml
  65. +0 −2  app/views/admin/shop/packages/edit/_inputs.html.haml
  66. +0 −8 app/views/admin/shop/packages/edit/_meta.html.haml
  67. +0 −9 app/views/admin/shop/packages/edit/_parts.html.haml
  68. +0 −4 app/views/admin/shop/packages/edit/_popups.html.haml
  69. +0 −1  app/views/admin/shop/packages/edit/buttons/_browse_products.html.haml
  70. +0 −3  app/views/admin/shop/packages/edit/inputs/_name.html.haml
  71. +0 −3  app/views/admin/shop/packages/edit/inputs/_price.html.haml
  72. +0 −5 app/views/admin/shop/packages/edit/meta/_sku.html.haml
  73. +0 −1  app/views/admin/shop/packages/edit/parts/_description.html.haml
  74. +0 −3  app/views/admin/shop/packages/edit/parts/_products.html.haml
  75. +0 −7 app/views/admin/shop/packages/edit/popups/_browse_products.html.haml
  76. +0 −8 app/views/admin/shop/packages/edit/shared/_product.html.haml
  77. +0 −13 app/views/admin/shop/packages/index.html.haml
  78. +0 −8 app/views/admin/shop/packages/index/_foot.html.haml
  79. +0 −2  app/views/admin/shop/packages/index/_head.html.haml
  80. +0 −9 app/views/admin/shop/packages/index/_package.html.haml
  81. +0 −1  app/views/admin/shop/packages/index/buttons/_new_package.html.haml
  82. +0 −11 app/views/admin/shop/packages/new.html.haml
  83. +0 −12 app/views/admin/shop/packages/remove.html.haml
  84. +0 −1  app/views/admin/shop/products/edit/buttons/_browse_templates.html.haml
  85. +0 −1  app/views/admin/shop/products/edit/buttons/_new_variant.html.haml
  86. +6 −0 app/views/admin/shop/products/edit/meta/_layout.html.haml
  87. +2 −0  app/views/admin/shop/products/edit/meta/_status.html.haml
  88. +0 −3  app/views/admin/shop/products/edit/parts/_variants.html.haml
  89. +0 −6 app/views/admin/shop/products/edit/popups/_browse_templates.html.haml
  90. +0 −16 app/views/admin/shop/products/edit/popups/_new_variant.html.haml
  91. +0 −6 app/views/admin/shop/products/edit/shared/_template.html.haml
  92. +0 −10 app/views/admin/shop/products/edit/shared/_variant.html.haml
  93. +0 −1  app/views/admin/shop/products/index/buttons/_variants.html.haml
  94. +0 −11 app/views/admin/shop/variants/edit.html.haml
  95. +0 −9 app/views/admin/shop/variants/edit/_foot.html.haml
  96. +0 −13 app/views/admin/shop/variants/edit/_form.html.haml
  97. +0 −4 app/views/admin/shop/variants/edit/_head.html.haml
  98. +0 −2  app/views/admin/shop/variants/edit/_inputs.html.haml
  99. +0 −8 app/views/admin/shop/variants/edit/_meta.html.haml
  100. +0 −9 app/views/admin/shop/variants/edit/_parts.html.haml
  101. +0 −4 app/views/admin/shop/variants/edit/_popups.html.haml
  102. +0 −3  app/views/admin/shop/variants/edit/inputs/_name.html.haml
  103. +0 −3  app/views/admin/shop/variants/edit/inputs/_options.html.haml
  104. +0 −13 app/views/admin/shop/variants/index.html.haml
  105. +0 −5 app/views/admin/shop/variants/index/_foot.html.haml
  106. +0 −2  app/views/admin/shop/variants/index/_head.html.haml
  107. +0 −9 app/views/admin/shop/variants/index/_variant.html.haml
  108. +0 −1  app/views/admin/shop/variants/index/buttons/_add_variant.html.haml
  109. +0 −1  app/views/admin/shop/variants/index/buttons/_categories.html.haml
  110. +0 −11 app/views/admin/shop/variants/new.html.haml
  111. +0 −12 app/views/admin/shop/variants/remove.html.haml
  112. +0 −1  app/views/shop/categories/show.html.haml
  113. +0 −1  app/views/shop/orders/show.html.haml
  114. +0 −1  app/views/shop/products/index.html.haml
  115. +0 −1  app/views/shop/products/show.html.haml
  116. +0 −153 db/migrate/20100311053701_initial.rb
  117. +0 −16 db/migrate/20100927041219_remove_payment_methods.rb
  118. +0 −11 db/migrate/20100927041624_change_payments_add_gateway.rb
  119. +0 −11 db/migrate/20100927140446_change_payment_add_card_type_card_number.rb
  120. +0 −101 db/migrate/20100929011106_fix_relationship_foreign_keys.rb
  121. +0 −25 db/migrate/20100929011607_drop_shop_addressables.rb
  122. +0 −19 db/migrate/20100929030510_create_shop_groups.rb
  123. +0 −11 db/migrate/20100929080301_shop_groups_change_add_description.rb
  124. +0 −20 db/migrate/20100929081200_create_variants.rb
  125. +0 −25 db/migrate/20100929143531_change_variants_add_updated_by.rb
  126. +0 −75 db/migrate/20100929145641_change_created_by_to_id.rb
  127. +0 −9 db/migrate/20100929235221_change_category_add_variant_id.rb
  128. +0 −31 db/migrate/20100930235221_create_packages.rb
  129. +0 −11 db/migrate/20101005231713_create_page_ids.rb
  130. +0 −73 db/migrate/20101006051214_create_pages_for_products_and_categories.rb
  131. +0 −9 db/migrate/20101007111845_add_default_position_to_attachment.rb
  132. +0 −29 db/migrate/20101010071143_create_discounts.rb
  133. +0 −9 db/migrate/20101010072225_modify_categories_remove_variant.rb
  134. +0 −15 db/migrate/20101010130034_change_discountables_add_observer.rb
  135. +0 −11 db/migrate/20101011063133_change_orders_set_limits_to_null.rb
  136. +93 −0 db/migrate/20101011063133_setup_shop.rb
  137. +113 −154 db/seeds/forms.rb
  138. +70 −103 db/seeds/layouts.rb
  139. +101 −0 db/seeds/pages.rb
  140. +21 −0 db/seeds/products.rb
  141. +36 −21 db/seeds/snippets.rb
  142. +5 −3 lib/shop/controllers/application_controller.rb
  143. +0 −34 lib/shop/interface/packages.rb
  144. +0 −34 lib/shop/interface/variants.rb
  145. +1 −2  lib/shop/models/form_extension.rb
  146. +0 −1  lib/shop/models/page.rb
  147. +0 −1  lib/shop/models/user.rb
  148. +8 −2 lib/shop/tags/card.rb
  149. +5 −1 lib/shop/tags/cart.rb
  150. +16 −59 lib/shop/tags/helpers.rb
  151. +2 −16 lib/shop/tags/item.rb
  152. +0 −95 lib/shop/tags/package.rb
  153. +0 −52 lib/shop/tags/product_variant.rb
  154. +34 −17 lib/shop/tags/responses.rb
  155. +9 −4 lib/tasks/shop_extension_tasks.rake
  156. +0 −76 public/javascripts/admin/extensions/shop/discounts/edit.js
  157. +0 −109 public/javascripts/admin/extensions/shop/packages/edit.js
  158. +0 −25 public/javascripts/admin/extensions/shop/products/edit.js
  159. +0 −125 public/stylesheets/sass/admin/extensions/shop/discounts/edit.sass
  160. +0 −162 public/stylesheets/sass/admin/extensions/shop/packages/edit.sass
  161. +11 −17 shop_extension.rb
  162. +0 −73 spec/controllers/admin/shop/discounts/discountables_controller_spec.rb
  163. +0 −81 spec/controllers/admin/shop/discounts_controller_spec.rb
  164. +0 −188 spec/controllers/admin/shop/packages/packings_controller_spec.rb
  165. +0 −32 spec/controllers/admin/shop/packages_controller_spec.rb
  166. +0 −53 spec/controllers/admin/shop/products/variant_templates_controller_spec.rb
  167. +0 −116 spec/controllers/admin/shop/products/variants_controller_spec.rb
  168. +0 −67 spec/controllers/admin/shop/variants_controller_spec.rb
  169. +25 −28 spec/datasets/forms.rb
  170. +2 −2 spec/datasets/shop_categories.rb
  171. +24 −0 spec/datasets/shop_config.rb
  172. +0 −22 spec/datasets/shop_discountables.rb
  173. +0 −29 spec/datasets/shop_discounts.rb
  174. +0 −15 spec/datasets/shop_groups.rb
  175. +2 −0  spec/datasets/shop_line_items.rb
  176. +0 −25 spec/datasets/shop_packages.rb
  177. +0 −22 spec/datasets/shop_product_variants.rb
  178. +2 −0  spec/datasets/shop_products.rb
  179. +0 −17 spec/datasets/shop_variants.rb
  180. +19 −0 spec/datasets/tags.rb
  181. +1 −1  spec/lib/shop/models/page_spec.rb
  182. +30 −4 spec/lib/shop/tags/card_spec.rb
  183. +30 −13 spec/lib/shop/tags/cart_spec.rb
  184. +2 −66 spec/lib/shop/tags/helpers_spec.rb
  185. +7 −11 spec/lib/shop/tags/item_spec.rb
  186. +0 −342 spec/lib/shop/tags/package_spec.rb
  187. +2 −2 spec/lib/shop/tags/product_spec.rb
  188. +0 −175 spec/lib/shop/tags/product_variant_spec.rb
  189. +61 −81 spec/lib/shop/tags/responses_spec.rb
  190. +9 −8 spec/models/form_address_spec.rb
  191. +28 −22 spec/models/form_checkout_spec.rb
  192. +0 −63 spec/models/form_discount_spec.rb
  193. +0 −8 spec/models/shop_category_spec.rb
  194. +0 −130 spec/models/shop_discount_spec.rb
  195. +0 −114 spec/models/shop_discountable_spec.rb
  196. +0 −38 spec/models/shop_group_spec.rb
  197. +56 −34 spec/models/shop_line_item_spec.rb
  198. +5 −5 spec/models/shop_order_spec.rb
  199. +0 −117 spec/models/shop_package_spec.rb
  200. +0 −67 spec/models/shop_packing_spec.rb
  201. +1 −44 spec/models/shop_product_spec.rb
  202. +0 −92 spec/models/shop_product_variant_spec.rb
  203. +0 −32 spec/models/shop_variant_spec.rb
  204. +3 −5 spec/spec.opts
View
42 LICENSE
@@ -0,0 +1,42 @@
+Copyright (c) 2010 Dirk Kelly (dk@dirkkelly.com) (SquareTalent)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+---------------------------------------------------------------------------
+
+Copyright (c) 2008-2009 Aurora Software (http://www.aurorasoft.com.au)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
20 MIT-LICENSE
@@ -1,20 +0,0 @@
-Copyright (c) 2008-2009 Aurora Software (http://www.aurorasoft.com.au)
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
66 README.md
@@ -1,36 +1,52 @@
# Radiant Shop
-ps: [wiki](http://github.com/squaretalent/radiant-shop-extension/wiki)
+## [Wiki]([wiki.github.com/squaretalent/radiant-shop-extension] "Github Wiki Page")
-pps: heavily under development means "it might not work out of the box after every commit"
+## Quickstart
-ppps: I am working on the wiki as quickly as I can, but specs are more important at this point in time
+Install RadiantShop Gem
-pppps: love heart
+ gem install radiant-shop-extension
+ # This will install Radiant and the Gems RadiantShop requires
+
+Create a Radiant project
+
+ radiant myshop --database sqlite3
+ cd myshop
+
+Edit your Gemfile
-## Checkout
+ gem 'radiant', '0.9.1'
+ gem 'radiant-shop-extension', :require => false
+
+Add to your config/environment.rb
-### Form Configuration
+ config.gem 'radiant-settings-extension', :lib => false
+ config.gem 'radiant-scoped-extension', :lib => false
+ config.gem 'radiant-images-extension', :lib => false
+ config.gem 'radiant-forms-extension', :lib => false
+ config.gem 'radiant-shop-extension', :lib => false
+
+Bootstrap Radiant (answer questions, I suggest an empty template)
- checkout:
- gateway:
- name: Eway
- username: 123456
- password: abcdef
-
-# Development
+ rake db:bootstrap
+
+Migrate shop
- unless ENV["RAILS_ENV"] == "production"
- config.gem 'rspec', :version => '1.3.0'
- config.gem 'rspec-rails', :version => '1.3.2'
- config.gem 'cucumber', :verison => '0.8.5'
- config.gem 'cucumber-rails', :version => '0.3.2'
- config.gem 'database_cleaner', :version => '0.4.3'
- config.gem 'ruby-debug', :version => '0.10.3'
- config.gem 'webrat', :version => '0.7.1'
- config.gem 'rr', :version => '0.10.11'
- end
+ rake radiant:extensions:update_all
+ rake radiant:extensions:shop:migrate
-# Migrating in Development
+Seed shop (optional, will help you get on your way)
+
+ rake radiant:extensions:shop:seed
+
+## Licence
+
+This extension started as a fork of aurora-soft's simple product manager
+and has since undergone a rewrite.
+
+http://github.com/squaretalent/radiant-shop-extension/compare/master
+
+Copyright 2010 Dirk Kelly (dk@dirkkelly.com) and licenced under MIT.
- rm db/development.sqlite3.db; rake db:migrate; rake radiant:extensions:scoped:migrate; rake radiant:extensions:settings:migrate; rake radiant:extensions:drag:migrate; rake radiant:extensions:forms:migrate; rake radiant:extensions:images:migrate; rake radiant:extensions:shop:migrate; rake radiant:extensions:export:load;
+See LICENCE for further information.
View
3  Rakefile
@@ -6,11 +6,10 @@ begin
gem.description = %Q{Radiant Shop is an attempt at a simple but complete store. It includes Products, Categories, Orders and Credit Card Payments}
gem.email = "dk@dirkkelly.com"
gem.homepage = "http://github.com/squaretalent/radiant-shop-extension"
- gem.authors = ["Dirk Kelly", "John Barker"]
+ gem.authors = ["Dirk Kelly", "John Barker", "Darcy Laycock"]
gem.add_dependency 'radiant', '>= 0.9.1'
gem.add_dependency 'activemerchant', '>= 1.8.0'
gem.add_dependency 'fastercsv', '>= 1.5.3'
- gem.add_dependency 'radiant-layouts-extension', '>= 0.9.1'
gem.add_dependency 'radiant-settings-extension', '>= 1.1.1'
gem.add_dependency 'radiant-images-extension', '>= 0.3.2'
gem.add_dependency 'radiant-forms-extension', '>= 3.1.1'
View
1  app/controllers/admin/shop/categories_controller.rb
@@ -147,6 +147,7 @@ def config_global
@meta << 'handle'
@meta << 'layouts'
@meta << 'page'
+ @meta << 'status'
@parts << 'description'
end
View
44 app/controllers/admin/shop/discounts/discountables_controller.rb
@@ -1,44 +0,0 @@
-class Admin::Shop::Discounts::DiscountablesController < Admin::ResourceController
-
- model_class ShopDiscountable
-
- def create
- error = 'Could not attach Discount.'
- begin
- @shop_discountable.attributes = {
- :discount_id => params[:discount_id],
- :discounted_id => params[:discounted_id],
- :discounted_type => params[:discounted_type]
- }
- @shop_discountable.save!
-
- discounted_type = @shop_discountable.discounted_type.gsub('Shop','').underscore
-
- respond_to do |format|
- format.js { render :partial => "admin/shop/discounts/edit/shared/#{discounted_type}", :locals => { discounted_type.to_sym => @shop_discountable } }
- end
- rescue
- respond_to do |format|
- format.js { render :text => error, :status => :unprocessable_entity }
- end
- end
- end
-
- def destroy
- error = 'Could not remove Discount.'
- begin
- discounted_type = @shop_discountable.discounted_type.gsub('Shop','').underscore
-
- @shop_discountable.destroy
-
- respond_to do |format|
- format.js { render :partial => "admin/shop/discounts/edit/shared/#{discounted_type}", :locals => { discounted_type.to_sym => @shop_discountable } }
- end
- rescue
- respond_to do |format|
- format.js { render :text => error, :status => :unprocessable_entity }
- end
- end
- end
-
-end
View
64 app/controllers/admin/shop/discounts_controller.rb
@@ -1,64 +0,0 @@
-class Admin::Shop::DiscountsController < Admin::ResourceController
-
- model_class ShopDiscount
-
- before_filter :config_global
- before_filter :config_index, :only => [ :index ]
- before_filter :config_new, :only => [ :new, :create ]
- before_filter :config_edit, :only => [ :edit, :update ]
- before_filter :assets_global, :except => [ :remove, :destroy ]
- before_filter :assets_edit, :only => [ :edit, :update ]
-
- private
-
- def config_global
- @inputs ||= []
- @meta ||= []
- @buttons ||= []
- @parts ||= []
- @popups ||= []
- end
-
- def config_index
- @buttons << 'new_discount'
- end
-
- def config_new
- @inputs << 'name'
- @inputs << 'amount'
- @inputs << 'code'
-
- @meta << 'start'
- @meta << 'finish'
- end
-
- def config_edit
- @buttons << 'browse_categories'
- @buttons << 'browse_products'
-
- @inputs << 'name'
- @inputs << 'amount'
- @inputs << 'code'
-
- @meta << 'start'
- @meta << 'finish'
-
- @parts << 'categories'
- @parts << 'products'
-
- @popups << 'browse_categories'
- @popups << 'browse_products'
- end
-
- def assets_global
- include_stylesheet 'admin/extensions/shop/edit'
- include_stylesheet 'admin/extensions/shop/index'
- end
-
- def assets_edit
- include_javascript 'admin/extensions/shop/edit'
- include_javascript 'admin/extensions/shop/discounts/edit'
- include_stylesheet 'admin/extensions/shop/discounts/edit'
- end
-
-end
View
90 app/controllers/admin/shop/packages/packings_controller.rb
@@ -1,90 +0,0 @@
-class Admin::Shop::Packages::PackingsController < Admin::ResourceController
- model_class ShopPacking
-
- def sort
- notice = 'Products successfully sorted.'
- error = 'Could not sort products.'
-
- begin
- @shop_packings = CGI::parse(params[:packings])["package_products[]"]
-
- @shop_packings.each_with_index do |id, index|
- ShopPacking.find(id).update_attributes!({ :position, index+1 })
- end
-
- respond_to do |format|
- format.html {
- redirect_to admin_shop_packages_path
- }
- format.js { render :text => notice, :status => :ok }
- format.json { render :json => { :notice => notice }, :status => :ok }
- end
- rescue
- respond_to do |format|
- format.html {
- flash[:error] = error
- redirect_to admin_shop_packages_path
- }
- format.js { render :text => error, :status => :unprocessable_entity }
- format.json { render :json => { :error => error }, :status => :unprocessable_entity }
- end
- end
- end
-
- def create
- notice = 'Product successfully attached.'
- error = 'Could not attach product.'
-
- begin
- @shop_packing.package = ShopPackage.find(params[:package_id])
- @shop_packing.product = ShopProduct.find(params[:product_id])
- @shop_packing.save!
-
- respond_to do |format|
- format.js { render :partial => 'admin/shop/packages/edit/shared/product', :locals => { :product => @shop_packing.product, :packing => @shop_packing } }
- end
- rescue
- respond_to do |format|
- format.js { render :text => error, :status => :unprocessable_entity }
- end
- end
- end
-
- def update
- notice = 'Product Quantity successfully updated.'
- error = 'Could not update Product Quantity.'
-
- begin
- @shop_packing.update_attributes!({ :quantity => params[:quantity] })
- respond_to do |format|
- format.js { render :text => notice, :status => :ok }
- end
- rescue
- respond_to do |format|
- format.js { render :text => error, :status => :unprocessable_entity }
- end
- end
-
- end
-
- def destroy
- notice = 'Product successfully removed.'
- error = 'Could not remove product.'
-
- begin
- @shop_product = @shop_packing.product
- @shop_package = @shop_packing.package
-
- @shop_packing.destroy
-
- respond_to do |format|
- format.js { render :partial => 'admin/shop/packages/edit/shared/product', :locals => { :product => @shop_product } }
- end
- rescue
- respond_to do |format|
- format.js { render :text => error, :status => :unprocessable_entity }
- end
- end
- end
-
-end
View
63 app/controllers/admin/shop/packages_controller.rb
@@ -1,63 +0,0 @@
-class Admin::Shop::PackagesController < Admin::ResourceController
- model_class ShopPackage
-
- helper :shop
-
- before_filter :config_global
- before_filter :config_index, :only => [ :index ]
- before_filter :config_new, :only => [ :new, :create ]
- before_filter :config_edit, :only => [ :edit, :update ]
- before_filter :assets_global
- before_filter :assets_index, :only => :index
- before_filter :assets_edit, :only => [ :edit, :update ]
-
-private
-
- def config_global
- @inputs ||= []
- @meta ||= []
- @buttons ||= []
- @parts ||= []
- @popups ||= []
-
- @inputs << 'name'
- @inputs << 'price'
- end
-
- def config_index
- @buttons << 'new_package'
- end
-
- def config_new
- @meta << 'sku'
-
- @parts << 'description'
- end
-
- def config_edit
- @meta << 'sku'
-
- @parts << 'description'
- @parts << 'products'
-
- @buttons << 'browse_products'
-
- @popups << 'browse_products'
- end
-
- def assets_global
- end
-
- def assets_index
- include_stylesheet 'admin/extensions/shop/index'
- end
-
- def assets_edit
- include_javascript 'admin/dragdrop'
- include_javascript 'admin/extensions/shop/edit'
- include_stylesheet 'admin/extensions/shop/edit'
- include_stylesheet 'admin/extensions/shop/packages/edit'
- include_javascript 'admin/extensions/shop/packages/edit'
- end
-
-end
View
27 app/controllers/admin/shop/products/variant_templates_controller.rb
@@ -1,27 +0,0 @@
-class Admin::Shop::Products::VariantTemplatesController < Admin::ResourceController
-
- model_class ShopVariant
-
- def update
- error = 'Could not attach all Variants to Product.'
-
- @shop_product = ShopProduct.find(params[:product_id])
-
- if @shop_product.apply_variant_template(@shop_variant)
- respond_to do |format|
- format.html {
- redirect_to [ :edit_admin, @shop_product ]
- }
- end
- else
- respond_to do |format|
- format.html {
- flash[:error] = error
- redirect_to [ :edit_admin, @shop_product ]
- }
- end
- end
-
- end
-
-end
View
60 app/controllers/admin/shop/products/variants_controller.rb
@@ -1,60 +0,0 @@
-class Admin::Shop::Products::VariantsController < Admin::ResourceController
-
- model_class ShopProductVariant
-
- before_filter :find_product
-
- def create
- notice = 'Successfully created variant.'
- error = 'Could not create variant.'
-
- begin
- @shop_product_variant.attributes = params[:shop_product_variant]
- @shop_product_variant.save!
-
- respond_to do |format|
- format.html {
- redirect_to edit_admin_shop_product_path(@shop_product)
- }
- format.js { render :partial => '/admin/shop/products/edit/shared/variant', :locals => { :variant => @shop_product_variant } }
- end
- rescue
- respond_to do |format|
- format.html {
- flash[:error] = error
- redirect_to edit_admin_shop_product_path(@shop_product)
- }
- format.js { render :text => error, :status => :unprocessable_entity }
- end
- end
- end
-
- def destroy
- notice = 'Successfully destroyed variant.'
- error = 'Could not destroy variant.'
-
- if @shop_product_variant.destroy
- respond_to do |format|
- format.html {
- redirect_to edit_admin_shop_product_path(@shop_product)
- }
- format.js { render :text => notice, :status => :ok }
- end
- else
- respond_to do |format|
- format.html {
- flash[:error] = error
- redirect_to edit_admin_shop_product_path(@shop_product)
- }
- format.js { render :text => error, :status => :unprocessable_entity }
- end
- end
- end
-
- private
-
- def find_product
- @shop_product = @shop_product_variant.product || ShopProduct.find(params[:product_id])
- end
-
-end
View
9 app/controllers/admin/shop/products_controller.rb
@@ -157,14 +157,14 @@ def config_global
@meta << 'sku'
@meta << 'page'
@meta << 'category'
+ @meta << 'layout'
+ @meta << 'status'
@parts << 'description'
- @parts << 'variants'
end
def config_index
@buttons << 'add_category'
- @buttons << 'variants'
end
def config_new
@@ -176,13 +176,9 @@ def config_edit
@buttons << 'browse_images'
@buttons << 'new_image'
- @buttons << 'browse_templates'
- @buttons << 'new_variant'
@popups << 'browse_images'
@popups << 'new_image'
- @popups << 'browse_templates'
- @popups << 'new_variant'
end
def assets_global
@@ -215,5 +211,4 @@ def set_layout_and_page
)
end
-
end
View
48 app/controllers/admin/shop/variants_controller.rb
@@ -1,48 +0,0 @@
-class Admin::Shop::VariantsController < Admin::ResourceController
-
- model_class ShopVariant
-
- before_filter :config_global
- before_filter :config_index, :only => [ :index ]
- before_filter :config_new, :only => [ :new, :create ]
- before_filter :config_edit, :only => [ :edit, :update ]
- before_filter :assets_global
- before_filter :assets_index, :only => [ :index ]
- before_filter :assets_edit, :only => [ :edit, :update ]
-
- private
-
- def config_global
- @inputs ||= []
- @meta ||= []
- @buttons ||= []
- @parts ||= []
- @popups ||= []
-
- @inputs << 'name'
- @inputs << 'options'
- end
-
- def config_index
- @buttons << 'add_variant'
- @buttons << 'categories'
- end
-
- def config_new
- end
-
- def config_edit
- end
-
- def assets_global
- include_stylesheet 'admin/extensions/shop/edit'
- include_stylesheet 'admin/extensions/shop/index'
- end
-
- def assets_index
- end
-
- def assets_edit
- end
-
-end
View
10 app/models/form_address.rb
@@ -41,12 +41,12 @@ def create_order_addresses
create_order_shipping_address
end
- if @billing.nil? or !@billing.id
+ unless (@billing.present? and @billing.valid?) and (@shipping.present? and @shipping.valid?)
@form.redirect_to = :back
end
- @result[:billing] = @billing.present? ? @billing.id : false
- @result[:shipping] = @shipping.present? ? @shipping.id : false
+ @result[:billing] = (@billing.valid? ? @billing.id : false) rescue false
+ @result[:shipping] = (@shipping.valid? ? @shipping.id : false) rescue false
end
# Attaches a billing address to the order (and current customer)
@@ -99,7 +99,7 @@ def create_order_shipping_address
elsif @shipping == @billing and shipping != billing
# We have conflicting data so create a new address
# the id is rejected so we'll get a new address
- @order.update_attributes!({ :shipping_attributes => shipping })
+ @order.update_attributes({ :shipping_attributes => shipping })
@shipping = @order.shipping
end
rescue
@@ -118,7 +118,7 @@ def create_order_shipping_address
else
# Create a new address with these attributes
- @order.update_attributes!({ :shipping_attributes => shipping })
+ @order.update_attributes({ :shipping_attributes => shipping })
@shipping = @order.shipping
end
end
View
42 app/models/form_checkout.rb
@@ -5,29 +5,33 @@ class FormCheckout
attr_accessor :config, :data, :result, :gateway, :card
def create
+ redirect = @form.redirect_to
+
+ @form.redirect_to = :back
find_current_order # locate the @order object
create_result_object # A default response object
-
+
# If the form was configured for gateway and we have a billing address
if @order.billing.present?
if gateway.present?
prepare_gateway # Create the @gateway object
prepare_credit_card if card.present?# Create the @card object
-
+
if @result[:gateway] and @result[:card]
purchase! # Use @card to pay through @gateway
# We have a paid for order with a billing address
if success?
- finalize_cart
# The form was configured to send a payment email
- if mail.present?
- configure_invoice_mail # Create some configuration variables for mailing
+ if extensions.present?
+ configure_success_extensions # Create some configuration variables for mailing
end
+
+ finalize_cart
+ @form.redirect_to = redirect
else
@result[:payment] = false
- @form.redirect_to = :back
end
end
else
@@ -94,13 +98,18 @@ def prepare_credit_card
end
# Sets up mail to send an invoice to the billing email address
- def configure_invoice_mail
- @form[:extensions][:mail] ||= {}
- @form[:extensions][:mail].merge!({
- :recipient => @order.billing.email,
- :to => @order.billing.email,
- })
- @form[:extensions][:mail].merge!(mail)
+ def configure_success_extensions
+ extensions.each do |name, config|
+ if config[:extension].include?('mail')
+ config[:to] = @order.billing.email unless config[:to].present?
+ end
+
+ # it's very likely the extension will need to know the order id
+ config[:shop_order] = @order.id
+
+ result = @form.call_extension(name,config)
+ @result.merge!({ name.to_sym => result })
+ end
end
# Uses the gateway and card objects to carry out an ActiveMerchant purchase
@@ -115,7 +124,6 @@ def purchase!
end
def finalize_cart
- @result[:session] = { :shop_order => nil } # We no longer need to store the current shop_roder
@order.update_attribute(:status, 'paid') # The order is now considered paid
end
@@ -126,7 +134,7 @@ def gateway
# Returns the name of the gateway (Eway)
def gateway_name
- gateway[:name]
+ gateway[:name].capitalize
end
# Returns Gateway username and password etc
@@ -191,8 +199,8 @@ def card_last_name
end
# Returns configured mail attributes
- def mail
- @config[:mail]
+ def extensions
+ @config[:extensions]
end
# Returns the amount to be charged, which is $10 on testing gateways
View
39 app/models/form_discount.rb
@@ -1,39 +0,0 @@
-class FormDiscount
- include Forms::Models::Extension
- include Shop::Models::FormExtension
-
- def create
- @result ||= { process.to_sym => false }
-
- find_current_order
-
- case process
- when 'add'
- if @discount = ShopDiscount.find_by_code(discount_code)
- @discountable = @discount.discountables.create(:discounted_id => @order.id, :discounted_type => @order.class.name)
- @result[process.to_sym] = @discountable.valid?
- end
- when 'remove'
- if @discountable = @order.discountables.find(discountable_id)
- @result[process.to_sym] = @discountable.destroy
- end
- end
-
- @result
- end
-
- protected
-
- def process
- @config[:process]
- end
-
- def discount_code
- @data[:discount][:code]
- end
-
- def discountable_id
- @data[:discountable][:id]
- end
-
-end
View
20 app/models/shop_category.rb
@@ -8,10 +8,7 @@ class ShopCategory < ActiveRecord::Base
belongs_to :updated_by, :class_name => 'User'
belongs_to :product_layout, :class_name => 'Layout'
- has_many :discountables, :class_name => 'ShopDiscountable', :foreign_key => :discounted_id
- has_many :discounts, :class_name => 'ShopDiscount', :through => :discountables
-
- before_validation :assign_slug, :assign_breadcrumb
+ before_validation :assign_slug, :assign_breadcrumb, :assign_page_class_name
accepts_nested_attributes_for :page
@@ -24,7 +21,13 @@ def name; page.title; end
def handle; ShopProduct.to_sku(page.url); end
# Returns the content of the product's page's description part
- def description; page.parts.find_by_name('description').content; rescue ''; end
+ def description
+ begin
+ page.parts.find_by_name('description').content
+ rescue
+ ''
+ end
+ end
# Returns products through the pages children
def products; page.children.map(&:shop_product); end
@@ -81,5 +84,12 @@ def assign_breadcrumb
self.page.breadcrumb = ShopProduct.to_sku(page.breadcrumb.present? ? page.breadcrumb : page.slug)
end
end
+
+ # Assigns a page class if its nil
+ def assign_page_class_name
+ if page.present?
+ self.page.class_name = page.class_name || 'ShopCategoryPage'
+ end
+ end
end
View
37 app/models/shop_discount.rb
@@ -1,37 +0,0 @@
-class ShopDiscount < ActiveRecord::Base
-
- # Return all discounts which are valid
- default_scope :conditions => [
- '(starts_at IS NULL and finishes_at IS NULL) OR (starts_at >= :now AND finishes_at <= :now) OR (starts_at IS NULL and finishes_at <= :now)',
- { :now => Time.now }
- ]
-
- belongs_to :created_by, :class_name => 'User'
- belongs_to :updated_by, :class_name => 'User'
-
- has_many :discountables, :class_name => 'ShopDiscountable', :foreign_key => :discount_id
- has_many :categories, :through => :discountables, :source => :category, :conditions => "shop_discountables.discounted_type = 'ShopCategory'"
- has_many :products, :through => :discountables, :source => :product, :conditions => "shop_discountables.discounted_type = 'ShopProduct'"
- has_many :orders, :through => :discountables, :source => :order, :conditions => "shop_discountables.discounted_type = 'ShopOrder'"
- has_many :line_items, :through => :discountables, :source => :line_item,:conditions => "shop_discountables.discounted_type = 'ShopLineItem'"
-
- validates_presence_of :name, :code, :amount
- validates_uniqueness_of :name, :code
- validates_numericality_of :amount
-
- # This will override the default scope
- def self.all_including_invalid(*attrs)
- with_exclusive_scope{find(:all,*attrs)}
- end
-
- # Return all categories minus its own
- def available_categories
- ShopCategory.all - categories
- end
-
- # Returns all products minus its own
- def available_products
- ShopProduct.all - products
- end
-
-end
View
64 app/models/shop_discountable.rb
@@ -1,64 +0,0 @@
-class ShopDiscountable < ActiveRecord::Base
-
- belongs_to :discount, :class_name => 'ShopDiscount', :foreign_key => :discount_id
- belongs_to :discounted, :foreign_key => :discounted_id, :polymorphic => true
- belongs_to :category, :class_name => 'ShopCategory', :foreign_key => :discounted_id
- belongs_to :product, :class_name => 'ShopProduct', :foreign_key => :discounted_id
- belongs_to :order, :class_name => 'ShopOrder', :foreign_key => :discounted_id
- belongs_to :line_item, :class_name => 'ShopLineItem', :foreign_key => :discounted_id
-
- validates_presence_of :discount, :discounted
- validates_uniqueness_of :discounted_id, :scope => [ :discount_id, :discounted_type ]
-
- before_validation :create_shop_products_if_shop_category
- before_destroy :destroy_shop_products_if_shop_category
-
- before_validation :create_shop_line_items_if_shop_order
- before_destroy :destroy_shop_line_items_if_shop_order
-
- # Returns discount of a class
- def self.for(type)
- all(:conditions => { :discounted_type => type.pluralize.classify })
- end
-
- # Adds discount to a category's products
- def create_shop_products_if_shop_category
- if discounted_type === 'ShopCategory'
- discounted.products.each do |product|
- # Attach discount to the child product
- ShopDiscountable.create(:discount => discount, :discounted => product)
- end
- end
- end
-
- # Removes discount from a category's products
- def destroy_shop_products_if_shop_category
- if discounted_type === 'ShopCategory'
- discount.discountables.for('ShopProduct').each do |discountable|
- discountable.destroy
- end
- end
- end
-
- # Adds discount to an order's line_items
- def create_shop_line_items_if_shop_order
- if discounted_type === 'ShopOrder'
- discounted.line_items.each do |line_item|
- if line_item.item.discounts.include?(discount)
- # We're here if the item associated with the line item can be discounted
- discount = ShopDiscountable.create(:discount_id => discount_id, :discounted => line_item)
- end
- end
- end
- end
-
- # Removes discount from an order's line_items
- def destroy_shop_line_items_if_shop_order
- if discounted_type === 'ShopOrder'
- discount.discountables.for('ShopLineItem').each do |discountable|
- discountable.destroy
- end
- end
- end
-
-end
View
15 app/models/shop_group.rb
@@ -1,15 +0,0 @@
-class ShopGroup < ActiveRecord::Base
-
- belongs_to :created_by, :class_name => 'User'
- belongs_to :updated_by, :class_name => 'User'
-
- has_many :groupings, :class_name => 'ShopGrouping', :foreign_key => :group_id
- has_many :products, :class_name => 'ShopProduct', :through => :groupings
-
- validates_presence_of :name
-
- def available_products
- ShopProduct.all - self.products
- end
-
-end
View
6 app/models/shop_grouping.rb
@@ -1,6 +0,0 @@
-class ShopGrouping < ActiveRecord::Base
-
- belongs_to :group, :class_name => 'ShopGroup'
- belongs_to :product, :class_name => 'ShopProduct'
-
-end
View
39 app/models/shop_line_item.rb
@@ -4,47 +4,38 @@ class ShopLineItem < ActiveRecord::Base
has_one :customer, :class_name => 'ShopCustomer', :through => :order, :source => :customer
belongs_to :item, :polymorphic => true
- has_many :discountables, :class_name => 'ShopDiscountable', :foreign_key => :discounted_id
- has_many :discounts, :class_name => 'ShopDiscount', :through => :discountables
-
before_validation :adjust_quantity
validates_uniqueness_of :item_id, :scope => [ :order_id, :item_type ]
validates_presence_of :item
def price
- price = value
- price -= discounted
-
- # We never want to return a negative cost
- [0.00,price.to_f].max
- end
-
- def value
- price = (item.price * self.quantity)
- end
-
- def discounted
- (item.price * self.quantity * discount)
+ (item.price.to_f * self.quantity).to_f
end
def weight
(item.weight.to_f * self.quantity.to_f).to_f
end
- def discount
- discount = BigDecimal.new('0.00')
- self.discounts.map { |d| discount += d.amount }
-
- # Convert to a percentage
- discount * 0.01
- end
+ # Overloads the base to_json to return what we want
+ def to_json(*attrs); super self.class.params; end
class << self
- def params
+ # Returns attributes attached to the product
+ def attrs
[ :id, :quantity ]
end
+ # Returns methods with usefuly information
+ def methds
+ [ :price, :weight ]
+ end
+
+ # Returns a custom hash of attributes on the product
+ def params
+ { :only => attrs, :methods => methds }
+ end
+
end
private
View
2  app/models/shop_order.rb
@@ -4,8 +4,6 @@ class ShopOrder < ActiveRecord::Base
has_one :payment, :class_name => 'ShopPayment', :foreign_key => :order_id, :dependent => :destroy
has_many :line_items, :class_name => 'ShopLineItem', :foreign_key => :order_id, :dependent => :destroy
- has_many :discountables, :class_name => 'ShopDiscountable', :foreign_key => :discounted_id
- has_many :discounts, :class_name => 'ShopDiscount', :through => :discountables
belongs_to :billing, :class_name => 'ShopAddress'
belongs_to :shipping, :class_name => 'ShopAddress'
View
74 app/models/shop_package.rb
@@ -1,74 +0,0 @@
-class ShopPackage < ActiveRecord::Base
-
- belongs_to :created_by, :class_name => 'User'
- belongs_to :updated_by, :class_name => 'User'
-
- has_many :packings, :class_name => 'ShopPacking', :foreign_key => :package_id, :dependent => :destroy
- has_many :products, :class_name => 'ShopProduct', :foreign_key => :product_id, :through => :packings
-
- has_many :line_items, :class_name => 'ShopLineItem', :as => :item
- has_many :orders, :class_name => 'ShopOrder', :through => :line_items
-
- before_validation :assign_sku
-
- validates_presence_of :name, :sku
-
- validates_uniqueness_of :name, :sku
-
- validates_numericality_of :price, :greater_than => 0.00, :allow_nil => true, :precisions => 2
-
- # Returns the products not attached to the category
- def available_products; ShopProduct.all - self.products; end
-
- # Returns the slug of the first product
- def slug; products.first.slug; end
-
- # Overloads the base to_json to return what we want
- def to_json(*attrs); super self.class.params; end
-
- # Returns the aggregate value of the products in the package
- def value
- value = 0
- self.packings.map { |pkg| value += (pkg.product.price.to_f * pkg.quantity) }
- value
- end
-
- # Returns the aggregate weight of the products in the package
- def weight
- weight = 0
- self.packings.map { |pkg| weight += (pkg.product.weight.to_f * pkg.quantity) }
- weight
- end
-
- class << self
-
- # Returns attributes attached to the product
- def attrs
- [ :id, :name, :price, :sku, :description, :created_at, :updated_at ]
- end
-
- # Returns methods with usefuly information
- def methds
- []
- end
-
- # Returns the objects to include
- def inclde
- [ :category, :products ]
- end
-
- # Returns a custom hash of attributes on the product
- def params
- { :only => self.attrs, :methods => self.methds, :include => self.inclde }
- end
-
- end
-
-private
-
- # Assigns an sku based off the name
- def assign_sku
- self.sku = ShopProduct.to_sku(sku.present? ? sku : name)
- end
-
-end
View
22 app/models/shop_packing.rb
@@ -1,22 +0,0 @@
-class ShopPacking < ActiveRecord::Base
-
- default_scope :order => 'shop_packings.position ASC'
-
- belongs_to :package, :class_name => 'ShopPackage', :foreign_key => :package_id
- belongs_to :product, :class_name => 'ShopProduct', :foreign_key => :product_id
-
- before_validation :set_quantity
-
- validates_uniqueness_of :product_id, :scope => :package_id
-
- def value
- self.product.price.to_f * self.quantity
- end
-
-private
-
- def set_quantity
- self.quantity = [1,self.quantity].max
- end
-
-end
View
31 app/models/shop_product.rb
@@ -10,22 +10,13 @@ class ShopProduct < ActiveRecord::Base
has_many :orders, :class_name => 'ShopOrder', :through => :line_items, :uniq => true
has_many :attachments, :class_name => 'ShopProductAttachment', :foreign_key => :product_id
has_many :images, :class_name => 'Image', :through => :attachments, :uniq => true
- has_many :packings, :class_name => 'ShopPacking', :foreign_key => :product_id
- has_many :packages, :class_name => 'ShopPackage', :foreign_key => :package_id, :through => :packings, :source => :package
- has_many :related, :class_name => 'ShopProduct', :through => :packings, :source => :product, :uniq => true
- has_many :variants, :class_name => 'ShopProductVariant', :foreign_key => :product_id, :dependent => :destroy
- has_many :discountables, :class_name => 'ShopDiscountable', :foreign_key => :discounted_id
- has_many :discounts, :class_name => 'ShopDiscount', :through => :discountables
-
- before_validation :assign_slug, :assign_breadcrumb
+
+ before_validation :assign_slug, :assign_breadcrumb, :assign_page_class_name
validates_presence_of :page
validates_numericality_of :price, :greater_than => 0.00, :allow_nil => true, :precisions => 2
accepts_nested_attributes_for :page
- accepts_nested_attributes_for :variants
-
- after_create :assign_discounts
# Returns the title of the product's page
def name; page.title; end
@@ -40,7 +31,13 @@ def category; page.parent.shop_category; end
def category_id; category.id; end
# Returns the content of the product's page's description part
- def description; page.parts.find_by_name('description').content rescue ''; end
+ def description
+ begin
+ page.parts.find_by_name('description').content
+ rescue
+ ''
+ end
+ end
# Returns the url of the page
def url; page.url; end
@@ -104,7 +101,7 @@ def params
# Converts a url to a pretty sku and removes the shop prefix /shop/page/category/product page-category-product
def to_sku(url)
if url.present?
- url.downcase.strip.gsub(/^\/#{Radiant::Config['shop.root_page_slug']}/,'').gsub(/^(\/*)(.*)(\/)$/,'\2').gsub(/[\s\.:;=+~]+/,'_').gsub(/\//,'-')
+ url.downcase.strip.gsub(/^\/#{Page.find(Radiant::Config['shop.root_page_id']).slug}/,'').gsub(/^(\/*)(.*)(\/)$/,'\2').gsub(/[\s\.:;=+~]+/,'_').gsub(/\//,'-')
end
end
@@ -126,10 +123,10 @@ def assign_breadcrumb
end
end
- # Assigns discounts based off categories discounts
- def assign_discounts
- category.discounts.each do |discount|
- ShopDiscountable.create(:discount => discount, :discounted => self)
+ # Assigns a page class if its nil
+ def assign_page_class_name
+ if page.present?
+ self.page.class_name = page.class_name || 'ShopProductPage'
end
end
View
34 app/models/shop_product_variant.rb
@@ -1,34 +0,0 @@
-class ShopProductVariant < ActiveRecord::Base
-
- belongs_to :product, :class_name => 'ShopProduct', :foreign_key => :product_id
-
- validates_presence_of :product
- validates_presence_of :name
- validates_uniqueness_of :name, :scope => :product_id
-
- belongs_to :created_by, :class_name => 'User'
- belongs_to :updated_by, :class_name => 'User'
-
- has_many :line_items, :class_name => 'ShopLineItem', :foreign_key => :item_id, :dependent => :destroy
- has_many :orders, :class_name => 'ShopOrder', :through => :line_items, :uniq => true
-
- # Returns the price of the variant plus the product price
- def price
- price = product.price
- if read_attribute(:price).present?
- price = read_attribute(:price) + product.price
- end
- price
- end
-
- # Returns a mixed sku of product and variant name
- def sku
- %{#{product.sku}-#{ShopProduct.to_sku(name)}}
- end
-
- # Returns slug of the product
- def slug
- product.slug
- end
-
-end
View
23 app/models/shop_variant.rb
@@ -1,23 +0,0 @@
-class ShopVariant < ActiveRecord::Base
-
- belongs_to :created_by, :class_name => 'User'
- belongs_to :updated_by, :class_name => 'User'
-
- validates_presence_of :name
- validates_uniqueness_of :name
- validates_presence_of :options_json
-
- def options
- options = {}
- if self.options_json.present?
- options = ActiveSupport::JSON.decode(self.options_json)
- options = Forms::Config.deep_symbolize_keys(options)
- end
- options
- end
-
- def options=(options)
- self.options_json = ActiveSupport::JSON.encode(options)
- end
-
-end
View
BIN  app/views/.DS_Store
Binary file not shown
View
4 app/views/admin/pages/_shop_category.html.haml
@@ -1,4 +0,0 @@
-- if @page.class_name == "ShopCategoryPage"
- %p
- %label{:for => 'page_shop_category_id'} Category
- = collection_select :page, :shop_category_id, ShopCategory.all, :id, :name
View
4 app/views/admin/pages/_shop_product.html.haml
@@ -1,4 +0,0 @@
-- if @page.class_name == "ShopProductPage"
- %p
- %label{:for => 'page_shop_product_id'} Product
- = collection_select :page, :shop_product_id, ShopProduct.all, :id, :name
View
2  app/views/admin/shop/categories/edit/meta/_status.html.haml
@@ -0,0 +1,2 @@
+- f.fields_for :page do |pf|
+ = pf.hidden_field :status_id,:value => Status[Radiant::Config['defaults.page.status']].id
View
11 app/views/admin/shop/discounts/edit.html.haml
@@ -1,11 +0,0 @@
-- @page_title = @shop_discount.name
-
-- render_region :main do |main|
- - main.head do
- = render 'admin/shop/discounts/edit/head'
-
- - main.popups do
- = render 'admin/shop/discounts/edit/popups'
-
- - main.form do
- = render 'admin/shop/discounts/edit/form'
View
16 app/views/admin/shop/discounts/edit/_foot.html.haml
@@ -1,16 +0,0 @@
-- render_region :foot do |foot|
- - foot.buttons do
- %p.buttons
- = save_model_button(@shop_discount)
- = save_model_and_continue_editing_button(@shop_discount)
- = t('or')
- = link_to t('cancel'), admin_shop_discounts_path
- - foot.timestamp do
- = updated_stamp @shop_discount
-
-- unless @shop_discount.new_record?
- :javascript
- if(typeof(ROUTES) === 'undefined') ROUTES = new Array();
-
- ROUTES['admin_shop_discount_discountables_path'] = "#{admin_shop_discount_discountables_path(@shop_discount)}";
- ROUTES['admin_shop_discount_discountable_path'] = "#{admin_shop_discount_discountable_path(@shop_discount, ':id')}";
View
15 app/views/admin/shop/discounts/edit/_form.html.haml
@@ -1,15 +0,0 @@
-- form_for [:admin, @shop_discount], :html => {'data-onsubmit_status'=>"Saving Changes&#8230;"} do |f|
- = hidden_field_tag 'shop_discount_id',@shop_discount.id
-
- - render_region :form do |form|
- - form.inputs do
- = render :partial => '/admin/shop/discounts/edit/inputs', :locals => { :f => f }
-
- - form.meta do
- = render :partial => '/admin/shop/discounts/edit/meta', :locals => { :f => f }
-
- - form.parts do
- = render :partial => '/admin/shop/discounts/edit/parts', :locals => { :f => f }
-
- - form.foot do
- = render :partial => 'admin/shop/discounts/edit/foot', :locals => { :f => f }
View
4 app/views/admin/shop/discounts/edit/_head.html.haml
@@ -1,4 +0,0 @@
-%h1
- = @page_title
- - @buttons.each do |button|
- = render :partial => "admin/shop/discounts/edit/buttons/#{button}"
View
2  app/views/admin/shop/discounts/edit/_inputs.html.haml
@@ -1,2 +0,0 @@
-- @inputs.each do |input|
- = render :partial => "admin/shop/discounts/edit/inputs/#{input}", :locals => { :f => f }
View
8 app/views/admin/shop/discounts/edit/_meta.html.haml
@@ -1,8 +0,0 @@
-- if @meta.present?
- .drawer
- .drawer_contents#attributes
- %table.fieldset
- - @meta.each do |meta|
- = render :partial => "admin/shop/discounts/edit/meta/#{meta}", :locals => { :f => f }
- .drawer_handle
- %a.toggle{:href=>'#attributes', :rel=>"toggle[attributes]", :class=>"#{(meta_errors? ? 'less' : 'more')}"}= meta_label
View
9 app/views/admin/shop/discounts/edit/_parts.html.haml
@@ -1,9 +0,0 @@
-#tab_control
- #tabs.tabs
- #tab_toolbar
- #pages.pages
- = hidden_field_tag 'page_part_index_field' #important
- - @parts.each do |part|
- .page{:id => "product_page_#{part}", 'data-caption'=>h(part)}
- .part{:id => "product_part_#{part}"}
- = render :partial => "admin/shop/discounts/edit/parts/#{part}", :locals => { :f => f }
View
4 app/views/admin/shop/discounts/edit/_popups.html.haml
@@ -1,4 +0,0 @@
-#popups
- - @popups.each do |popup|
- .popup{ :id => "#{popup}_popup"}
- = render :partial => "admin/shop/discounts/edit/popups/#{popup}"
View
1  app/views/admin/shop/discounts/edit/buttons/_browse_categories.html.haml
@@ -1 +0,0 @@
-= link_to t('browse_categories'), '#browse_categories_popup', :class => 'popup button'
View
1  app/views/admin/shop/discounts/edit/buttons/_browse_products.html.haml
@@ -1 +0,0 @@
-= link_to t('browse_products'), '#browse_products_popup', :class => 'popup button'
View
3  app/views/admin/shop/discounts/edit/inputs/_amount.html.haml
@@ -1,3 +0,0 @@
-%p.title
- = f.label :amount, t('amount')
- = f.text_field :amount, :class => 'textbox', :maxlenth => 255
View
3  app/views/admin/shop/discounts/edit/inputs/_code.html.haml
@@ -1,3 +0,0 @@
-%p.title
- = f.label :code, t('code')
- = f.text_field :code, :class => 'textbox', :maxlenth => 255
View
3  app/views/admin/shop/discounts/edit/inputs/_name.html.haml
@@ -1,3 +0,0 @@
-%p.title
- = f.label :name, t('name')
- = f.text_field :name, :class => 'textbox', :maxlenth => 255
View
5 app/views/admin/shop/discounts/edit/meta/_finish.html.haml
@@ -1,5 +0,0 @@
-%tr
- %th.label
- = f.label :finishes_at, t('finishes')
- %td.field
- = f.text_field :finishes_at, :class => 'date'
View
5 app/views/admin/shop/discounts/edit/meta/_start.html.haml
@@ -1,5 +0,0 @@
-%tr
- %th.label
- = f.label :starts_at, t('starts')
- %td.field
- = f.text_field :starts_at, :class => 'date'
View
3  app/views/admin/shop/discounts/edit/parts/_categories.html.haml
@@ -1,3 +0,0 @@
-%ul#discount_categories.categories.discounteds
- - @shop_discount.discountables.for('ShopCategory').each do |category|
- = render :partial => 'admin/shop/discounts/edit/shared/category', :locals => { :category => category }
View
3  app/views/admin/shop/discounts/edit/parts/_products.html.haml
@@ -1,3 +0,0 @@
-%ul#discount_products.products.discounteds
- - @shop_discount.discountables.for('ShopProduct').each do |product|
- = render :partial => 'admin/shop/discounts/edit/shared/product', :locals => { :product => product }
View
6 app/views/admin/shop/discounts/edit/popups/_browse_categories.html.haml
@@ -1,6 +0,0 @@
-%h3.title Browse Categories
-
-%ul#available_categories.availables
- = render :partial => '/admin/shop/discounts/edit/shared/category', :collection => @shop_discount.available_categories
-
-%a#browse_categories_popup_close.close{ :href => '#browse_categories_popup_close' }
View
6 app/views/admin/shop/discounts/edit/popups/_browse_products.html.haml
@@ -1,6 +0,0 @@
-%h3.title Browse Products
-
-%ul#available_products.availables
- = render :partial => '/admin/shop/discounts/edit/shared/product', :collection => @shop_discount.available_products
-
-%a#browse_products_popup_close.close{ :href => '#browse_products_popup_close' }
View
11 app/views/admin/shop/discounts/edit/shared/_category.html.haml
@@ -1,11 +0,0 @@
-- discounted_type = category.class.to_s
-- discounted_id = discounted_type == "ShopCategory" ? category.id : category.discounted_id
-- discountable_id = discounted_type == "ShopCategory" ? nil : category.id
-- success_element = discounted_type == "ShopCategory" ? 'discount_categories' : 'available_categories'
-- class_type = discounted_type == "ShopCategory" ? "available" : "discounted"
-
-%li.category{:class => "discountable #{class_type} category", :id => "#{discounted_type}_#{category.id}", :'data-discounted_id' => discounted_id, :'data-discounted_type' => discounted_type, :'data-discounted_type_human' => 'Category', :'data-discountable_id' => discountable_id, :'data-success_element' => success_element }
- %span.name= truncate((category.name rescue category.discounted.name), 30, '...')
- %span.handle= (category.handle rescue category.discounted.handle)
- .actions
- %span.delete
View
12 app/views/admin/shop/discounts/edit/shared/_product.html.haml
@@ -1,12 +0,0 @@
-- discounted_type = product.class.to_s
-
-- discounted_id = discounted_type == "ShopProduct" ? product.id : product.discounted_id
-- discountable_id = discounted_type == "ShopProduct" ? nil : product.id
-- success_element = discounted_type == "ShopProduct" ? 'discount_products' : 'available_products'
-- class_type = discounted_type == "ShopProduct" ? "available" : "discounted"
-
-%li.product{:class => "discountable #{class_type} product", :id => "#{class_type}_#{product.id}", :'data-discounted_id' => discounted_id, :'data-discounted_type' => discounted_type, :'data-discounted_type_human' => 'Product', :'data-discountable_id' => discountable_id, :'data-success_element' => success_element }
- %span.name= truncate((product.name rescue product.discounted.name), 30, '...')
- %span.sku= (product.sku rescue product.discounted.sku)
- .actions
- %span.delete
View
13 app/views/admin/shop/discounts/index.html.haml
@@ -1,13 +0,0 @@
-- @page_title = t('discounts') + ' - ' + default_page_title
-
-.outset
-
- #head.min
- = render :partial => '/admin/shop/discounts/index/head'
-
- #discounts_map.map
- %ul#discounts
- = render :partial => '/admin/shop/discounts/index/discount', :collection => @shop_discounts
-
- #actions
- = render :partial => '/admin/shop/discounts/index/foot'
View
13 app/views/admin/shop/discounts/index/_discount.html.haml
@@ -1,13 +0,0 @@
-%li.discount.object{:id => "discount_#{discount.id}", :'data-id' => discount.id}
- .attributes
- %span.name.attribute
- - render_region :body do |body|
- - body.name do
- %span.name.attribute= link_to discount.name, [:edit_admin, discount]
- - body.code do
- %span.code.attribute= discount.code
- - body.amount do
- %span.amount.attribute= discount.amount
- - body.modify do
- .modify
- %span.remove= link_to t('remove'), [:remove_admin, discount]
View
5 app/views/admin/shop/discounts/index/_foot.html.haml
@@ -1,5 +0,0 @@
-%ul
- - render_region :foot do |foot|
- - foot.buttons do
- - @buttons.each do |button|
- %li= render :partial => "admin/shop/discounts/index/buttons/#{button}"
View
2  app/views/admin/shop/discounts/index/_head.html.haml
@@ -1,2 +0,0 @@
-- render_region :head do |head|
- - nil
View
1  app/views/admin/shop/discounts/index/buttons/_new_discount.html.haml
@@ -1 +0,0 @@
-= link_to image('plus') + " " + t("add_discount"), new_admin_shop_discount_path
View
11 app/views/admin/shop/discounts/new.html.haml
@@ -1,11 +0,0 @@
-- @page_title = t('new_discount')
-
-- render_region :main do |main|
- - main.head do
- = render 'admin/shop/discounts/edit/head'
-
- - main.popups do
- = render 'admin/shop/discounts/edit/popups'
-
- - main.form do
- = render 'admin/shop/discounts/edit/form'
View
12 app/views/admin/shop/discounts/remove.html.haml
@@ -1,12 +0,0 @@
-%h1
- = t('remove_discount')
-
-%p
- = t('text.remove_discount.warning')
-
-- form_for [:admin, @shop_discount.becomes(ShopDiscount)], :html => {:method => :delete, 'data-onsubmit_status'=>"Removing Discount&#8230;"} do
-
- %p.buttons
- %input.button{:type=>"submit", :value => t('delete_variant') }/
- = t('or')
- = link_to t('cancel'), admin_shop_discounts_path
View
11 app/views/admin/shop/packages/edit.html.haml
@@ -1,11 +0,0 @@
-- @page_title = @shop_package.name
-
-- render_region :main do |main|
- - main.head do
- = render 'admin/shop/packages/edit/head'
-
- - main.popups do
- = render 'admin/shop/packages/edit/popups'
-
- - main.form do
- = render 'admin/shop/packages/edit/form'
View
17 app/views/admin/shop/packages/edit/_foot.html.haml
@@ -1,17 +0,0 @@
-- render_region :foot do |foot|
- - foot.buttons do
- %p.buttons
- = save_model_button(@shop_package)
- = save_model_and_continue_editing_button(@shop_package)
- = t('or')
- = link_to t('cancel'), admin_shop_packages_path
- - foot.timestamp do
- = updated_stamp @shop_package
-
-- unless @shop_package.new_record?
- :javascript
- if(typeof(ROUTES) === 'undefined') ROUTES = new Array();
-
- ROUTES['sort_admin_shop_package_packings_path'] = "#{sort_admin_shop_package_packings_path(@shop_package)}";
- ROUTES['admin_shop_package_packings_path'] = "#{admin_shop_package_packings_path(@shop_package)}";
- ROUTES['admin_shop_package_packing_path'] = "#{admin_shop_package_packing_path(@shop_package,':d')}";
View
15 app/views/admin/shop/packages/edit/_form.html.haml
@@ -1,15 +0,0 @@
-- form_for [:admin, @shop_package], :html => {'data-onsubmit_status'=>"Saving Changes&#8230;"} do |f|
- = hidden_field_tag 'shop_package_id',@shop_package.id
-
- - render_region :form do |form|
- - form.inputs do
- = render :partial => '/admin/shop/packages/edit/inputs', :locals => { :f => f }
-
- - form.meta do
- = render :partial => '/admin/shop/packages/edit/meta', :locals => { :f => f }
-
- - form.parts do
- = render :partial => '/admin/shop/packages/edit/parts', :locals => { :f => f }
-
- - form.foot do
- = render :partial => '/admin/shop/packages/edit/foot', :locals => { :f => f }
View
4 app/views/admin/shop/packages/edit/_head.html.haml
@@ -1,4 +0,0 @@
-%h1
- = @page_title
- - @buttons.each do |button|
- = render :partial => "admin/shop/packages/edit/buttons/#{button}"
View
2  app/views/admin/shop/packages/edit/_inputs.html.haml
@@ -1,2 +0,0 @@
-- @inputs.each do |input|
- = render :partial => "admin/shop/packages/edit/inputs/#{input}", :locals => { :f => f }
View
8 app/views/admin/shop/packages/edit/_meta.html.haml
@@ -1,8 +0,0 @@
-- if @meta.present?
- .drawer
- .drawer_contents#attributes
- %table.fieldset
- - @meta.each do |meta|
- = render :partial => "admin/shop/packages/edit/meta/#{meta}", :locals => { :f => f }
- .drawer_handle
- %a.toggle{:href=>'#attributes', :rel=>"toggle[attributes]", :class=>"#{(meta_errors? ? 'less' : 'more')}"}= meta_label
View
9 app/views/admin/shop/packages/edit/_parts.html.haml
@@ -1,9 +0,0 @@
-#tab_control
- #tabs.tabs
- #tab_toolbar
- #pages.pages
- = hidden_field_tag 'page_part_index_field' #important
- - @parts.each do |part|
- .page{:id => "package_page_#{part}", 'data-caption'=>h(part)}
- .part{:id => "package_part_#{part}"}
- = render :partial => "admin/shop/packages/edit/parts/#{part}", :locals => { :f => f }
View
4 app/views/admin/shop/packages/edit/_popups.html.haml
@@ -1,4 +0,0 @@
-#popups
- - @popups.each do |popup|
- .popup{ :id => "#{popup}_popup"}
- = render :partial => "admin/shop/packages/edit/popups/#{popup}"
View
1  app/views/admin/shop/packages/edit/buttons/_browse_products.html.haml
@@ -1 +0,0 @@
-= link_to "#{image('plus')} #{t('browse_products')}", '#browse_products_popup', :class => 'popup button'
View
3  app/views/admin/shop/packages/edit/inputs/_name.html.haml
@@ -1,3 +0,0 @@
-%p.title
- = f.label :name
- = f.text_field :name, :class => 'textbox', :maxlenth => 255
View
3  app/views/admin/shop/packages/edit/inputs/_price.html.haml
@@ -1,3 +0,0 @@
-%p.title
- = f.label :price
- = f.text_field :price, :class => 'textbox', :maxlenth => 255, :value => input_currency(@shop_package.price)
View
5 app/views/admin/shop/packages/edit/meta/_sku.html.haml
@@ -1,5 +0,0 @@
-%tr
- %th.label
- %label{:for=>"shop_package[sku]"}= t('sku')
- %td.field
- = f.text_field :sku, :class =>'textbox'
View
1  app/views/admin/shop/packages/edit/parts/_description.html.haml
@@ -1 +0,0 @@
-~ f.text_area :description, :class => "textarea large", :style => "width: 100%"
View
3  app/views/admin/shop/packages/edit/parts/_products.html.haml
@@ -1,3 +0,0 @@
-%ol#package_products
- - @shop_package.packings.each do |packing|
- = render :partial => 'admin/shop/packages/edit/shared/product', :locals => { :product => packing.product, :packing => packing }
View
7 app/views/admin/shop/packages/edit/popups/_browse_products.html.haml
@@ -1,7 +0,0 @@
-%h3.title Available Products
-
-%ul#available_products
- - @shop_package.available_products.each do |product|
- = render :partial => 'admin/shop/packages/edit/shared/product', :locals => { :product => product }
-
-%a#browse_products_popup_close.close{ :href => '#' }
View
8 app/views/admin/shop/packages/edit/shared/_product.html.haml
@@ -1,8 +0,0 @@
-%li.product{ :id => "product_#{packing.id rescue product.id}", :'data-packing_id' => (packing.id rescue nil), :'data-product_id' => product.id }
- .wrapper
- = image_tag(product.images.first.url(:preview)) unless product.images.empty?
- %span.title= product.sku
- %input.quantity{ :id => "packing_#{packing.id rescue nil }_quantity", :value => (packing.quantity rescue nil), :'data-packing_id' => (packing.id rescue nil) }
- %button.save_quantity{ :onclick => 'return false' } save
- .actions
- %span.delete
View
13 app/views/admin/shop/packages/index.html.haml
@@ -1,13 +0,0 @@
-- @page_title = t('packages') + ' - ' + default_page_title
-
-.outset
-
- #head.min
- = render :partial => '/admin/shop/packages/index/head'
-
- #packages_map.map
- %ul#packages
- = render :partial => '/admin/shop/packages/index/package', :collection => @shop_packages
-
- #actions
- = render :partial => '/admin/shop/packages/index/foot'
View
8 app/views/admin/shop/packages/index/_foot.html.haml
@@ -1,8 +0,0 @@
-%ul
- - render_region :foot do |foot|
- - foot.buttons do
- - @buttons.each do |button|
- %li= render :partial => "admin/shop/packages/index/buttons/#{button}"
-
-:javascript
- if(typeof(ROUTES) === 'undefined') ROUTES = new Array();
View
2  app/views/admin/shop/packages/index/_head.html.haml
@@ -1,2 +0,0 @@
-- render_region :head do |head|
- - nil
View
9 app/views/admin/shop/packages/index/_package.html.haml
@@ -1,9 +0,0 @@
-%li.package.object{:id => "package_#{package.id}", :'data-id' => package.id}
- .attributes
- - render_region :body do |body|
- - body.name do
- %span.name.attribute
- = link_to package.name, [:edit_admin, package]
- - body.modify do
- .modify
- %span.remove= link_to t('remove'), [:remove_admin, package]
View
1  app/views/admin/shop/packages/index/buttons/_new_package.html.haml
@@ -1 +0,0 @@
-= link_to image('plus') + " " + t("add_package"), new_admin_shop_package_path
View
11 app/views/admin/shop/packages/new.html.haml
@@ -1,11 +0,0 @@
-- @page_title = t('new_package')
-
-- render_region :main do |main|
- - main.head do
- = render 'admin/shop/packages/edit/head'
-
- - main.popups do
- = render 'admin/shop/packages/edit/popups'
-
- - main.form do
- = render 'admin/shop/packages/edit/form'
View
12 app/views/admin/shop/packages/remove.html.haml
@@ -1,12 +0,0 @@
-%h1
- = t('remove_package')
-
-%p
- = t('text.remove_package.warning')
-
-- form_for [:admin, @shop_package.becomes(ShopPackage)], :html => {:method => :delete, 'data-onsubmit_status'=>"Removing Package&#8230;"} do
-
- %p.buttons
- %input.button{:type=>"submit", :value => t('delete_package') }/
- = t('or')
- = link_to t('cancel'), admin_shop_packages_path
View
1  app/views/admin/shop/products/edit/buttons/_browse_templates.html.haml
@@ -1 +0,0 @@
-= link_to t('apply_template'), '#browse_templates_popup', :class => 'popup button'
View
1  app/views/admin/shop/products/edit/buttons/_new_variant.html.haml
@@ -1 +0,0 @@
-= link_to "#{image('plus')} #{t('new_variant')}", '#new_variant_popup', :class => 'popup button'
View
6 app/views/admin/shop/products/edit/meta/_layout.html.haml
@@ -0,0 +1,6 @@
+- f.fields_for :page do |pf|
+ %tr
+ %th.label