kylekthompson_shoppe 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +55 -0
- data/Rakefile +36 -0
- data/app/assets/images/kylekthompson_shoppe/chosen-sprite.png +0 -0
- data/app/assets/images/kylekthompson_shoppe/chosen-sprite@2x.png +0 -0
- data/app/assets/images/kylekthompson_shoppe/document.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/bag.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/balance.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/box.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/building.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/chart.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/chat.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/checkbox.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/checkbox2.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/cloud.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/cone.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/credit_card.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/currency.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/edit.svg +14 -0
- data/app/assets/images/kylekthompson_shoppe/icons/flowchart.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/gift.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/globe.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/id.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/id2.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/locked.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/report.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/search.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/support.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/tags.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/toolbox.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/unlocked.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/icons/wallet.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/kylekthompson_shoppe.svg +25 -0
- data/app/assets/images/kylekthompson_shoppe/logo.svg +47 -0
- data/app/assets/images/kylekthompson_shoppe/move.svg +1 -0
- data/app/assets/images/kylekthompson_shoppe/square.svg +9 -0
- data/app/assets/images/kylekthompson_shoppe/statuses/accepted.svg +14 -0
- data/app/assets/images/kylekthompson_shoppe/statuses/paid.svg +16 -0
- data/app/assets/images/kylekthompson_shoppe/statuses/received.svg +15 -0
- data/app/assets/images/kylekthompson_shoppe/statuses/rejected.svg +14 -0
- data/app/assets/images/kylekthompson_shoppe/statuses/shipped.svg +14 -0
- data/app/assets/images/kylekthompson_shoppe/table-tear-off.png +0 -0
- data/app/assets/javascripts/kylekthompson_shoppe/application.coffee +123 -0
- data/app/assets/javascripts/kylekthompson_shoppe/chosen.jquery.js +1166 -0
- data/app/assets/javascripts/kylekthompson_shoppe/jquery_ui.js +6 -0
- data/app/assets/javascripts/kylekthompson_shoppe/mousetrap.js +9 -0
- data/app/assets/javascripts/kylekthompson_shoppe/order_form.coffee +47 -0
- data/app/assets/stylesheets/kylekthompson_shoppe/application.scss +601 -0
- data/app/assets/stylesheets/kylekthompson_shoppe/chosen.scss +424 -0
- data/app/assets/stylesheets/kylekthompson_shoppe/dialog.scss +25 -0
- data/app/assets/stylesheets/kylekthompson_shoppe/elements.scss +79 -0
- data/app/assets/stylesheets/kylekthompson_shoppe/printable.scss +67 -0
- data/app/assets/stylesheets/kylekthompson_shoppe/reset.scss +93 -0
- data/app/assets/stylesheets/kylekthompson_shoppe/sub.scss +106 -0
- data/app/assets/stylesheets/kylekthompson_shoppe/variables.scss +1 -0
- data/app/controllers/kylekthompson_shoppe/addresses_controller.rb +47 -0
- data/app/controllers/kylekthompson_shoppe/application_controller.rb +46 -0
- data/app/controllers/kylekthompson_shoppe/attachments_controller.rb +14 -0
- data/app/controllers/kylekthompson_shoppe/countries_controller.rb +47 -0
- data/app/controllers/kylekthompson_shoppe/customers_controller.rb +55 -0
- data/app/controllers/kylekthompson_shoppe/dashboard_controller.rb +9 -0
- data/app/controllers/kylekthompson_shoppe/delivery_service_prices_controller.rb +45 -0
- data/app/controllers/kylekthompson_shoppe/delivery_services_controller.rb +47 -0
- data/app/controllers/kylekthompson_shoppe/orders_controller.rb +119 -0
- data/app/controllers/kylekthompson_shoppe/payments_controller.rb +33 -0
- data/app/controllers/kylekthompson_shoppe/product_categories_controller.rb +47 -0
- data/app/controllers/kylekthompson_shoppe/product_category_localisations_controller.rb +58 -0
- data/app/controllers/kylekthompson_shoppe/product_localisations_controller.rb +58 -0
- data/app/controllers/kylekthompson_shoppe/products_controller.rb +58 -0
- data/app/controllers/kylekthompson_shoppe/sessions_controller.rb +34 -0
- data/app/controllers/kylekthompson_shoppe/settings_controller.rb +16 -0
- data/app/controllers/kylekthompson_shoppe/stock_level_adjustments_controller.rb +40 -0
- data/app/controllers/kylekthompson_shoppe/tax_rates_controller.rb +49 -0
- data/app/controllers/kylekthompson_shoppe/users_controller.rb +53 -0
- data/app/controllers/kylekthompson_shoppe/variants_controller.rb +50 -0
- data/app/helpers/kylekthompson_shoppe/application_helper.rb +60 -0
- data/app/helpers/kylekthompson_shoppe/product_category_helper.rb +36 -0
- data/app/mailers/kylekthompson_shoppe/order_mailer.rb +25 -0
- data/app/mailers/kylekthompson_shoppe/user_mailer.rb +10 -0
- data/app/models/kylekthompson_shoppe/address.rb +44 -0
- data/app/models/kylekthompson_shoppe/country.rb +27 -0
- data/app/models/kylekthompson_shoppe/customer.rb +41 -0
- data/app/models/kylekthompson_shoppe/delivery_service.rb +33 -0
- data/app/models/kylekthompson_shoppe/delivery_service_price.rb +31 -0
- data/app/models/kylekthompson_shoppe/order/actions.rb +94 -0
- data/app/models/kylekthompson_shoppe/order/billing.rb +105 -0
- data/app/models/kylekthompson_shoppe/order/delivery.rb +229 -0
- data/app/models/kylekthompson_shoppe/order/states.rb +69 -0
- data/app/models/kylekthompson_shoppe/order.rb +100 -0
- data/app/models/kylekthompson_shoppe/order_item.rb +239 -0
- data/app/models/kylekthompson_shoppe/payment.rb +86 -0
- data/app/models/kylekthompson_shoppe/product/product_attributes.rb +20 -0
- data/app/models/kylekthompson_shoppe/product/variants.rb +51 -0
- data/app/models/kylekthompson_shoppe/product.rb +189 -0
- data/app/models/kylekthompson_shoppe/product_attribute.rb +66 -0
- data/app/models/kylekthompson_shoppe/product_categorization.rb +14 -0
- data/app/models/kylekthompson_shoppe/product_category.rb +75 -0
- data/app/models/kylekthompson_shoppe/setting.rb +68 -0
- data/app/models/kylekthompson_shoppe/stock_level_adjustment.rb +19 -0
- data/app/models/kylekthompson_shoppe/tax_rate.rb +46 -0
- data/app/models/kylekthompson_shoppe/user.rb +49 -0
- data/app/validators/permalink_validator.rb +7 -0
- data/app/views/kylekthompson_shoppe/addresses/_form.html.haml +33 -0
- data/app/views/kylekthompson_shoppe/addresses/edit.html.haml +5 -0
- data/app/views/kylekthompson_shoppe/addresses/new.html.haml +5 -0
- data/app/views/kylekthompson_shoppe/countries/_form.html.haml +35 -0
- data/app/views/kylekthompson_shoppe/countries/edit.html.haml +6 -0
- data/app/views/kylekthompson_shoppe/countries/index.html.haml +25 -0
- data/app/views/kylekthompson_shoppe/countries/new.html.haml +7 -0
- data/app/views/kylekthompson_shoppe/customers/_addresses.html.haml +20 -0
- data/app/views/kylekthompson_shoppe/customers/_form.html.haml +30 -0
- data/app/views/kylekthompson_shoppe/customers/_search_form.html.haml +13 -0
- data/app/views/kylekthompson_shoppe/customers/edit.html.haml +5 -0
- data/app/views/kylekthompson_shoppe/customers/index.html.haml +32 -0
- data/app/views/kylekthompson_shoppe/customers/new.html.haml +5 -0
- data/app/views/kylekthompson_shoppe/customers/show.html.haml +53 -0
- data/app/views/kylekthompson_shoppe/delivery_service_prices/_form.html.haml +44 -0
- data/app/views/kylekthompson_shoppe/delivery_service_prices/edit.html.haml +6 -0
- data/app/views/kylekthompson_shoppe/delivery_service_prices/index.html.haml +23 -0
- data/app/views/kylekthompson_shoppe/delivery_service_prices/new.html.haml +6 -0
- data/app/views/kylekthompson_shoppe/delivery_services/_form.html.haml +38 -0
- data/app/views/kylekthompson_shoppe/delivery_services/edit.html.haml +9 -0
- data/app/views/kylekthompson_shoppe/delivery_services/index.html.haml +27 -0
- data/app/views/kylekthompson_shoppe/delivery_services/new.html.haml +6 -0
- data/app/views/kylekthompson_shoppe/order_mailer/accepted.text.erb +12 -0
- data/app/views/kylekthompson_shoppe/order_mailer/received.text.erb +9 -0
- data/app/views/kylekthompson_shoppe/order_mailer/rejected.text.erb +10 -0
- data/app/views/kylekthompson_shoppe/order_mailer/shipped.text.erb +16 -0
- data/app/views/kylekthompson_shoppe/orders/_form.html.haml +58 -0
- data/app/views/kylekthompson_shoppe/orders/_order_details.html.haml +57 -0
- data/app/views/kylekthompson_shoppe/orders/_order_items.html.haml +38 -0
- data/app/views/kylekthompson_shoppe/orders/_order_items_form.html.haml +61 -0
- data/app/views/kylekthompson_shoppe/orders/_payments_form.html.haml +15 -0
- data/app/views/kylekthompson_shoppe/orders/_payments_table.html.haml +37 -0
- data/app/views/kylekthompson_shoppe/orders/_search_form.html.haml +24 -0
- data/app/views/kylekthompson_shoppe/orders/_status_bar.html.haml +35 -0
- data/app/views/kylekthompson_shoppe/orders/despatch_note.html.haml +45 -0
- data/app/views/kylekthompson_shoppe/orders/edit.html.haml +21 -0
- data/app/views/kylekthompson_shoppe/orders/index.html.haml +39 -0
- data/app/views/kylekthompson_shoppe/orders/new.html.haml +14 -0
- data/app/views/kylekthompson_shoppe/orders/show.html.haml +25 -0
- data/app/views/kylekthompson_shoppe/payments/refund.html.haml +13 -0
- data/app/views/kylekthompson_shoppe/product_categories/_form.html.haml +50 -0
- data/app/views/kylekthompson_shoppe/product_categories/edit.html.haml +8 -0
- data/app/views/kylekthompson_shoppe/product_categories/index.html.haml +27 -0
- data/app/views/kylekthompson_shoppe/product_categories/new.html.haml +6 -0
- data/app/views/kylekthompson_shoppe/product_category_localisations/form.html.haml +29 -0
- data/app/views/kylekthompson_shoppe/product_category_localisations/index.html.haml +26 -0
- data/app/views/kylekthompson_shoppe/product_localisations/form.html.haml +32 -0
- data/app/views/kylekthompson_shoppe/product_localisations/index.html.haml +26 -0
- data/app/views/kylekthompson_shoppe/products/_form.html.haml +118 -0
- data/app/views/kylekthompson_shoppe/products/_table.html.haml +42 -0
- data/app/views/kylekthompson_shoppe/products/edit.html.haml +9 -0
- data/app/views/kylekthompson_shoppe/products/import.html.haml +67 -0
- data/app/views/kylekthompson_shoppe/products/index.html.haml +9 -0
- data/app/views/kylekthompson_shoppe/products/new.html.haml +7 -0
- data/app/views/kylekthompson_shoppe/sessions/new.html.haml +12 -0
- data/app/views/kylekthompson_shoppe/sessions/reset.html.haml +12 -0
- data/app/views/kylekthompson_shoppe/settings/edit.html.haml +19 -0
- data/app/views/kylekthompson_shoppe/shared/error.html.haml +6 -0
- data/app/views/kylekthompson_shoppe/stock_level_adjustments/index.html.haml +40 -0
- data/app/views/kylekthompson_shoppe/tax_rates/form.html.haml +28 -0
- data/app/views/kylekthompson_shoppe/tax_rates/index.html.haml +17 -0
- data/app/views/kylekthompson_shoppe/user_mailer/new_password.text.erb +9 -0
- data/app/views/kylekthompson_shoppe/users/_form.html.haml +27 -0
- data/app/views/kylekthompson_shoppe/users/edit.html.haml +5 -0
- data/app/views/kylekthompson_shoppe/users/index.html.haml +17 -0
- data/app/views/kylekthompson_shoppe/users/new.html.haml +7 -0
- data/app/views/kylekthompson_shoppe/variants/form.html.haml +68 -0
- data/app/views/kylekthompson_shoppe/variants/index.html.haml +33 -0
- data/app/views/layouts/kylekthompson_shoppe/application.html.haml +34 -0
- data/app/views/layouts/kylekthompson_shoppe/printable.html.haml +11 -0
- data/app/views/layouts/kylekthompson_shoppe/sub.html.haml +10 -0
- data/config/locales/de.yml +653 -0
- data/config/locales/en.yml +744 -0
- data/config/locales/es.yml +653 -0
- data/config/locales/pl.yml +662 -0
- data/config/locales/pt-BR.yml +655 -0
- data/config/routes.rb +53 -0
- data/db/countries.txt +252 -0
- data/db/migrate/20130926094549_create_kylekthompson_shoppe_initial_schema.rb +175 -0
- data/db/migrate/20131024201501_add_address_type_to_kylekthompson_shoppe_tax_rates.rb +5 -0
- data/db/migrate/20131024204815_create_kylekthompson_shoppe_payments.rb +32 -0
- data/db/migrate/20131102143930_remove_default_on_order_item_weight.rb +9 -0
- data/db/migrate/20141013192427_create_kylekthompson_shoppe_customers.rb +14 -0
- data/db/migrate/20141026175622_add_indexes_to_kylekthompson_shoppe_order_items.rb +6 -0
- data/db/migrate/20141026175943_add_indexes_to_kylekthompson_shoppe_orders.rb +7 -0
- data/db/migrate/20141026180333_add_indexes_to_kylekthompson_shoppe_payments.rb +6 -0
- data/db/migrate/20141026180835_add_indexes_to_kylekthompson_shoppe_product_attributes.rb +7 -0
- data/db/migrate/20141026180952_add_indexes_to_kylekthompson_shoppe_product_categories.rb +5 -0
- data/db/migrate/20141026181040_add_indexes_to_kylekthompson_shoppe_products.rb +8 -0
- data/db/migrate/20141026181312_add_indexes_to_kylekthompson_shoppe_settings.rb +5 -0
- data/db/migrate/20141026181354_add_indexes_to_kylekthompson_shoppe_stock_level_adjustments.rb +6 -0
- data/db/migrate/20141026181559_add_indexes_to_kylekthompson_shoppe_users.rb +5 -0
- data/db/migrate/20141026181716_add_indexes_to_kylekthompson_shoppe_delivery_services.rb +9 -0
- data/db/migrate/20141026181717_allow_multiple_kylekthompson_shoppe_products_per_shoppe_product_category.rb +46 -0
- data/db/migrate/20141026181718_add_nested_to_product_categories.rb +30 -0
- data/db/migrate/20141027215005_create_kylekthompson_shoppe_addresses.rb +17 -0
- data/db/migrate/20150315215633_add_customer_to_kylekthompson_shoppe_orders.rb +5 -0
- data/db/migrate/20150513171350_create_kylekthompson_shoppe_product_category_translation_table.rb +17 -0
- data/db/migrate/20150519173350_create_kylekthompson_shoppe_product_translation_table.rb +18 -0
- data/db/schema.rb +308 -0
- data/db/seeds.rb +137 -0
- data/db/seeds_data/poe400.jpg +0 -0
- data/db/seeds_data/snom-870-blk.jpg +0 -0
- data/db/seeds_data/snom-870-grey.jpg +0 -0
- data/db/seeds_data/snom-mm2.jpg +0 -0
- data/db/seeds_data/spa303.jpg +0 -0
- data/db/seeds_data/t18p.jpg +0 -0
- data/db/seeds_data/t20p.jpg +0 -0
- data/db/seeds_data/t22p.jpg +0 -0
- data/db/seeds_data/t26p.jpg +0 -0
- data/db/seeds_data/t41pn.jpg +0 -0
- data/db/seeds_data/t46gn.jpg +0 -0
- data/db/seeds_data/w52p.jpg +0 -0
- data/db/seeds_data/yhs32.jpg +0 -0
- data/lib/kylekthompson_shoppe/associated_countries.rb +20 -0
- data/lib/kylekthompson_shoppe/country_importer.rb +15 -0
- data/lib/kylekthompson_shoppe/default_navigation.rb +21 -0
- data/lib/kylekthompson_shoppe/engine.rb +55 -0
- data/lib/kylekthompson_shoppe/error.rb +21 -0
- data/lib/kylekthompson_shoppe/errors/inappropriate_delivery_service.rb +6 -0
- data/lib/kylekthompson_shoppe/errors/insufficient_stock_to_fulfil.rb +15 -0
- data/lib/kylekthompson_shoppe/errors/invalid_configuration.rb +6 -0
- data/lib/kylekthompson_shoppe/errors/not_enough_stock.rb +15 -0
- data/lib/kylekthompson_shoppe/errors/payment_declined.rb +6 -0
- data/lib/kylekthompson_shoppe/errors/refund_failed.rb +6 -0
- data/lib/kylekthompson_shoppe/errors/unorderable_item.rb +6 -0
- data/lib/kylekthompson_shoppe/navigation_manager.rb +81 -0
- data/lib/kylekthompson_shoppe/orderable_item.rb +39 -0
- data/lib/kylekthompson_shoppe/settings.rb +26 -0
- data/lib/kylekthompson_shoppe/settings_loader.rb +16 -0
- data/lib/kylekthompson_shoppe/setup_generator.rb +10 -0
- data/lib/kylekthompson_shoppe/version.rb +3 -0
- data/lib/kylekthompson_shoppe/view_helpers.rb +16 -0
- data/lib/kylekthompson_shoppe.rb +60 -0
- data/lib/tasks/kylekthompson_shoppe.rake +29 -0
- metadata +662 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
module KylekthompsonShoppe
|
2
|
+
class StockLevelAdjustment < ActiveRecord::Base
|
3
|
+
|
4
|
+
# The orderable item which the stock level adjustment belongs to
|
5
|
+
belongs_to :item, :polymorphic => true
|
6
|
+
|
7
|
+
# The parent (OrderItem) which the stock level adjustment belongs to
|
8
|
+
belongs_to :parent, :polymorphic => true
|
9
|
+
|
10
|
+
# Validations
|
11
|
+
validates :description, :presence => true
|
12
|
+
validates :adjustment, :numericality => true
|
13
|
+
validate { errors.add(:adjustment, I18n.t('kylekthompson_shoppe.activerecord.attributes.stock_level_adjustment.must_be_greater_or_equal_zero')) if adjustment == 0 }
|
14
|
+
|
15
|
+
# All stock level adjustments ordered by their created date desending
|
16
|
+
scope :ordered, -> { order(:id => :desc) }
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module KylekthompsonShoppe
|
2
|
+
class TaxRate < ActiveRecord::Base
|
3
|
+
|
4
|
+
self.table_name = 'kylekthompson_shoppe_tax_rates'
|
5
|
+
|
6
|
+
include KylekthompsonShoppe::AssociatedCountries
|
7
|
+
|
8
|
+
# The order address types which may be used when choosing how to apply the tax rate
|
9
|
+
ADDRESS_TYPES = ['billing', 'delivery']
|
10
|
+
|
11
|
+
# Validations
|
12
|
+
validates :name, :presence => true
|
13
|
+
validates :address_type, :inclusion => {:in => ADDRESS_TYPES}
|
14
|
+
validates :rate, :numericality => true
|
15
|
+
|
16
|
+
# All products which are assigned to this tax rate
|
17
|
+
has_many :products, :dependent => :restrict_with_exception, :class_name => 'KylekthompsonShoppe::Product'
|
18
|
+
|
19
|
+
# All delivery service prices which are assigned to this tax rate
|
20
|
+
has_many :delivery_service_prices, :dependent => :restrict_with_exception, :class_name => 'KylekthompsonShoppe::DeliveryServicePrice'
|
21
|
+
|
22
|
+
# All tax rates ordered by their ID
|
23
|
+
scope :ordered, -> { order(:id)}
|
24
|
+
|
25
|
+
# Set the address type if appropriate
|
26
|
+
before_validation { self.address_type = ADDRESS_TYPES.first if self.address_type.blank? }
|
27
|
+
|
28
|
+
# A description of the tax rate including its name & percentage
|
29
|
+
#
|
30
|
+
# @return [String]
|
31
|
+
def description
|
32
|
+
"#{name} (#{rate}%)"
|
33
|
+
end
|
34
|
+
|
35
|
+
# The rate for a given order based on the rules on the tax rate
|
36
|
+
#
|
37
|
+
# @return [BigDecimal]
|
38
|
+
def rate_for(order)
|
39
|
+
return rate if countries.empty?
|
40
|
+
return rate if address_type == 'billing' && (order.billing_country.nil? || country?(order.billing_country))
|
41
|
+
return rate if address_type == 'delivery' && (order.delivery_country.nil? || country?(order.delivery_country))
|
42
|
+
BigDecimal(0)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module KylekthompsonShoppe
|
2
|
+
class User < ActiveRecord::Base
|
3
|
+
|
4
|
+
self.table_name = 'kylekthompson_shoppe_users'
|
5
|
+
|
6
|
+
has_secure_password
|
7
|
+
|
8
|
+
# Validations
|
9
|
+
validates :first_name, :presence => true
|
10
|
+
validates :last_name, :presence => true
|
11
|
+
validates :email_address, :presence => true
|
12
|
+
|
13
|
+
# The user's first name & last name concatenated
|
14
|
+
#
|
15
|
+
# @return [String]
|
16
|
+
def full_name
|
17
|
+
"#{first_name} #{last_name}"
|
18
|
+
end
|
19
|
+
|
20
|
+
# The user's first name & initial of last name concatenated
|
21
|
+
#
|
22
|
+
# @return [String]
|
23
|
+
def short_name
|
24
|
+
"#{first_name} #{last_name[0,1]}"
|
25
|
+
end
|
26
|
+
|
27
|
+
# Reset the user's password to something random and e-mail it to them
|
28
|
+
def reset_password!
|
29
|
+
self.password = SecureRandom.hex(8)
|
30
|
+
self.password_confirmation = self.password
|
31
|
+
self.save!
|
32
|
+
KylekthompsonShoppe::UserMailer.new_password(self).deliver_now
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attempt to authenticate a user based on email & password. Returns the
|
36
|
+
# user if successful otherwise returns false.
|
37
|
+
#
|
38
|
+
# @param email_address [String]
|
39
|
+
# @param paassword [String]
|
40
|
+
# @return [KylekthompsonShoppe::User]
|
41
|
+
def self.authenticate(email_address, password)
|
42
|
+
user = self.where(:email_address => email_address).first
|
43
|
+
return false if user.nil?
|
44
|
+
return false unless user.authenticate(password)
|
45
|
+
user
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
= form_for @address, url: [@customer, @address] do |f|
|
2
|
+
= f.error_messages
|
3
|
+
|
4
|
+
= field_set_tag "Address Information" do
|
5
|
+
%dl
|
6
|
+
%dt= f.label :address_type
|
7
|
+
%dd= f.select :address_type, KylekthompsonShoppe::Address::TYPES, {}, :class => "chosen"
|
8
|
+
.splitContainer
|
9
|
+
%dl.third
|
10
|
+
%dt= f.label :address1
|
11
|
+
%dd= f.text_field :address1, :class => "text"
|
12
|
+
%dl.third
|
13
|
+
%dt= f.label :address2
|
14
|
+
%dd= f.text_field :address2, :class => "text"
|
15
|
+
%dl.third
|
16
|
+
%dt= f.label :address3
|
17
|
+
%dd= f.text_field :address3, :class => "text"
|
18
|
+
.splitContainer
|
19
|
+
%dl.third
|
20
|
+
%dt= f.label :address4
|
21
|
+
%dd= f.text_field :address4, :class => "text"
|
22
|
+
%dl.third
|
23
|
+
%dt= f.label :postcode
|
24
|
+
%dd= f.text_field :postcode, :class => "text"
|
25
|
+
%dl.third
|
26
|
+
%dt= f.label :country_id
|
27
|
+
%dd= f.collection_select :country_id, KylekthompsonShoppe::Country.ordered, :id, :name, {:include_blank => true}, {:class => 'chosen', :data => { :placeholder => t('kylekthompson_shoppe.orders.select_country')}}
|
28
|
+
|
29
|
+
%p.submit
|
30
|
+
- unless @address.new_record?
|
31
|
+
%span.right= link_to t('kylekthompson_shoppe.delete'), [@customer, @address], :class => 'button purple', :method => :delete, :data => {:confirm => "Are you sure you wish to remove this address?"}
|
32
|
+
= f.submit :class => 'button green', data: {disable_with: (@address.new_record? ? "Creating Address..." : "Updating Address...")}
|
33
|
+
= link_to t('kylekthompson_shoppe.cancel'), :customers, :class => 'button'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
= form_for @country do |f|
|
2
|
+
= f.error_messages
|
3
|
+
= field_set_tag t('kylekthompson_shoppe.countries.country_details') do
|
4
|
+
|
5
|
+
.splitContainer
|
6
|
+
%dl.third
|
7
|
+
%dt= f.label :name, t('kylekthompson_shoppe.countries.name')
|
8
|
+
%dd= f.text_field :name, :class => 'focus text'
|
9
|
+
%dl.third
|
10
|
+
%dt= f.label :code2, t('kylekthompson_shoppe.countries.iso_alpha_2')
|
11
|
+
%dd= f.text_field :code2, :class => 'text'
|
12
|
+
%dl.third
|
13
|
+
%dt= f.label :code3, t('kylekthompson_shoppe.countries.iso_alpha_3')
|
14
|
+
%dd= f.text_field :code3, :class => 'text'
|
15
|
+
|
16
|
+
.splitContainer
|
17
|
+
%dl.third
|
18
|
+
%dt= f.label :continent, t('kylekthompson_shoppe.countries.continent')
|
19
|
+
%dd= f.text_field :continent, :class => 'text'
|
20
|
+
%dl.third
|
21
|
+
%dt= f.label :tld, t('kylekthompson_shoppe.countries.tld')
|
22
|
+
%dd= f.text_field :tld, :class => 'text'
|
23
|
+
%dl.third
|
24
|
+
%dt= f.label :eu_member, t('kylekthompson_shoppe.countries.eu_member')
|
25
|
+
%dd.checkbox
|
26
|
+
= f.check_box :eu_member
|
27
|
+
= f.label :eu_member, t('kylekthompson_shoppe.countries.is_eu_member')
|
28
|
+
|
29
|
+
%p.submit
|
30
|
+
- unless @country.new_record?
|
31
|
+
%span.right
|
32
|
+
= link_to t('kylekthompson_shoppe.delete'), @country, :class => 'button purple',
|
33
|
+
:method => :delete, :data => {:confirm => t('kylekthompson_shoppe.countries.delete_confirmation')}
|
34
|
+
= f.submit t('kylekthompson_shoppe.submit'), :class => 'button green'
|
35
|
+
= link_to t('kylekthompson_shoppe.cancel'), :countries, :class => 'button'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
- @page_title = t('kylekthompson_shoppe.countries.countries')
|
2
|
+
|
3
|
+
= content_for :header do
|
4
|
+
%p.buttons=link_to t('kylekthompson_shoppe.countries.new_country') , :new_country, :class => 'button green'
|
5
|
+
%h2.countries= t('kylekthompson_shoppe.countries.countries')
|
6
|
+
|
7
|
+
.table
|
8
|
+
%table.data
|
9
|
+
%thead
|
10
|
+
%tr
|
11
|
+
%th= t('kylekthompson_shoppe.countries.name')
|
12
|
+
%th= t('kylekthompson_shoppe.countries.iso_alpha_2')
|
13
|
+
%th= t('kylekthompson_shoppe.countries.iso_alpha_3')
|
14
|
+
%th= t('kylekthompson_shoppe.countries.continent')
|
15
|
+
%th= t('kylekthompson_shoppe.countries.tld')
|
16
|
+
%th= t('kylekthompson_shoppe.countries.eu?')
|
17
|
+
%tbody
|
18
|
+
- for country in @countries
|
19
|
+
%tr
|
20
|
+
%td= link_to country.name, [:edit, country]
|
21
|
+
%td= country.code2
|
22
|
+
%td= country.code3
|
23
|
+
%td= country.continent
|
24
|
+
%td= country.tld
|
25
|
+
%td= boolean_tag country.eu_member?
|
@@ -0,0 +1,7 @@
|
|
1
|
+
- @page_title = t('kylekthompson_shoppe.countries.countries')
|
2
|
+
|
3
|
+
= content_for :header do
|
4
|
+
%p.buttons= link_to t('kylekthompson_shoppe.countries.back') , :countries, :class => 'button'
|
5
|
+
%h2.countries= t('kylekthompson_shoppe.countries.countries')
|
6
|
+
|
7
|
+
= render 'form'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
.addresses
|
2
|
+
.table
|
3
|
+
%table.data
|
4
|
+
%thead
|
5
|
+
%tr
|
6
|
+
%th Type
|
7
|
+
%th Default
|
8
|
+
%th Address
|
9
|
+
%th
|
10
|
+
%tbody
|
11
|
+
- if @addresses.empty?
|
12
|
+
%tr.empty
|
13
|
+
%td{:colspan => 4} No addresses to display.
|
14
|
+
- else
|
15
|
+
- for address in @addresses
|
16
|
+
%tr
|
17
|
+
%td= address.address_type.capitalize
|
18
|
+
%td= boolean_tag address.default
|
19
|
+
%td= address.full_address
|
20
|
+
%td= link_to "Edit", edit_customer_address_path(@customer, address)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
= form_for @customer do |f|
|
2
|
+
= f.error_messages
|
3
|
+
|
4
|
+
= field_set_tag "Customer Information" do
|
5
|
+
.splitContainer
|
6
|
+
%dl.third
|
7
|
+
%dt= f.label :first_name
|
8
|
+
%dd= f.text_field :first_name, :class => "text focus"
|
9
|
+
%dl.third
|
10
|
+
%dt= f.label :last_name
|
11
|
+
%dd= f.text_field :last_name, :class => "text"
|
12
|
+
%dl.third
|
13
|
+
%dt= f.label :company
|
14
|
+
%dd= f.text_field :company, :class => "text"
|
15
|
+
.splitContainer
|
16
|
+
%dl.third
|
17
|
+
%dt= f.label :email
|
18
|
+
%dd= f.text_field :email, :class => "text"
|
19
|
+
%dl.third
|
20
|
+
%dt= f.label :phone
|
21
|
+
%dd= f.text_field :phone, :class => "text"
|
22
|
+
%dl.third
|
23
|
+
%dt= f.label :mobile
|
24
|
+
%dd= f.text_field :mobile, :class => "text"
|
25
|
+
|
26
|
+
%p.submit
|
27
|
+
- unless @customer.new_record?
|
28
|
+
%span.right= link_to "Delete", @customer, :class => 'button purple', :method => :delete, :data => {:confirm => "Are you sure you wish to remove this product?"}
|
29
|
+
= f.submit :class => 'button green', data: {disable_with: (@customer.new_record? ? "Creating Customer..." : "Updating Customer...")}
|
30
|
+
= link_to "Cancel", :customers, :class => 'button'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
.customerSearch{:style => action_name == 'search' ? "display:block" : ''}
|
2
|
+
= search_form_for @query, :url => search_customers_path, :html => { :method => :post } do |f|
|
3
|
+
%dl.left
|
4
|
+
%dt= f.label :first_name_or_last_name_or_company_cont, "First or Last Name"
|
5
|
+
%dd= f.text_field :first_name_or_last_name_or_company_cont
|
6
|
+
%dt= f.label :company_cont, "Company"
|
7
|
+
%dd= f.text_field :company_cont
|
8
|
+
%dl.right
|
9
|
+
%dt= f.label :email_cont, "Email Address"
|
10
|
+
%dd= f.text_field :email_cont
|
11
|
+
%dt= f.label :phone_cont, "Phone Number"
|
12
|
+
%dd= f.text_field :phone_cont
|
13
|
+
%dd= f.submit "Search", :class => 'button green button'
|
@@ -0,0 +1,32 @@
|
|
1
|
+
- @page_title = "Customers"
|
2
|
+
|
3
|
+
= content_for :header do
|
4
|
+
%p.buttons
|
5
|
+
= link_to "New Customer", :new_customer, class: "button green"
|
6
|
+
= link_to "Search Customers", '#', class: 'button', rel: "searchCustomers"
|
7
|
+
%h2.users Customers
|
8
|
+
|
9
|
+
= render "search_form"
|
10
|
+
|
11
|
+
.table
|
12
|
+
%table.data
|
13
|
+
%thead
|
14
|
+
%tr
|
15
|
+
%th Name
|
16
|
+
%th Company
|
17
|
+
%th Email
|
18
|
+
%th Phone
|
19
|
+
%th Mobile
|
20
|
+
%tbody
|
21
|
+
- if @customers.empty?
|
22
|
+
%tr.empty
|
23
|
+
%td{colspan: 5} No customers to display.
|
24
|
+
- else
|
25
|
+
- for customer in @customers
|
26
|
+
%tr
|
27
|
+
%td= link_to customer.full_name, customer
|
28
|
+
%td= link_to customer.company, customer
|
29
|
+
%td= customer.email
|
30
|
+
%td= customer.phone
|
31
|
+
%td= customer.mobile
|
32
|
+
= paginate @customers
|
@@ -0,0 +1,53 @@
|
|
1
|
+
- @page_title = "Customer - #{@customer.name}"
|
2
|
+
= content_for :header do
|
3
|
+
%p.buttons
|
4
|
+
= link_to "New Address", [:new, @customer, :address], class: "button"
|
5
|
+
= link_to "Edit", [:edit, @customer], class: "button"
|
6
|
+
%h2.users
|
7
|
+
Customer - #{@customer.name}
|
8
|
+
|
9
|
+
#customer
|
10
|
+
.details
|
11
|
+
.left
|
12
|
+
%dl
|
13
|
+
%dt Name
|
14
|
+
%dd= @customer.full_name
|
15
|
+
%dt Company
|
16
|
+
%dd= @customer.company.blank? ? '-' : @customer.company
|
17
|
+
.right
|
18
|
+
%dl
|
19
|
+
%dt Email Address
|
20
|
+
%dd= mail_to @customer.email
|
21
|
+
%dt Telephone
|
22
|
+
%dd= @customer.phone
|
23
|
+
%dt Mobile
|
24
|
+
%dd= @customer.mobile
|
25
|
+
|
26
|
+
= field_set_tag "Addresses", :class => 'padded' do
|
27
|
+
= render "addresses"
|
28
|
+
|
29
|
+
= field_set_tag t('kylekthompson_shoppe.orders.orders'), :class => 'padded' do
|
30
|
+
.table
|
31
|
+
%table.data
|
32
|
+
%thead
|
33
|
+
%tr
|
34
|
+
%th= t('kylekthompson_shoppe.orders.number')
|
35
|
+
%th= t('kylekthompson_shoppe.orders.status')
|
36
|
+
%th= t('kylekthompson_shoppe.orders.products')
|
37
|
+
%th= t('kylekthompson_shoppe.orders.total')
|
38
|
+
%th= t('kylekthompson_shoppe.orders.payment')
|
39
|
+
%tbody
|
40
|
+
- if @orders.empty?
|
41
|
+
%tr.empty
|
42
|
+
%td{:colspan => 6}= t('kylekthompson_shoppe.orders.no_orders')
|
43
|
+
- else
|
44
|
+
- for order in @orders
|
45
|
+
%tr
|
46
|
+
%td= link_to order.number, order
|
47
|
+
%td= status_tag order.status
|
48
|
+
%td
|
49
|
+
%ul
|
50
|
+
- for item in order.order_items
|
51
|
+
%li #{item.quantity} x #{item.ordered_item.full_name}
|
52
|
+
%td= number_to_currency order.total
|
53
|
+
%td= boolean_tag order.paid_in_full?, nil, :true_text => number_to_currency(order.amount_paid), :false_text => number_to_currency(order.amount_paid)
|
@@ -0,0 +1,44 @@
|
|
1
|
+
= form_for [@delivery_service, @delivery_service_price] do |f|
|
2
|
+
= f.error_messages
|
3
|
+
= field_set_tag t('kylekthompson_shoppe.delivery_service_prices.identification_weight') do
|
4
|
+
.splitContainer
|
5
|
+
%dl.third
|
6
|
+
%dt= f.label :code, t('kylekthompson_shoppe.delivery_service_prices.code')
|
7
|
+
%dd= f.text_field :code, :class => 'focus text'
|
8
|
+
|
9
|
+
%dl.third
|
10
|
+
%dt= f.label :min_weight, t('kylekthompson_shoppe.delivery_service_prices.min_weight')
|
11
|
+
%dd= f.text_field :min_weight, :class => 'text'
|
12
|
+
%dl.third
|
13
|
+
%dt= f.label :max_weight, t('kylekthompson_shoppe.delivery_service_prices.max_weight')
|
14
|
+
%dd= f.text_field :max_weight, :class => 'text'
|
15
|
+
|
16
|
+
= field_set_tag t('kylekthompson_shoppe.delivery_service_prices.pricing') do
|
17
|
+
.splitContainer
|
18
|
+
%dl.third
|
19
|
+
%dt= f.label :price, t('kylekthompson_shoppe.delivery_service_prices.price')
|
20
|
+
%dd
|
21
|
+
.moneyInput
|
22
|
+
.currency= KylekthompsonShoppe.settings.currency_unit.html_safe
|
23
|
+
= f.text_field :price, :class => 'text'
|
24
|
+
%dl.third
|
25
|
+
%dt= f.label :cost_price, t('kylekthompson_shoppe.delivery_service_prices.cost_price')
|
26
|
+
%dd
|
27
|
+
.moneyInput
|
28
|
+
.currency= KylekthompsonShoppe.settings.currency_unit.html_safe
|
29
|
+
= f.text_field :cost_price, :class => 'text'
|
30
|
+
%dl.third
|
31
|
+
%dt= f.label :tax_rate_id, t('kylekthompson_shoppe.delivery_service_prices.tax_rate')
|
32
|
+
%dd= f.collection_select :tax_rate_id, KylekthompsonShoppe::TaxRate.ordered, :id, :description, {:include_blank => true}, {:class => 'chosen-with-deselect', :data => {:placeholder => t('kylekthompson_shoppe.delivery_service_prices.no_tax')}}
|
33
|
+
|
34
|
+
= field_set_tag t('kylekthompson_shoppe.delivery_service_prices.countries') do
|
35
|
+
%dl
|
36
|
+
%dd
|
37
|
+
= f.collection_select :country_ids, KylekthompsonShoppe::Country.ordered, :id, :name, {}, {:class => 'chosen', :multiple => true, :data => {:placeholder => t('kylekthompson_shoppe.delivery_service_prices.all_countries')}}
|
38
|
+
%p.help= t('kylekthompson_shoppe.delivery_service_prices.help.countries')
|
39
|
+
|
40
|
+
%p.submit
|
41
|
+
- unless @delivery_service_price.new_record?
|
42
|
+
%span.right= link_to t('kylekthompson_shoppe.delete'), [@delivery_service, @delivery_service_price], :class => 'button purple', :method => :delete, :data => {:confirm => "Are you sure you wish to remove this price?"}
|
43
|
+
= f.submit t('kylekthompson_shoppe.submit'), :class => 'button green'
|
44
|
+
= link_to t('kylekthompson_shoppe.cancel'), [@delivery_service, :delivery_service_prices], :class => 'button'
|