spina-shop 0.1.0
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 +28 -0
- data/Rakefile +37 -0
- data/app/assets/config/spina_shop_manifest.js +0 -0
- data/app/assets/fonts/montserrat-bold.ttf +0 -0
- data/app/assets/fonts/montserrat-italic.ttf +0 -0
- data/app/assets/fonts/montserrat-medium.ttf +0 -0
- data/app/assets/fonts/montserrat-regular.ttf +0 -0
- data/app/assets/fonts/montserrat-semibold.ttf +0 -0
- data/app/assets/images/spina/shop/delete-big-confirm.png +0 -0
- data/app/assets/images/spina/shop/delete-big.png +0 -0
- data/app/assets/javascripts/spina/shop/admin/app.infinitescroll.js.coffee +23 -0
- data/app/assets/javascripts/spina/shop/admin/customers.coffee +27 -0
- data/app/assets/javascripts/spina/shop/admin/orders.coffee +18 -0
- data/app/assets/javascripts/spina/shop/admin/product_bundles.coffee +15 -0
- data/app/assets/javascripts/spina/shop/admin/product_categories.coffee +15 -0
- data/app/assets/javascripts/spina/shop/admin/products.coffee +88 -0
- data/app/assets/javascripts/spina/shop/admin/shop.js +10 -0
- data/app/assets/stylesheets/spina/shop/admin/_customers.sass +10 -0
- data/app/assets/stylesheets/spina/shop/admin/_forms.sass +191 -0
- data/app/assets/stylesheets/spina/shop/admin/_product_bundles.sass +12 -0
- data/app/assets/stylesheets/spina/shop/admin/_status_dots.sass +16 -0
- data/app/assets/stylesheets/spina/shop/admin/_tables.sass +2 -0
- data/app/assets/stylesheets/spina/shop/admin/_tooltips.sass +31 -0
- data/app/assets/stylesheets/spina/shop/admin/shop.css.sass +11 -0
- data/app/controllers/spina/shop/admin/admin_controller.rb +8 -0
- data/app/controllers/spina/shop/admin/customer_accounts_controller.rb +38 -0
- data/app/controllers/spina/shop/admin/customers_controller.rb +67 -0
- data/app/controllers/spina/shop/admin/discounts_controller.rb +65 -0
- data/app/controllers/spina/shop/admin/gift_cards_controller.rb +65 -0
- data/app/controllers/spina/shop/admin/invoices_controller.rb +12 -0
- data/app/controllers/spina/shop/admin/order_items_controller.rb +36 -0
- data/app/controllers/spina/shop/admin/orders/packing_slips_controller.rb +27 -0
- data/app/controllers/spina/shop/admin/orders/shipping_labels_controller.rb +19 -0
- data/app/controllers/spina/shop/admin/orders_controller.rb +123 -0
- data/app/controllers/spina/shop/admin/product_reviews_controller.rb +17 -0
- data/app/controllers/spina/shop/admin/products/product_bundles_controller.rb +62 -0
- data/app/controllers/spina/shop/admin/products/stock_forecasts_controller.rb +15 -0
- data/app/controllers/spina/shop/admin/products/stock_level_adjustments_controller.rb +33 -0
- data/app/controllers/spina/shop/admin/products_controller.rb +135 -0
- data/app/controllers/spina/shop/admin/reports_controller.rb +33 -0
- data/app/controllers/spina/shop/admin/settings/product_categories_controller.rb +45 -0
- data/app/controllers/spina/shop/admin/settings/product_category_properties_controller.rb +49 -0
- data/app/controllers/spina/shop/admin/settings/sales_categories_controller.rb +14 -0
- data/app/controllers/spina/shop/admin/settings/shop_controller.rb +9 -0
- data/app/controllers/spina/shop/admin/settings/tax_groups_controller.rb +47 -0
- data/app/controllers/spina/shop/admin/variants_controller.rb +8 -0
- data/app/jobs/spina/shop/in_stock_reminder_job.rb +17 -0
- data/app/jobs/spina/shop/invoice_report_job.rb +23 -0
- data/app/jobs/spina/shop/payments_report_job.rb +23 -0
- data/app/mailers/spina/shop/customer_account_mailer.rb +32 -0
- data/app/mailers/spina/shop/export_mailer.rb +22 -0
- data/app/mailers/spina/shop/in_stock_reminder_mailer.rb +22 -0
- data/app/mailers/spina/shop/order_mailer.rb +32 -0
- data/app/models/concerns/spina/shop/preferable.rb +27 -0
- data/app/models/concerns/spina/shop/tax_rateable.rb +11 -0
- data/app/models/spina/shop/address.rb +19 -0
- data/app/models/spina/shop/application_record.rb +5 -0
- data/app/models/spina/shop/bundled_product.rb +6 -0
- data/app/models/spina/shop/campaign.rb +4 -0
- data/app/models/spina/shop/collectable.rb +8 -0
- data/app/models/spina/shop/country.rb +5 -0
- data/app/models/spina/shop/customer.rb +60 -0
- data/app/models/spina/shop/customer_account.rb +15 -0
- data/app/models/spina/shop/customer_group.rb +9 -0
- data/app/models/spina/shop/delivery_option.rb +27 -0
- data/app/models/spina/shop/discount.rb +39 -0
- data/app/models/spina/shop/discount_action.rb +16 -0
- data/app/models/spina/shop/discount_rule.rb +17 -0
- data/app/models/spina/shop/discounts/actions/percent_off.rb +17 -0
- data/app/models/spina/shop/discounts/rules/all_orders.rb +13 -0
- data/app/models/spina/shop/discounts/rules/collection.rb +14 -0
- data/app/models/spina/shop/discounts/rules/order_total.rb +17 -0
- data/app/models/spina/shop/discounts_order.rb +6 -0
- data/app/models/spina/shop/favorite.rb +8 -0
- data/app/models/spina/shop/gift_card.rb +53 -0
- data/app/models/spina/shop/gift_cards_order.rb +6 -0
- data/app/models/spina/shop/in_stock_reminder.rb +7 -0
- data/app/models/spina/shop/invoice.rb +49 -0
- data/app/models/spina/shop/invoice_line.rb +13 -0
- data/app/models/spina/shop/number_sequence.rb +19 -0
- data/app/models/spina/shop/order.rb +222 -0
- data/app/models/spina/shop/order/billing.rb +85 -0
- data/app/models/spina/shop/order/state_machine_transitions.rb +106 -0
- data/app/models/spina/shop/order_attachment.rb +9 -0
- data/app/models/spina/shop/order_item.rb +101 -0
- data/app/models/spina/shop/order_transition.rb +5 -0
- data/app/models/spina/shop/product.rb +227 -0
- data/app/models/spina/shop/product_bundle.rb +51 -0
- data/app/models/spina/shop/product_bundle_part.rb +13 -0
- data/app/models/spina/shop/product_category.rb +18 -0
- data/app/models/spina/shop/product_category_property.rb +14 -0
- data/app/models/spina/shop/product_collection.rb +8 -0
- data/app/models/spina/shop/product_image.rb +18 -0
- data/app/models/spina/shop/product_item.rb +93 -0
- data/app/models/spina/shop/product_part.rb +13 -0
- data/app/models/spina/shop/product_relation.rb +6 -0
- data/app/models/spina/shop/product_review.rb +22 -0
- data/app/models/spina/shop/property_option.rb +16 -0
- data/app/models/spina/shop/sales_category.rb +43 -0
- data/app/models/spina/shop/sales_category_code.rb +20 -0
- data/app/models/spina/shop/shop_review.rb +19 -0
- data/app/models/spina/shop/stock_level_adjustment.rb +17 -0
- data/app/models/spina/shop/tax_group.rb +62 -0
- data/app/models/spina/shop/tax_rate.rb +20 -0
- data/app/models/spina/shop/zone.rb +11 -0
- data/app/pdfs/spina/shop/invoice_pdf.rb +114 -0
- data/app/pdfs/spina/shop/packing_slip_pdf.rb +74 -0
- data/app/presenters/spina/shop/invoice_presenter.rb +30 -0
- data/app/services/spina/shop/allocate_stock.rb +42 -0
- data/app/services/spina/shop/cache_order.rb +47 -0
- data/app/services/spina/shop/change_stock_level.rb +38 -0
- data/app/services/spina/shop/country_importer.rb +14 -0
- data/app/services/spina/shop/customer_generator.rb +32 -0
- data/app/services/spina/shop/deallocate_stock.rb +17 -0
- data/app/services/spina/shop/invoice_generator.rb +72 -0
- data/app/services/spina/shop/invoice_number_generator.rb +10 -0
- data/app/services/spina/shop/invoices_pdfs_exporter.rb +22 -0
- data/app/services/spina/shop/order_number_generator.rb +10 -0
- data/app/services/spina/shop/payments_excel_exporter.rb +41 -0
- data/app/services/spina/shop/store_address.rb +23 -0
- data/app/state_machines/spina/shop/order_state_machine.rb +116 -0
- data/app/uploaders/spina/shop/exports_uploader.rb +9 -0
- data/app/views/layouts/spina/shop/admin/settings/shop.html.haml +16 -0
- data/app/views/layouts/spina/shop/mail.html.erb +1 -0
- data/app/views/spina/admin/hooks/shop/_head.html.haml +2 -0
- data/app/views/spina/admin/hooks/shop/_primary_navigation.html.haml +31 -0
- data/app/views/spina/admin/hooks/shop/_settings_secondary_navigation.html.haml +2 -0
- data/app/views/spina/admin/page_partables/shop/product_bundle_parts/_form.html.haml +6 -0
- data/app/views/spina/admin/page_partables/shop/product_parts/_form.html.haml +6 -0
- data/app/views/spina/admin/structure_partables/shop/product_parts/_form.html.haml +3 -0
- data/app/views/spina/shop/admin/customer_accounts/_form.html.haml +32 -0
- data/app/views/spina/shop/admin/customer_accounts/edit.html.haml +1 -0
- data/app/views/spina/shop/admin/customers/_address_fields.html.haml +46 -0
- data/app/views/spina/shop/admin/customers/_customer.html.haml +11 -0
- data/app/views/spina/shop/admin/customers/_form.html.haml +67 -0
- data/app/views/spina/shop/admin/customers/edit.html.haml +1 -0
- data/app/views/spina/shop/admin/customers/index.html.haml +52 -0
- data/app/views/spina/shop/admin/customers/index.js.erb +4 -0
- data/app/views/spina/shop/admin/customers/new.html.haml +1 -0
- data/app/views/spina/shop/admin/customers/show.html.haml +121 -0
- data/app/views/spina/shop/admin/discounts/_form.html.haml +60 -0
- data/app/views/spina/shop/admin/discounts/edit.html.haml +1 -0
- data/app/views/spina/shop/admin/discounts/fields/_all_orders.html.haml +0 -0
- data/app/views/spina/shop/admin/discounts/fields/_discount_action_fields.html.haml +8 -0
- data/app/views/spina/shop/admin/discounts/fields/_discount_rule_fields.html.haml +0 -0
- data/app/views/spina/shop/admin/discounts/index.html.haml +36 -0
- data/app/views/spina/shop/admin/discounts/new.html.haml +1 -0
- data/app/views/spina/shop/admin/gift_cards/_form.html.haml +28 -0
- data/app/views/spina/shop/admin/gift_cards/_gift_card.html.haml +17 -0
- data/app/views/spina/shop/admin/gift_cards/index.html.haml +37 -0
- data/app/views/spina/shop/admin/gift_cards/index.js.erb +4 -0
- data/app/views/spina/shop/admin/gift_cards/new.html.haml +1 -0
- data/app/views/spina/shop/admin/gift_cards/show.html.haml +46 -0
- data/app/views/spina/shop/admin/order_items/_modal.html.haml +18 -0
- data/app/views/spina/shop/admin/order_items/new.js.erb +2 -0
- data/app/views/spina/shop/admin/orders/_form.html.haml +159 -0
- data/app/views/spina/shop/admin/orders/_order.html.haml +22 -0
- data/app/views/spina/shop/admin/orders/edit.html.haml +1 -0
- data/app/views/spina/shop/admin/orders/index.html.haml +78 -0
- data/app/views/spina/shop/admin/orders/index.js.erb +4 -0
- data/app/views/spina/shop/admin/orders/new.html.haml +1 -0
- data/app/views/spina/shop/admin/orders/show.html.haml +338 -0
- data/app/views/spina/shop/admin/product_reviews/_product_review.html.haml +22 -0
- data/app/views/spina/shop/admin/product_reviews/index.html.haml +29 -0
- data/app/views/spina/shop/admin/product_reviews/index.js.erb +4 -0
- data/app/views/spina/shop/admin/products/_form.html.haml +259 -0
- data/app/views/spina/shop/admin/products/_new_product_modal.html.haml +15 -0
- data/app/views/spina/shop/admin/products/_price_exception_fields.html.haml +11 -0
- data/app/views/spina/shop/admin/products/_product.html.haml +36 -0
- data/app/views/spina/shop/admin/products/edit.html.haml +1 -0
- data/app/views/spina/shop/admin/products/index.html.haml +73 -0
- data/app/views/spina/shop/admin/products/index.js.erb +4 -0
- data/app/views/spina/shop/admin/products/new.html.haml +1 -0
- data/app/views/spina/shop/admin/products/new_by_category.js.erb +1 -0
- data/app/views/spina/shop/admin/products/product_bundles/_bundled_products_fields.html.haml +11 -0
- data/app/views/spina/shop/admin/products/product_bundles/_form.html.haml +64 -0
- data/app/views/spina/shop/admin/products/product_bundles/edit.html.haml +1 -0
- data/app/views/spina/shop/admin/products/product_bundles/index.html.haml +42 -0
- data/app/views/spina/shop/admin/products/product_bundles/new.html.haml +1 -0
- data/app/views/spina/shop/admin/products/properties/_property_fields.html.haml +37 -0
- data/app/views/spina/shop/admin/products/stock_forecasts/_product.html.haml +49 -0
- data/app/views/spina/shop/admin/products/stock_forecasts/show.html.haml +47 -0
- data/app/views/spina/shop/admin/products/stock_forecasts/show.js.erb +4 -0
- data/app/views/spina/shop/admin/products/stock_level_adjustments/_form.html.haml +37 -0
- data/app/views/spina/shop/admin/products/stock_level_adjustments/_history.html.haml +30 -0
- data/app/views/spina/shop/admin/products/stock_level_adjustments/index.js.erb +1 -0
- data/app/views/spina/shop/admin/products/stock_level_adjustments/new.js.erb +1 -0
- data/app/views/spina/shop/admin/reports/index.html.haml +23 -0
- data/app/views/spina/shop/admin/settings/product_categories/_form.html.haml +18 -0
- data/app/views/spina/shop/admin/settings/product_categories/_product_category.html.haml +3 -0
- data/app/views/spina/shop/admin/settings/product_categories/_property_fields.html.haml +77 -0
- data/app/views/spina/shop/admin/settings/product_categories/edit.html.haml +1 -0
- data/app/views/spina/shop/admin/settings/product_categories/index.html.haml +3 -0
- data/app/views/spina/shop/admin/settings/product_categories/show.html.haml +24 -0
- data/app/views/spina/shop/admin/settings/product_category_properties/_property_options_fields.html.haml +11 -0
- data/app/views/spina/shop/admin/settings/product_category_properties/edit_options.html.haml +16 -0
- data/app/views/spina/shop/admin/settings/sales_categories/_sales_category.html.haml +17 -0
- data/app/views/spina/shop/admin/settings/sales_categories/index.html.haml +1 -0
- data/app/views/spina/shop/admin/settings/tax_groups/_form.html.haml +19 -0
- data/app/views/spina/shop/admin/settings/tax_groups/_tax_group.html.haml +21 -0
- data/app/views/spina/shop/admin/settings/tax_groups/index.html.haml +1 -0
- data/app/views/spina/shop/admin/settings/tax_groups/new.js.erb +1 -0
- data/app/views/spina/shop/admin/shared/_locale_switcher.html.haml +9 -0
- data/app/views/spina/shop/customer_account_mailer/forgot_password.html.erb +1 -0
- data/app/views/spina/shop/customer_account_mailer/forgot_password.txt.erb +1 -0
- data/app/views/spina/shop/export_mailer/exported.html.erb +2 -0
- data/app/views/spina/shop/in_stock_reminder_mailer/reminder.html.erb +1 -0
- data/app/views/spina/shop/in_stock_reminder_mailer/reminder.txt.erb +1 -0
- data/app/views/spina/shop/order_mailer/confirmation.html.erb +5 -0
- data/app/views/spina/shop/order_mailer/confirmation.txt.erb +5 -0
- data/app/views/spina/shop/order_mailer/shipped.html.erb +1 -0
- data/app/views/spina/shop/order_mailer/shipped.txt.erb +1 -0
- data/config/initializers/kaminari_monkey_patch.rb +15 -0
- data/config/locales/en.yml +214 -0
- data/config/locales/nl.yml +452 -0
- data/config/routes.rb +92 -0
- data/db/countries.txt +252 -0
- data/db/migrate/10_create_spina_shop_products_without_items.rb +23 -0
- data/db/migrate/1_create_spina_shop_tables.rb +518 -0
- data/db/migrate/20170701135207_create_spina_shop_bundled_products.rb +11 -0
- data/db/migrate/20170717125930_add_stock_enabled_to_spina_shop_products.rb +5 -0
- data/db/migrate/20170718084146_add_editable_sku_to_spina_shop_products.rb +5 -0
- data/db/migrate/20170718084626_add_deletable_to_spina_shop_products.rb +5 -0
- data/db/migrate/20170719082531_rename_column_order_picked_at_in_spina_shop_orders.rb +5 -0
- data/db/migrate/20170719112920_create_spina_shop_order_attachments.rb +15 -0
- data/db/migrate/20170719184125_add_price_exceptions_to_spina_shop_products.rb +5 -0
- data/db/migrate/20170720133304_add_vat_id_to_spina_shop_customers.rb +5 -0
- data/db/migrate/20170731082027_add_price_includes_tax_to_spina_shop_products.rb +5 -0
- data/db/migrate/20170731132620_add_reverse_charge_vat_to_spina_shop_tax_rates.rb +5 -0
- data/db/migrate/20170731150630_add_vat_id_to_spina_shop_invoices.rb +5 -0
- data/db/migrate/20170801093935_add_price_includes_tax_to_spina_shop_delivery_options.rb +5 -0
- data/db/migrate/20170814092924_add_business_to_spina_shop_orders.rb +6 -0
- data/db/migrate/20170815080839_rename_vat_reverse_charge_column_on_tax_rates.rb +5 -0
- data/db/migrate/20170815081018_add_business_to_spina_shop_tax_rates.rb +5 -0
- data/db/migrate/20170817075706_add_archived_to_spina_shop_products.rb +5 -0
- data/db/migrate/20170824175231_add_metadata_to_photos.rb +7 -0
- data/db/migrate/20170829085402_add_business_to_spina_shop_sales_category_codes.rb +5 -0
- data/db/migrate/20170911121034_add_trend_to_spina_shop_products.rb +5 -0
- data/db/migrate/20171106122225_add_editable_fields_to_spina_shop_product_category_properties.rb +6 -0
- data/db/migrate/20171106122537_create_property_options.rb +19 -0
- data/db/migrate/20171118110256_add_promotional_price_to_spina_shop_products.rb +6 -0
- data/db/migrate/2_create_spina_shop_tax_rates.rb +15 -0
- data/db/migrate/3_create_spina_shop_zones.rb +9 -0
- data/db/migrate/4_add_tax_rateable_to_spina_shop_tax_rates.rb +9 -0
- data/db/migrate/5_add_type_to_spina_shop_zones.rb +5 -0
- data/db/migrate/6_add_code_to_spina_shop_zones.rb +5 -0
- data/db/migrate/7_create_spina_shop_product_collections.rb +16 -0
- data/db/migrate/8_create_spina_shop_sales_category_codes.rb +13 -0
- data/db/migrate/9_create_spina_shop_customer_groups.rb +11 -0
- data/lib/generators/spina/shop/install_generator.rb +44 -0
- data/lib/spina/shop.rb +24 -0
- data/lib/spina/shop/admin_helpers.rb +49 -0
- data/lib/spina/shop/engine.rb +27 -0
- data/lib/spina/shop/errors/empty_order.rb +6 -0
- data/lib/spina/shop/errors/order_already_received.rb +6 -0
- data/lib/spina/shop/railtie.rb +31 -0
- data/lib/spina/shop/simple_linear_regression.rb +36 -0
- data/lib/spina/shop/version.rb +5 -0
- data/lib/spina/shop/view_helpers.rb +11 -0
- data/lib/tasks/spina/shop.rake +32 -0
- metadata +627 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 129d8f70d156227ba58e5082e035e650632bad90
|
4
|
+
data.tar.gz: 80e088de364760ac0194f2cea4abb08ff4696185
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c96b079a50f7346e19d630ba59ccc1e1334d010009244afcfea9594ef4a86ca82028bc63b0ef53c475de0f019a1dbeaa585573cdc5f75ec9e4d584dec597602a
|
7
|
+
data.tar.gz: 5a585a6b458142856729ae673d8fbcbe7bb613233c37cc738b0bb2998cfb0b39d99a6b79f23ffc250c78312b33d21fee61842e92070e047b26821c87c242ea48
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Bram Jetten
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Spina::Shop
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'spina-shop'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install spina-shop
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Spina::Shop'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
require 'bundler/gem_tasks'
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'lib'
|
31
|
+
t.libs << 'test'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = false
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
task default: :test
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
window.App = {}
|
2
|
+
|
3
|
+
class App.InfiniteScroll
|
4
|
+
|
5
|
+
@init: (link) ->
|
6
|
+
$(window).off('scroll.infiniteScroll')
|
7
|
+
|
8
|
+
$link = $(link)
|
9
|
+
if (url = $link.find('a').attr('href'))
|
10
|
+
$(window).on 'scroll.infiniteScroll', => @loadNextPage($link)
|
11
|
+
$(window).scroll()
|
12
|
+
|
13
|
+
@loadNextPage: ($link) ->
|
14
|
+
if ($(window).scrollTop() > $link.offset().top - $(window).height() - 500)
|
15
|
+
$(window).off('scroll.infiniteScroll')
|
16
|
+
$.rails.disableElement($link.find('a'))
|
17
|
+
$.getScript($link.find('a').attr('href'))
|
18
|
+
|
19
|
+
$.fn.infiniteScroll = () ->
|
20
|
+
App.InfiniteScroll.init(this)
|
21
|
+
|
22
|
+
$(document).on 'turbolinks:before-render', ->
|
23
|
+
$(window).off('scroll.infiniteScroll')
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Dynamically add and remove fields in a nested form
|
2
|
+
$(document).on 'click', 'form .add_address_fields', (event) ->
|
3
|
+
time = new Date().getTime()
|
4
|
+
regexp = new RegExp($(this).data('id'), 'g')
|
5
|
+
$(this).before($(this).data('fields').replace(regexp, time))
|
6
|
+
|
7
|
+
# Fire event
|
8
|
+
$(this).closest('form').trigger('spina:address_fields_added')
|
9
|
+
|
10
|
+
event.preventDefault()
|
11
|
+
|
12
|
+
$(document).on 'click', 'form .remove_address_fields', (event) ->
|
13
|
+
$(this).prev('input[type=hidden]').val('1')
|
14
|
+
$(this).closest('.sidebar-form-group').slideUp()
|
15
|
+
event.preventDefault()
|
16
|
+
|
17
|
+
ready = ->
|
18
|
+
if $('#validate_vat_id').length
|
19
|
+
url = $('#validate_vat_id').attr('data-url')
|
20
|
+
$.getJSON url, (response) ->
|
21
|
+
if response.valid
|
22
|
+
$('#validate_vat_id .result').html('<i class="icon icon-check text-success"></i>')
|
23
|
+
$('#validate_vat_id .result').append("<pre>#{response.details.name}#{response.details.address}</pre>")
|
24
|
+
else
|
25
|
+
$('#validate_vat_id .result').html('<i class="icon icon-cross text-danger"></i>')
|
26
|
+
|
27
|
+
$(document).on 'turbolinks:load', ready
|
@@ -0,0 +1,18 @@
|
|
1
|
+
toggleSwitch = (toggle) ->
|
2
|
+
$toggle = toggle
|
3
|
+
$target = $($toggle.attr('data-toggle'))
|
4
|
+
|
5
|
+
if $toggle.prop('checked')
|
6
|
+
$target.show()
|
7
|
+
else
|
8
|
+
$target.hide()
|
9
|
+
|
10
|
+
ready = ->
|
11
|
+
$('[data-toggle]').each ->
|
12
|
+
toggleSwitch($(this))
|
13
|
+
|
14
|
+
$(document).on 'change', '[data-toggle]', (e) ->
|
15
|
+
console.log 'hoi'
|
16
|
+
toggleSwitch($(this))
|
17
|
+
|
18
|
+
$(document).on 'turbolinks:load', ready
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Dynamically add and remove fields in a nested form
|
2
|
+
$(document).on 'click', 'form .add_product_fields', (event) ->
|
3
|
+
time = new Date().getTime()
|
4
|
+
regexp = new RegExp($(this).data('id'), 'g')
|
5
|
+
$(this).before($(this).data('fields').replace(regexp, time))
|
6
|
+
|
7
|
+
# Fire event
|
8
|
+
$(this).closest('form').trigger('spina:product_fields_added')
|
9
|
+
|
10
|
+
event.preventDefault()
|
11
|
+
|
12
|
+
$(document).on 'click', 'form .remove_product_fields', (event) ->
|
13
|
+
$(this).prev('input[type=hidden]').val('1')
|
14
|
+
$(this).closest('.sidebar-form-group').slideUp()
|
15
|
+
event.preventDefault()
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Dynamically add and remove fields in a nested form
|
2
|
+
$(document).on 'click', 'form .add_property_option_fields', (event) ->
|
3
|
+
time = new Date().getTime()
|
4
|
+
regexp = new RegExp($(this).data('id'), 'g')
|
5
|
+
$(this).before($(this).data('fields').replace(regexp, time))
|
6
|
+
|
7
|
+
# Fire event
|
8
|
+
$(this).closest('form').trigger('spina:property_option_fields_added')
|
9
|
+
|
10
|
+
event.preventDefault()
|
11
|
+
|
12
|
+
$(document).on 'click', 'form .remove_property_option_fields', (event) ->
|
13
|
+
$(this).prev('input[type=hidden]').val('1')
|
14
|
+
$(this).closest('.sidebar-form-group').slideUp()
|
15
|
+
event.preventDefault()
|
@@ -0,0 +1,88 @@
|
|
1
|
+
window.Spina = {}
|
2
|
+
|
3
|
+
class Spina.Products
|
4
|
+
@enhance: (element) ->
|
5
|
+
element.find('select.select-products:not(.select2-hidden-accessible)').each ->
|
6
|
+
$select = $(this)
|
7
|
+
$select.select2(
|
8
|
+
ajax:
|
9
|
+
url: '/admin/shop/products'
|
10
|
+
delay: 250
|
11
|
+
dataType: 'json'
|
12
|
+
data: (params) ->
|
13
|
+
q: {translations_name_start: params.term}, page: params.page
|
14
|
+
minimumInputLength: 1
|
15
|
+
processResults: (data, params) ->
|
16
|
+
params.page = params.page or 1
|
17
|
+
return {
|
18
|
+
results: data.results
|
19
|
+
pagination: { more: (params.page * 25) < data.total_count }
|
20
|
+
}
|
21
|
+
cache: true
|
22
|
+
escapeMarkup: (markup) ->
|
23
|
+
return markup
|
24
|
+
templateResult: (product) ->
|
25
|
+
return product.text if product.loading
|
26
|
+
"<div class='select-products-result'><div class='select-products-result-image'><img src='#{product.image_url}' /></div><span>#{product.name} <small>#{product.price}</small></span></div>"
|
27
|
+
templateSelection: (product) ->
|
28
|
+
product.name || product.text
|
29
|
+
minimumInputLength: 1
|
30
|
+
)
|
31
|
+
|
32
|
+
$.fn.enhanceProducts = ->
|
33
|
+
Spina.Products.enhance(this)
|
34
|
+
|
35
|
+
ready = ->
|
36
|
+
el = document.getElementById('productImageUploader')
|
37
|
+
if el
|
38
|
+
sortable = Sortable.create el, {
|
39
|
+
onSort: (e) ->
|
40
|
+
for id, index in sortable.toArray()
|
41
|
+
$(el).find(".sidebar-form-image[data-id='#{id}'] .product-image-position").val(index)
|
42
|
+
}
|
43
|
+
|
44
|
+
$('body').enhanceProducts()
|
45
|
+
$('select.select2').select2()
|
46
|
+
$('.infinite-table .pagination, .infinite-list .pagination').infiniteScroll()
|
47
|
+
|
48
|
+
$(document).on 'turbolinks:load', ready
|
49
|
+
|
50
|
+
$(document).on 'turbolinks:before-cache', ->
|
51
|
+
$('select.select2').select2('destroy')
|
52
|
+
$('select.select-products').select2('destroy')
|
53
|
+
|
54
|
+
$(document).on 'click', '.filter-form-advanced-link', (e) ->
|
55
|
+
$('.filter-form-advanced').animate({
|
56
|
+
margin: 'toggle',
|
57
|
+
height: 'toggle',
|
58
|
+
opacity: 'toggle'
|
59
|
+
})
|
60
|
+
e.preventDefault()
|
61
|
+
|
62
|
+
$(document).on 'click', '.sidebar-form-image a', (e) ->
|
63
|
+
$checkbox = $(this).parents('.sidebar-form-image').find('input[type="checkbox"]')
|
64
|
+
$checkbox.prop("checked", !$checkbox.prop("checked"))
|
65
|
+
e.preventDefault()
|
66
|
+
|
67
|
+
$(document).on 'spina:structure_added', 'form', (e) ->
|
68
|
+
$(this).enhanceProducts()
|
69
|
+
|
70
|
+
$(document).on 'spina:product_fields_added', 'form', (e) ->
|
71
|
+
$(this).enhanceProducts()
|
72
|
+
$('select.select2').select2()
|
73
|
+
|
74
|
+
# Dynamically add and remove fields in a nested form
|
75
|
+
$(document).on 'click', 'form .add_price_exception', (event) ->
|
76
|
+
time = new Date().getTime()
|
77
|
+
regexp = new RegExp($(this).data('id'), 'g')
|
78
|
+
$(this).before($(this).data('fields').replace(regexp, time))
|
79
|
+
|
80
|
+
# Fire event
|
81
|
+
$(this).closest('form').trigger('spina:price_exception_added')
|
82
|
+
|
83
|
+
event.preventDefault()
|
84
|
+
|
85
|
+
$(document).on 'click', 'form .remove_price_exception', (event) ->
|
86
|
+
$(this).closest('.form-control').slideUp 400, ->
|
87
|
+
$(this).remove()
|
88
|
+
event.preventDefault()
|
@@ -0,0 +1,191 @@
|
|
1
|
+
// Select2
|
2
|
+
.select2-container
|
3
|
+
font-size: 14px
|
4
|
+
z-index: 999
|
5
|
+
|
6
|
+
.select2-dropdown
|
7
|
+
border: 1px solid #bbb !important
|
8
|
+
border-bottom: 1px solid #c3c3c3 !important
|
9
|
+
border-top: 1px solid #eee !important
|
10
|
+
box-shadow: 0 10px 12px rgba(0, 0, 0, .2)
|
11
|
+
z-index: 5
|
12
|
+
|
13
|
+
.select2-selection, .select2-selection--multiple
|
14
|
+
background: none
|
15
|
+
border: none !important
|
16
|
+
color: #333
|
17
|
+
height: 50px !important
|
18
|
+
outline: none !important
|
19
|
+
padding: 10px 0
|
20
|
+
|
21
|
+
.select2-selection--multiple
|
22
|
+
height: auto !important
|
23
|
+
|
24
|
+
input
|
25
|
+
height: auto !important
|
26
|
+
padding: 6px 0 !important
|
27
|
+
|
28
|
+
.select2-selection__choice
|
29
|
+
background: #ededf2 !important
|
30
|
+
border: 1px solid #c3c3c3 !important
|
31
|
+
border-radius: 3px !important
|
32
|
+
padding: 4px 8px 4px 6px !important
|
33
|
+
|
34
|
+
.select2-results__option
|
35
|
+
font-size: 14px !important
|
36
|
+
line-height: 24px
|
37
|
+
padding-left: 6px !important
|
38
|
+
|
39
|
+
.select2-results__option[aria-selected="true"]
|
40
|
+
background: #ededf2 !important
|
41
|
+
|
42
|
+
.select2-results__option--highlighted, .select2-results__option--highlighted[aria-selected="true"]
|
43
|
+
background: #6867b2 !important
|
44
|
+
|
45
|
+
.select2-search__field
|
46
|
+
border: none !important
|
47
|
+
box-shadow: none !important
|
48
|
+
padding-left: 4px !important
|
49
|
+
|
50
|
+
.select2-selection__rendered
|
51
|
+
padding-left: 10px !important
|
52
|
+
|
53
|
+
.select2-selection__arrow
|
54
|
+
margin-top: 10px
|
55
|
+
margin-right: 8px
|
56
|
+
|
57
|
+
b
|
58
|
+
border-color: #333 transparent transparent transparent !important
|
59
|
+
|
60
|
+
&.select2-container--open .select2-selection__arrow b
|
61
|
+
border-color: transparent transparent #333 transparent !important
|
62
|
+
|
63
|
+
// Select products
|
64
|
+
.horizontal-form-content
|
65
|
+
.select2-container
|
66
|
+
.selection
|
67
|
+
.select2-selection, .select2-selection--multiple
|
68
|
+
border: 1px solid #bbb !important
|
69
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .1) !important
|
70
|
+
height: auto !important
|
71
|
+
padding: 3px 0 !important
|
72
|
+
@include transition(border-color .2s ease)
|
73
|
+
|
74
|
+
&:hover
|
75
|
+
border-color: $primary-color !important
|
76
|
+
|
77
|
+
.select2-selection__arrow
|
78
|
+
margin-top: 4px
|
79
|
+
|
80
|
+
.select-products-result
|
81
|
+
.select-products-result-image
|
82
|
+
display: inline-block
|
83
|
+
margin-right: 5px
|
84
|
+
vertical-align: middle
|
85
|
+
width: 30px
|
86
|
+
|
87
|
+
img
|
88
|
+
display: block
|
89
|
+
margin: 0 auto
|
90
|
+
|
91
|
+
span
|
92
|
+
font-weight: 600
|
93
|
+
|
94
|
+
small
|
95
|
+
color: #666
|
96
|
+
font-weight: 400
|
97
|
+
|
98
|
+
.select2-results__option--highlighted, .select2-results__option--highlighted[aria-selected="true"]
|
99
|
+
.select-products-result span small
|
100
|
+
color: #fff
|
101
|
+
|
102
|
+
// Filter form
|
103
|
+
|
104
|
+
.filter-form
|
105
|
+
margin-top: 20px
|
106
|
+
|
107
|
+
.filter-form-simple
|
108
|
+
display: flex
|
109
|
+
|
110
|
+
.filter-form-input
|
111
|
+
flex: 1
|
112
|
+
position: relative
|
113
|
+
|
114
|
+
input
|
115
|
+
background: tint($primary-color, 85%)
|
116
|
+
border: none
|
117
|
+
box-shadow: none
|
118
|
+
height: 40px
|
119
|
+
padding: 0 14px
|
120
|
+
|
121
|
+
a
|
122
|
+
color: #333
|
123
|
+
display: block
|
124
|
+
font-size: 14px
|
125
|
+
font-weight: 600
|
126
|
+
height: 40px
|
127
|
+
line-height: 40px
|
128
|
+
opacity: .35
|
129
|
+
padding: 0 14px
|
130
|
+
position: absolute
|
131
|
+
right: 0px
|
132
|
+
top: 0px
|
133
|
+
|
134
|
+
button
|
135
|
+
height: 40px
|
136
|
+
line-height: 40px
|
137
|
+
margin-bottom: 0
|
138
|
+
margin-left: 10px
|
139
|
+
margin-right: 0
|
140
|
+
padding: 0 18px
|
141
|
+
vertical-align: middle
|
142
|
+
white-space: nowrap
|
143
|
+
|
144
|
+
.filter-form-advanced
|
145
|
+
background: tint($primary-color, 85%)
|
146
|
+
border-radius: 3px
|
147
|
+
display: none
|
148
|
+
margin-top: 20px
|
149
|
+
|
150
|
+
.filter-form-advanced-group
|
151
|
+
border-bottom: 1px solid rgba(0, 0, 0, .05)
|
152
|
+
display: flex
|
153
|
+
|
154
|
+
&:last-child
|
155
|
+
border-bottom: none
|
156
|
+
|
157
|
+
.filter-form-label
|
158
|
+
color: #333
|
159
|
+
font-size: 14px
|
160
|
+
font-weight: 500
|
161
|
+
line-height: 40px
|
162
|
+
padding: 0 14px
|
163
|
+
width: 250px
|
164
|
+
|
165
|
+
.filter-form-control
|
166
|
+
flex: 1
|
167
|
+
|
168
|
+
input
|
169
|
+
background: transparent
|
170
|
+
border: none
|
171
|
+
box-shadow: none
|
172
|
+
height: 40px
|
173
|
+
padding: 0 14px
|
174
|
+
|
175
|
+
.select2-container
|
176
|
+
.selection
|
177
|
+
.select2-selection, .select2-selection--multiple
|
178
|
+
background: transparent
|
179
|
+
border: none !important
|
180
|
+
box-shadow: none !important
|
181
|
+
height: auto !important
|
182
|
+
padding: 2px 0 !important
|
183
|
+
|
184
|
+
.select2-selection__rendered
|
185
|
+
padding-left: 14px !important
|
186
|
+
|
187
|
+
.select2-selection__arrow
|
188
|
+
margin-top: 4px
|
189
|
+
|
190
|
+
.select2-selection__choice
|
191
|
+
background: tint($primary-color, 75%) !important
|