glysellin 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.md +100 -0
- data/Rakefile +29 -0
- data/app/assets/javascripts/glysellin/address.coffee +38 -0
- data/app/assets/javascripts/glysellin/async-cart.coffee +139 -0
- data/app/assets/javascripts/glysellin/base.js +6 -0
- data/app/assets/javascripts/glysellin/cart.coffee +54 -0
- data/app/assets/javascripts/glysellin/main.coffee +0 -0
- data/app/assets/javascripts/glysellin/product.coffee +0 -0
- data/app/assets/stylesheets/glysellin/application.css +13 -0
- data/app/assets/stylesheets/glysellin/orders.css +4 -0
- data/app/assets/stylesheets/glysellin/products.css +4 -0
- data/app/controllers/glysellin/cart/addresses_controller.rb +17 -0
- data/app/controllers/glysellin/cart/discount_code_controller.rb +10 -0
- data/app/controllers/glysellin/cart/payment_method_controller.rb +17 -0
- data/app/controllers/glysellin/cart/products_controller.rb +37 -0
- data/app/controllers/glysellin/cart/shipping_method_controller.rb +18 -0
- data/app/controllers/glysellin/cart/state_controller.rb +15 -0
- data/app/controllers/glysellin/cart_controller.rb +53 -0
- data/app/controllers/glysellin/orders_controller.rb +53 -0
- data/app/controllers/glysellin/products_controller.rb +12 -0
- data/app/helpers/glysellin/application_helper.rb +4 -0
- data/app/helpers/glysellin/cart_helper.rb +21 -0
- data/app/helpers/glysellin/orders_helper.rb +35 -0
- data/app/helpers/glysellin/products_helper.rb +4 -0
- data/app/mailers/glysellin/order_admin_mailer.rb +17 -0
- data/app/mailers/glysellin/order_customer_mailer.rb +27 -0
- data/app/models/glysellin/address.rb +35 -0
- data/app/models/glysellin/brand.rb +14 -0
- data/app/models/glysellin/discount_code.rb +36 -0
- data/app/models/glysellin/discount_type.rb +9 -0
- data/app/models/glysellin/order.rb +243 -0
- data/app/models/glysellin/order_adjustment.rb +19 -0
- data/app/models/glysellin/order_item.rb +38 -0
- data/app/models/glysellin/orderer.rb +28 -0
- data/app/models/glysellin/payment.rb +46 -0
- data/app/models/glysellin/payment_method.rb +36 -0
- data/app/models/glysellin/product.rb +136 -0
- data/app/models/glysellin/product_image.rb +11 -0
- data/app/models/glysellin/product_property.rb +22 -0
- data/app/models/glysellin/product_property_type.rb +11 -0
- data/app/models/glysellin/product_type.rb +11 -0
- data/app/models/glysellin/shipping_method.rb +22 -0
- data/app/models/glysellin/taxonomy.rb +35 -0
- data/app/models/glysellin/variant.rb +100 -0
- data/app/views/glysellin/cart/_added_to_cart_warning.html.erb +21 -0
- data/app/views/glysellin/cart/_cart.html.erb +13 -0
- data/app/views/glysellin/cart/_navigation.html.erb +11 -0
- data/app/views/glysellin/cart/_products.html.erb +125 -0
- data/app/views/glysellin/cart/_recap.html.erb +16 -0
- data/app/views/glysellin/cart/recap/_addresses.html.erb +13 -0
- data/app/views/glysellin/cart/recap/_products.html.erb +63 -0
- data/app/views/glysellin/cart/show.html.erb +13 -0
- data/app/views/glysellin/cart/states/_addresses.html.erb +25 -0
- data/app/views/glysellin/cart/states/_choose_payment_method.html.erb +14 -0
- data/app/views/glysellin/cart/states/_choose_shipping_method.html.erb +14 -0
- data/app/views/glysellin/cart/states/_filled.html.erb +3 -0
- data/app/views/glysellin/cart/states/_init.html.erb +5 -0
- data/app/views/glysellin/cart/states/_ready.html.erb +1 -0
- data/app/views/glysellin/order_admin_mailer/_order_header.text.erb +5 -0
- data/app/views/glysellin/order_admin_mailer/send_check_order_created_email.text.erb +8 -0
- data/app/views/glysellin/order_admin_mailer/send_order_paid_email.text.erb +8 -0
- data/app/views/glysellin/order_customer_mailer/_order_footer.text.erb +3 -0
- data/app/views/glysellin/order_customer_mailer/_order_header.text.erb +5 -0
- data/app/views/glysellin/order_customer_mailer/send_order_created_email.text.erb +7 -0
- data/app/views/glysellin/order_customer_mailer/send_order_paid_email.text.erb +7 -0
- data/app/views/glysellin/order_customer_mailer/send_order_shipped_email.text.erb +8 -0
- data/app/views/glysellin/orders/_addresses_fields.html.erb +29 -0
- data/app/views/glysellin/orders/_order.html.erb +18 -0
- data/app/views/glysellin/orders/_payment_canceled.html.erb +13 -0
- data/app/views/glysellin/orders/_payment_successful.html.erb +6 -0
- data/app/views/glysellin/orders/payment_response.html.erb +5 -0
- data/app/views/glysellin/payment_methods/_paypal-integral.html.erb +22 -0
- data/app/views/glysellin/products/_add_to_cart.html.erb +16 -0
- data/app/views/glysellin/products/_item.html.erb +21 -0
- data/app/views/glysellin/products/filter.html.erb +0 -0
- data/app/views/glysellin/products/index.html.erb +3 -0
- data/app/views/glysellin/products/show.html.erb +3 -0
- data/app/views/glysellin/shared/_address.html.erb +11 -0
- data/app/views/glysellin/shared/_address.text.erb +7 -0
- data/app/views/glysellin/shared/_order.text.erb +56 -0
- data/app/views/glysellin/shared/mailer/_footer.text.erb +2 -0
- data/app/views/layouts/glysellin/application.html.erb +14 -0
- data/config/locales/glysellin.en.yml +113 -0
- data/config/locales/glysellin.fr.yml +119 -0
- data/db/migrate/20120206115004_create_glysellin_orders.rb +16 -0
- data/db/migrate/20120206115132_create_glysellin_customers.rb +8 -0
- data/db/migrate/20120206115657_create_glysellin_addresses.rb +22 -0
- data/db/migrate/20120206124505_create_glysellin_products.rb +20 -0
- data/db/migrate/20120206124545_create_glysellin_order_items.rb +15 -0
- data/db/migrate/20120206124630_create_glysellin_product_images.rb +10 -0
- data/db/migrate/20120206125210_add_attachment_image_to_product_image.rb +15 -0
- data/db/migrate/20120206130920_create_glysellin_payments.rb +13 -0
- data/db/migrate/20120206131042_create_glysellin_payment_methods.rb +10 -0
- data/db/migrate/20120207175050_create_glysellin_taxonomies.rb +11 -0
- data/db/migrate/20120207175158_create_products_taxonomies_table.rb +12 -0
- data/db/migrate/20120515143231_create_brands.rb +9 -0
- data/db/migrate/20120515143233_add_attachment_image_to_brands.rb +15 -0
- data/db/migrate/20120620151705_create_product_properties.rb +12 -0
- data/db/migrate/20130204121211_create_glysellin_discount_types.rb +10 -0
- data/db/migrate/20130204121228_create_glysellin_discount_codes.rb +15 -0
- data/db/migrate/20130204125310_create_glysellin_order_adjustments.rb +13 -0
- data/db/migrate/20130204202102_create_glysellin_shipping_methods.rb +12 -0
- data/db/migrate/20130204202109_add_shipping_method_id_to_glysellin_orders.rb +5 -0
- data/db/migrate/20130205110036_add_weight_to_glysellin_products.rb +5 -0
- data/db/migrate/20130205120541_add_weight_to_glysellin_order_items.rb +5 -0
- data/db/migrate/20130208162813_create_glysellin_variants.rb +17 -0
- data/db/migrate/20130208165020_create_glysellin_product_property_types.rb +7 -0
- data/db/migrate/20130211105557_add_type_id_to_glysellin_product_properties.rb +5 -0
- data/db/migrate/20130211112302_add_variant_id_to_glysellin_product_properties.rb +13 -0
- data/db/migrate/20130211152651_add_product_id_to_glysellin_variants.rb +5 -0
- data/db/migrate/20130212131658_add_weight_to_glysellin_variants.rb +5 -0
- data/db/migrate/20130212132253_remove_variant_columns_from_glysellin_products.rb +15 -0
- data/db/migrate/20130212154943_remove_eot_price_from_glysellin_products.rb +9 -0
- data/db/migrate/20130214184204_create_glysellin_product_types.rb +9 -0
- data/db/migrate/20130214184352_create_product_type_behavior.rb +15 -0
- data/db/migrate/20130221102200_add_unmarked_price_to_glysellin_variants.rb +5 -0
- data/db/migrate/20130311135842_add_addressable_to_glysellin_addresses.rb +6 -0
- data/db/migrate/20130314114048_change_addressable_associations_in_glysellin_addresses.rb +15 -0
- data/db/migrate/20130325113903_remove_address_ids_from_glysellin_orders.rb +11 -0
- data/db/seeds/shipping_carrier/rates/colissimo.csv +16 -0
- data/db/seeds/shipping_carrier/rates/lettre-max.csv +9 -0
- data/lib/active_model/model.rb +101 -0
- data/lib/generators/glysellin/install/USAGE +8 -0
- data/lib/generators/glysellin/install/install_generator.rb +50 -0
- data/lib/generators/glysellin/install/templates/initializer.rb +119 -0
- data/lib/generators/glysellin/install/templates/order_observer.rb +12 -0
- data/lib/generators/glysellin/install/utils.rb +11 -0
- data/lib/glysellin.rb +124 -0
- data/lib/glysellin/acts_as_sellable.rb +14 -0
- data/lib/glysellin/cart.rb +21 -0
- data/lib/glysellin/cart/address.rb +16 -0
- data/lib/glysellin/cart/adjustment.rb +17 -0
- data/lib/glysellin/cart/adjustment/base.rb +41 -0
- data/lib/glysellin/cart/adjustment/discount_code.rb +43 -0
- data/lib/glysellin/cart/adjustment/shipping_method.rb +31 -0
- data/lib/glysellin/cart/basket.rb +482 -0
- data/lib/glysellin/cart/customer.rb +36 -0
- data/lib/glysellin/cart/model_wrapper.rb +90 -0
- data/lib/glysellin/cart/nested_resource.rb +39 -0
- data/lib/glysellin/cart/payment_method.rb +8 -0
- data/lib/glysellin/cart/product.rb +16 -0
- data/lib/glysellin/cart/select.rb +31 -0
- data/lib/glysellin/cart/serializable.rb +30 -0
- data/lib/glysellin/cart/shipping_method.rb +8 -0
- data/lib/glysellin/discount_type_calculator.rb +7 -0
- data/lib/glysellin/discount_type_calculator/base.rb +30 -0
- data/lib/glysellin/discount_type_calculator/order_percentage.rb +16 -0
- data/lib/glysellin/engine.rb +14 -0
- data/lib/glysellin/engine/routes.rb +61 -0
- data/lib/glysellin/gateway.rb +16 -0
- data/lib/glysellin/gateway/atos.rb +111 -0
- data/lib/glysellin/gateway/base.rb +43 -0
- data/lib/glysellin/gateway/check.rb +34 -0
- data/lib/glysellin/gateway/paypal_integral.rb +71 -0
- data/lib/glysellin/helpers.rb +15 -0
- data/lib/glysellin/helpers/controller.rb +22 -0
- data/lib/glysellin/helpers/countries.rb +261 -0
- data/lib/glysellin/helpers/views.rb +28 -0
- data/lib/glysellin/product_methods.rb +66 -0
- data/lib/glysellin/products_list.rb +72 -0
- data/lib/glysellin/property_finder.rb +13 -0
- data/lib/glysellin/shipping_carrier.rb +14 -0
- data/lib/glysellin/shipping_carrier/base.rb +55 -0
- data/lib/glysellin/shipping_carrier/colissimo.rb +19 -0
- data/lib/glysellin/shipping_carrier/flat_rate.rb +19 -0
- data/lib/glysellin/shipping_carrier/free_shipping.rb +14 -0
- data/lib/glysellin/shipping_carrier/helpers/country_weight_table.rb +65 -0
- data/lib/glysellin/shipping_carrier/lettre_max.rb +19 -0
- data/lib/glysellin/version.rb +3 -0
- data/lib/tasks/glysellin_tasks.rake +37 -0
- metadata +341 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
class AddVariantIdToGlysellinProductProperties < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :glysellin_product_properties, :variant_id, :integer
|
4
|
+
add_column :glysellin_product_properties, :variant_type, :string
|
5
|
+
remove_column :glysellin_product_properties, :product_id
|
6
|
+
end
|
7
|
+
|
8
|
+
def down
|
9
|
+
add_column :glysellin_product_properties, :product_id, :integer
|
10
|
+
remove_column :glysellin_product_properties, :variant_type
|
11
|
+
remove_column :glysellin_product_properties, :variant_id
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class RemoveVariantColumnsFromGlysellinProducts < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
remove_column :glysellin_products, :price
|
4
|
+
remove_column :glysellin_products, :in_stock
|
5
|
+
remove_column :glysellin_products, :unlimited_stock
|
6
|
+
remove_column :glysellin_products, :weight
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
add_column :glysellin_products, :price, :decimal
|
11
|
+
add_column :glysellin_products, :in_stock, :integer
|
12
|
+
add_column :glysellin_products, :unlimited_stock, :boolean
|
13
|
+
add_column :glysellin_products, :weight, :boolean
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateProductTypeBehavior < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :glysellin_product_types_properties, id: false do |t|
|
4
|
+
t.references :product_type, :product_property
|
5
|
+
end
|
6
|
+
|
7
|
+
add_column :glysellin_products, :product_type_id, :integer
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
remove_column :glysellin_products, :product_type_id
|
12
|
+
|
13
|
+
drop_table :glysellin_product_types_properties
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class ChangeAddressableAssociationsInGlysellinAddresses < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
remove_column :glysellin_addresses, :addressable_type
|
4
|
+
remove_column :glysellin_addresses, :addressable_id
|
5
|
+
add_column :glysellin_addresses, :shipped_addressable_type, :string
|
6
|
+
add_column :glysellin_addresses, :shipped_addressable_id, :integer
|
7
|
+
add_column :glysellin_addresses, :billed_addressable_type, :string
|
8
|
+
add_column :glysellin_addresses, :billed_addressable_id, :integer
|
9
|
+
end
|
10
|
+
|
11
|
+
def down
|
12
|
+
add_column :glysellin_addresses, :addressable_type, :string
|
13
|
+
add_column :glysellin_addresses, :addressable_id, :integer
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class RemoveAddressIdsFromGlysellinOrders < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
remove_column :glysellin_orders, :billing_address_id
|
4
|
+
remove_column :glysellin_orders, :shipping_address_id
|
5
|
+
end
|
6
|
+
|
7
|
+
def down
|
8
|
+
add_column :glysellin_orders, :shipping_address_id, :integer
|
9
|
+
add_column :glysellin_orders, :billing_address_id, :integer
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
,"FR,MC,AD","GP,MQ,GF,RE,YT,PM,MF,BL","NC,PF,WF,TF","AT,BE,CZ,DE,DK,ES,FI,GB,GR,HU,IE,IT,LU,NL,PL,PT,SE,SI,SK,CH,GI,GL,BG,CY,EE,FO,LI,LT,LV,MT,RO,SM,VA","AZ,BY,DZ,HR,IS,MA,ME,RS,TR,AL,AM,BA,GE,MD,MK,RU,UA,NO,TN,BF,CI,GH,ML","AE,AO,BH,BI,BJ,BW,CA,CD,CF,CG,CM,CV,DJ,EG,ER,ET,GA,GM,GN,GW,IL,IR,JO,KE,KM,KW,LB,LR,LS,LY,MG,MR,MU,MW,MZ,NA,NE,NG,OM,PR,QA,RW,SA,SC,SD,SH,SL,SN,ST,SY,SZ,TD,TG,TZ,UG,US,YE,ZA,ZM,ZW,GQ","AF,AI,AN,AQ,AR,AS,AU,AW,BB,BD,BM,BN,BO,BR,BS,BZ,CK,CL,CN,CO,CR,DM,DO,EC,FJ,FK,FM,GD,GS,GT,GY,HK,HN,HT,ID,IN,JM,JP,KG,KH,KI,KN,KP,KR,KZ,LA,LC,LK,MH,MM,MN,MO,MP,MS,MV,MX,MY,NF,NI,NP,NR,NZ,PA,PE,PG,PH,PK,PW,PY,SB,SG,SR,SV,TC,TH,TJ,TL,TM,TO,TT,TV,TW,UY,UZ,VE,VG,VI,VN,VU,WS,AG,CU,GU,KY,PN,VC"
|
2
|
+
0.5,5.7,8.45,10.1,16.15,19.8,23.2,26.4
|
3
|
+
1,7.1,12.7,15.2,16.15,19.8,23.2,26.4
|
4
|
+
2,8.2,17.35,26.8,17.85,21.7,31.1,39.7
|
5
|
+
3,9.25,22,38.4,21.55,26.25,40.9,52.9
|
6
|
+
4,11.35,26.65,50,25.25,30.8,50.7,66.1
|
7
|
+
5,11.35,31.3,61.6,28.95,35.35,60.5,79.3
|
8
|
+
6,13.35,35.95,73.2,32.65,39.9,70.3,92.5
|
9
|
+
7,13.35,40.6,84.8,36.35,44.45,80.1,105.7
|
10
|
+
8,16.35,45.25,96.4,40.05,49,89.9,118.9
|
11
|
+
9,16.35,49.9,108,43.75,53.55,99.7,132.1
|
12
|
+
10,16.35,54.55,119.6,47.45,58.1,109.5,145.3
|
13
|
+
15,18.85,77.75,177.6,54.65,68.5,133.6,171.3
|
14
|
+
20,26.35,100.95,235.6,61.85,78.9,157.7,197.3
|
15
|
+
25,26.35,124.15,293.6,69.05,,,
|
16
|
+
30,26.35,147.35,351.6,76.25,,,
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# ActiveModel::Model is not present in 3.2 ... didn't figure out why.
|
2
|
+
#
|
3
|
+
unless defined?(ActiveModel::Model)
|
4
|
+
module ActiveModel
|
5
|
+
|
6
|
+
# == Active \Model Basic \Model
|
7
|
+
#
|
8
|
+
# Includes the required interface for an object to interact with
|
9
|
+
# <tt>ActionPack</tt>, using different <tt>ActiveModel</tt> modules.
|
10
|
+
# It includes model name introspections, conversions, translations and
|
11
|
+
# validations. Besides that, it allows you to initialize the object with a
|
12
|
+
# hash of attributes, pretty much like <tt>ActiveRecord</tt> does.
|
13
|
+
#
|
14
|
+
# A minimal implementation could be:
|
15
|
+
#
|
16
|
+
# class Person
|
17
|
+
# include ActiveModel::Model
|
18
|
+
# attr_accessor :name, :age
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# person = Person.new(name: 'bob', age: '18')
|
22
|
+
# person.name # => 'bob'
|
23
|
+
# person.age # => 18
|
24
|
+
#
|
25
|
+
# Note that, by default, <tt>ActiveModel::Model</tt> implements <tt>persisted?</tt>
|
26
|
+
# to return +false+, which is the most common case. You may want to override
|
27
|
+
# it in your class to simulate a different scenario:
|
28
|
+
#
|
29
|
+
# class Person
|
30
|
+
# include ActiveModel::Model
|
31
|
+
# attr_accessor :id, :name
|
32
|
+
#
|
33
|
+
# def persisted?
|
34
|
+
# self.id == 1
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# person = Person.new(id: 1, name: 'bob')
|
39
|
+
# person.persisted? # => true
|
40
|
+
#
|
41
|
+
# Also, if for some reason you need to run code on <tt>initialize</tt>, make
|
42
|
+
# sure you call +super+ if you want the attributes hash initialization to
|
43
|
+
# happen.
|
44
|
+
#
|
45
|
+
# class Person
|
46
|
+
# include ActiveModel::Model
|
47
|
+
# attr_accessor :id, :name, :omg
|
48
|
+
#
|
49
|
+
# def initialize(attributes={})
|
50
|
+
# super
|
51
|
+
# @omg ||= true
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# person = Person.new(id: 1, name: 'bob')
|
56
|
+
# person.omg # => true
|
57
|
+
#
|
58
|
+
# For more detailed information on other functionalities available, please
|
59
|
+
# refer to the specific modules included in <tt>ActiveModel::Model</tt>
|
60
|
+
# (see below).
|
61
|
+
module Model
|
62
|
+
def self.included(base) #:nodoc:
|
63
|
+
base.class_eval do
|
64
|
+
extend ActiveModel::Naming
|
65
|
+
extend ActiveModel::Translation
|
66
|
+
include ActiveModel::Validations
|
67
|
+
include ActiveModel::Conversion
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Initializes a new model with the given +params+.
|
72
|
+
#
|
73
|
+
# class Person
|
74
|
+
# include ActiveModel::Model
|
75
|
+
# attr_accessor :name, :age
|
76
|
+
# end
|
77
|
+
#
|
78
|
+
# person = Person.new(name: 'bob', age: '18')
|
79
|
+
# person.name # => "bob"
|
80
|
+
# person.age # => 18
|
81
|
+
def initialize(params={})
|
82
|
+
params.each do |attr, value|
|
83
|
+
self.public_send("#{attr}=", value)
|
84
|
+
end if params
|
85
|
+
end
|
86
|
+
|
87
|
+
# Indicates if the model is persisted. Default is +false+.
|
88
|
+
#
|
89
|
+
# class Person
|
90
|
+
# include ActiveModel::Model
|
91
|
+
# attr_accessor :id, :name
|
92
|
+
# end
|
93
|
+
#
|
94
|
+
# person = Person.new(id: 1, name: 'bob')
|
95
|
+
# person.persisted? # => false
|
96
|
+
def persisted?
|
97
|
+
false
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.expand_path('../utils', __FILE__)
|
2
|
+
|
3
|
+
module Glysellin
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
include Generators::Utils::InstanceMethods
|
6
|
+
# Copied files come from templates folder
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
8
|
+
|
9
|
+
# Generator desc
|
10
|
+
desc "Glysellin install generator"
|
11
|
+
|
12
|
+
def welcome
|
13
|
+
do_say "Installing glysellin dependencies and files !"
|
14
|
+
end
|
15
|
+
|
16
|
+
def copy_initializer_file
|
17
|
+
do_say "Installing default initializer template"
|
18
|
+
copy_file "initializer.rb", "config/initializers/glysellin.rb"
|
19
|
+
end
|
20
|
+
|
21
|
+
def copy_order_observer
|
22
|
+
do_say "Installing order observer"
|
23
|
+
copy_file "order_observer.rb", "app/models/order_observer.rb"
|
24
|
+
end
|
25
|
+
|
26
|
+
def copy_migrations
|
27
|
+
do_say "Installing migrations, don't forget to `rake db:migrate`"
|
28
|
+
rake "glysellin_engine:install:migrations"
|
29
|
+
end
|
30
|
+
|
31
|
+
def copy_views
|
32
|
+
if (ask "Do you want to copy glysellin views to your application views directory ?").presence =~ /^y/i
|
33
|
+
rake "glysellin:copy_views"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def migrate_and_create_default_data
|
38
|
+
migrate = ask("Do you want to migrate and install default shop data ? [Y/n]").presence || 'n'
|
39
|
+
return unless migrate.match(/^y/i)
|
40
|
+
rake "db:migrate"
|
41
|
+
rake "glysellin:seed"
|
42
|
+
end
|
43
|
+
|
44
|
+
def mount_engine
|
45
|
+
mount_path = ask("Where would you like to mount Glysellin shop engine ? [/shop]").presence || '/shop'
|
46
|
+
gsub_file "config/routes.rb", /glysellin_at \'\/?.*\'/, ''
|
47
|
+
route "glysellin_at '#{mount_path.match(/^\//) ? mount_path : "/#{mount_path}"}'"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Glysellin
|
4
|
+
self.config do |config|
|
5
|
+
# User model must be set in order to bind customers to authenticable users
|
6
|
+
# default: 'User'
|
7
|
+
# config.user_class_name = 'User'
|
8
|
+
|
9
|
+
# Add additional fields to address model
|
10
|
+
# default: []
|
11
|
+
# config.additional_address_fields = [:email, :age]
|
12
|
+
|
13
|
+
# Change the way order billing references are generated
|
14
|
+
# Reproducting default generator would be this :
|
15
|
+
# config.order_reference_generator = lambda { |order| "#{ Time.now.strftime('%Y%m%d%H%M') }-#{ order.id }" }
|
16
|
+
|
17
|
+
# Configure your shop name, used to send e-mails
|
18
|
+
config.shop_name = 'My super shop'
|
19
|
+
|
20
|
+
# Configure sender e-mail address used when sending e-mails to customers and
|
21
|
+
# to admins
|
22
|
+
config.contact_email = 'change-me-in-glysellin-initialize-file@example.com'
|
23
|
+
|
24
|
+
# Configure recipient e-mail address used to send orders when completed
|
25
|
+
config.admin_email = 'change-me-in-glysellin-initialize-file@example.com'
|
26
|
+
|
27
|
+
# Set default VAT rate for products when it is not set in db
|
28
|
+
config.default_vat_rate = 19.6
|
29
|
+
|
30
|
+
# Default product weight for shipping rate calculation, expressed in kilograms
|
31
|
+
# Defaults to 0. For 100g, use value : 0.1
|
32
|
+
#
|
33
|
+
# config.default_product_weight = 0.1
|
34
|
+
|
35
|
+
# Allows creating fake accounts for customers with automatic random
|
36
|
+
# password generation
|
37
|
+
# Defaults to true
|
38
|
+
#
|
39
|
+
# config.allow_anonymous_orders = true
|
40
|
+
|
41
|
+
# Sends an automatic e-mail to the shop admin when a new order with
|
42
|
+
# check payment method is placed
|
43
|
+
# Defaults to true
|
44
|
+
#
|
45
|
+
# config.send_email_on_check_order_placed = true
|
46
|
+
|
47
|
+
# Set steps order to be used while using automatic order process
|
48
|
+
#
|
49
|
+
# config.step_routes = {
|
50
|
+
# payment_method_chosen: ORDER_STEP_PAYMENT
|
51
|
+
# }
|
52
|
+
|
53
|
+
# Change presence validation of Address fields
|
54
|
+
# default: *[:first_name, :last_name, :address, :zip, :city, :country]
|
55
|
+
# config.address_presence_validation_keys = *[:first_name, :last_name, :address, :zip, :city, :country]
|
56
|
+
|
57
|
+
# Config paypal account
|
58
|
+
# config.gateways['paypal-integral'].config do |pp|
|
59
|
+
# if Rails.env == 'development'
|
60
|
+
# pp.account = 'paypal-test-account@example.com'
|
61
|
+
# pp.test = true
|
62
|
+
# else
|
63
|
+
# pp.account = 'paypal-account@example.com'
|
64
|
+
# end
|
65
|
+
# end
|
66
|
+
|
67
|
+
# Product images paperclip styles, defaults are listed below
|
68
|
+
# config.product_images_styles = {
|
69
|
+
# :thumb => '100x100#',
|
70
|
+
# :content => '300x300'
|
71
|
+
# }
|
72
|
+
|
73
|
+
# Config sogenactif account
|
74
|
+
# config.gateways['atos'].config do |atos|
|
75
|
+
# atos.merchant_id = '0123012302130120'
|
76
|
+
# atos.pathfile_path = Rails.root.join('vendor', 'atos', 'param', 'pathfile')
|
77
|
+
# atos.bin_path = Rails.root.join('bin')
|
78
|
+
# atos.merchant_country = 'fr'
|
79
|
+
# atos.capture_mode = 'AUTHOR_CAPTURE'
|
80
|
+
# atos.capture_days = nil
|
81
|
+
# atos.activate_logger = false
|
82
|
+
# end
|
83
|
+
|
84
|
+
# config.gateways['check'].config do |c|
|
85
|
+
#
|
86
|
+
# # Check paying notes description (on order recap page)
|
87
|
+
# #
|
88
|
+
# # First way : Configure check order and check destination
|
89
|
+
# c.checks_order = "Order me nasty !"
|
90
|
+
# c.checks_destination = "Check services / your addres here ..."
|
91
|
+
# # Second way : Use your own description wraped in a lambda which will
|
92
|
+
# # be passed the order
|
93
|
+
# c.check_payment_description = lambda { |order| I18n.t(:check_payment_instructions, order_ref: order.ref) }
|
94
|
+
#
|
95
|
+
# end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Decorators management
|
99
|
+
#
|
100
|
+
# This is the behavior found in Rails 4, so to start sticking with future
|
101
|
+
# conventions, you can uncomment the following lines to enable you to create
|
102
|
+
# simple class_eval decorators in :
|
103
|
+
#
|
104
|
+
# Example :
|
105
|
+
#
|
106
|
+
# # app/decorators/models/glysellin/product_decorator.rb
|
107
|
+
# Glysellin::Product.class_eval do
|
108
|
+
# def self.search query
|
109
|
+
# where('name LIKE ?', query)
|
110
|
+
# end
|
111
|
+
# end
|
112
|
+
#
|
113
|
+
# ======================================================================
|
114
|
+
#
|
115
|
+
# Dir["#{ Rails.root }/app/decorators/*/glysellin/*_decorator.rb"].each do |decorator|
|
116
|
+
# constant = decorator.split(/decorators\/.*?\/glysellin\//).pop.gsub(/_decorator\.rb/, '').camelize.to_sym
|
117
|
+
# autoload constant, decorator
|
118
|
+
# end
|
119
|
+
end
|