Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

moved responses to forms, fixing datasets since pulling out extensions

  • Loading branch information...
commit 2b715b0ea1c8d4478158eb04b723d817bbb4e225 1 parent fe75268
Dirk Kelly authored
View
20 config/routes.rb
@@ -1,32 +1,20 @@
ActionController::Routing::Routes.draw do |map|
map.namespace :admin do |admin|
- admin.namespace :shop, :member => { :remove => :get } do |shop|
+ admin.namespace :shop, :member => { :remove => :get } do |shop|
+
shop.resources :categories, :collection => { :sort => :put }, :member => { :products => :get } do |category|
category.resources :products, :only => :new
end
shop.resources :products, :except => :new, :collection => { :sort => :put } do |product|
- product.resources :images, :controller => 'products/images', :only => [:index, :create, :destroy], :collection => { :sort => :put }
- product.resources :variants, :controller => 'products/variants', :only => [ :create, :destroy]
- product.resources :variant_templates, :controller => 'products/variant_templates', :only => [ :update ]
- product.resources :discounts, :controller => 'products/discounts', :only => [ :create, :destroy]
- product.resources :discount_templates,:controller => 'products/discount_templates', :only => [ :update ]
+ product.resources :images, :controller => 'products/images', :only => [:index, :create, :destroy], :collection => { :sort => :put }
end
- shop.resources :packages, :member => { :remove => :get } do |packages|
- packages.resources :packings, :controller => 'packages/packings', :only => [:create, :update, :destroy], :collection => { :sort => :put }
- end
-
- shop.resources :discounts, :member => { :remove => :get } do |discounts|
- discounts.resources :discountables, :controller => 'discounts/discountables', :only => [:create,:destroy]
- end
-
- shop.resources :variants
-
shop.resources :customers
shop.resources :orders, :except => [ :destroy ], :collection => { :export => :get }
+
end
admin.resources :shops, :as => 'shop', :only => [ :index ]
View
5 lib/shop/tags/helpers.rb
@@ -195,16 +195,15 @@ def current_address(tag)
end
def currency(number,attr = {})
-
precision = attr[:precision].present? ? attr[:precision] : Radiant::Config['shop.price_precision']
unit = attr[:unit].present? ? attr[:unit] : Radiant::Config['shop.price_unit']
- seperator = attr[:seperator].present? ? attr[:seperator] : Radiant::Config['shop.price_separator']
+ separator = attr[:separator].present? ? attr[:separator] : Radiant::Config['shop.price_separator']
delimiter = attr[:delimiter].present? ? attr[:delimiter] : Radiant::Config['shop.price_delimiter']
number_to_currency(number.to_f, {
:precision => precision.to_i,
:unit => unit,
- :separator => seperator,
+ :separator => separator,
:delimiter => delimiter
})
end
View
51 lib/shop/tags/responses.rb
@@ -1,51 +0,0 @@
-module Shop
- module Tags
- module Responses
- include Radiant::Taggable
-
- desc %{ Expand if there is a response to a specified for value }
- tag 'response:if_results' do |tag|
- extension = tag.attr['extension'].to_sym
- tag.locals.response_extension = tag.locals.response.result[:results][extension]
-
- tag.expand if tag.locals.response_extension.present?
- end
-
-
- desc %{ Expand if there is a response to a specified for value }
- tag 'response:unless_results' do |tag|
- extension = tag.attr['extension'].to_sym
- tag.locals.response_extension = tag.locals.response.result[:results][extension]
-
- tag.expand unless tag.locals.response_extension.present?
- end
-
- desc %{ Expand if there is a positive response to a specified for value of an extension
-
- <pre>
- <r:response:if_get extension='bogus_gateway' value='checkout'>yay</r:response:if_get>
- </pre>
- }
- tag 'response:if_get' do |tag|
- query = tag.attr['name'].to_sym
- result = tag.locals.response_extension[query]
-
- tag.expand if result.present? and result === true
- end
-
- desc %{ Expand if there is a negative response to a specified for value of an extension
-
- <pre>
- <r:response:unless_get extension='bogus_gateway' value='checkout'>no</r:response:unless_get>
- </pre>
- }
- tag 'response:unless_get' do |tag|
- query = tag.attr['name'].to_sym
- result = tag.locals.response_extension[query]
-
- tag.expand if !result.present? or result != true
- end
-
- end
- end
-end
View
2  shop_extension.rb
@@ -33,7 +33,7 @@ def activate
# Tags
Page.send :include, Shop::Tags::Core, Shop::Tags::Address, Shop::Tags::Card, Shop::Tags::Cart
- Page.send :include, Shop::Tags::Category, Shop::Tags::Item, Shop::Tags::Product, Shop::Tags::Responses
+ Page.send :include, Shop::Tags::Category, Shop::Tags::Item, Shop::Tags::Product
Page.send :include, Shop::Tags::Tax
# Model Includes
View
1  spec/datasets/shop_customers.rb
@@ -1,4 +1,5 @@
class ShopCustomersDataset < Dataset::Base
+
def load
create_model :shop_customer, :customer,
:name => 'customer',
Please sign in to comment.
Something went wrong with that request. Please try again.