workarea-gift_wrapping 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.editorconfig +20 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.gitignore +23 -0
- data/CHANGELOG.md +34 -0
- data/CODE_OF_CONDUCT.md +3 -0
- data/CONTRIBUTING.md +3 -0
- data/Gemfile +9 -0
- data/LICENSE +52 -0
- data/README.md +41 -0
- data/Rakefile +60 -0
- data/app/controllers/workarea/admin/catalog_gift_wraps_controller.rb +77 -0
- data/app/models/workarea/catalog/gift_wrap.rb +10 -0
- data/app/models/workarea/catalog/product.decorator +7 -0
- data/app/models/workarea/checkout/steps/shipping.decorator +57 -0
- data/app/models/workarea/order/item.decorator +53 -0
- data/app/models/workarea/pricing/calculators/gift_wrapping_calculator.rb +38 -0
- data/app/models/workarea/pricing/request.decorator +9 -0
- data/app/models/workarea/shipping.decorator +10 -0
- data/app/seeds/workarea/gift_wrapping_seeds.rb +19 -0
- data/app/view_models/workarea/order_item_view_model.decorator +19 -0
- data/app/view_models/workarea/storefront/checkout/gift_options_view_model.rb +45 -0
- data/app/view_models/workarea/storefront/checkout/summary_view_model.decorator +11 -0
- data/app/views/workarea/admin/catalog_gift_wraps/_aux_navigation.html.haml +7 -0
- data/app/views/workarea/admin/catalog_gift_wraps/_navigation.html.haml +1 -0
- data/app/views/workarea/admin/catalog_gift_wraps/edit.html.haml +38 -0
- data/app/views/workarea/admin/catalog_gift_wraps/index.html.haml +41 -0
- data/app/views/workarea/admin/catalog_gift_wraps/new.html.haml +39 -0
- data/app/views/workarea/admin/catalog_products/_gift_wrapping_fields.html.haml +3 -0
- data/app/views/workarea/admin/orders/_gift_wrapping.html.haml +4 -0
- data/app/views/workarea/admin/shippings/_gift_message.html.haml +5 -0
- data/app/views/workarea/storefront/checkouts/_gift_message.html.haml +10 -0
- data/app/views/workarea/storefront/checkouts/_gift_message_summary.html.haml +4 -0
- data/app/views/workarea/storefront/checkouts/_gift_wrapping.html.haml +34 -0
- data/app/views/workarea/storefront/checkouts/_gift_wrapping_summary.html.haml +5 -0
- data/app/views/workarea/storefront/order_mailer/_gift_message.html.haml +8 -0
- data/app/views/workarea/storefront/order_mailer/_gift_message.text.erb +5 -0
- data/app/views/workarea/storefront/order_mailer/_gift_wrapping.html.haml +4 -0
- data/app/views/workarea/storefront/order_mailer/_gift_wrapping.text.erb +3 -0
- data/app/views/workarea/storefront/orders/_gift_message.html.haml +7 -0
- data/app/views/workarea/storefront/orders/_gift_wrapping.html.haml +4 -0
- data/bin/rails +20 -0
- data/config/initializers/appends.rb +68 -0
- data/config/initializers/configuration.rb +15 -0
- data/config/locales/en.yml +42 -0
- data/config/routes.rb +5 -0
- data/lib/workarea/gift_wrapping/engine.rb +22 -0
- data/lib/workarea/gift_wrapping/version.rb +5 -0
- data/lib/workarea/gift_wrapping.rb +11 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +4 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +37 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/bin/yarn +11 -0
- data/test/dummy/config/application.rb +27 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +54 -0
- data/test/dummy/config/environments/production.rb +91 -0
- data/test/dummy/config/environments/test.rb +44 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +14 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/workarea.rb +5 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +56 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +32 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/db/seeds.rb +2 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/factories/workarea/gift_wrapping.rb +21 -0
- data/test/integration/workarea/admin/catalog_gift_wrap_integration_test.rb +50 -0
- data/test/integration/workarea/storefront/gift_wrapping_integration_test.rb +76 -0
- data/test/models/workarea/checkout/steps/gift_wrapping_shipping_test.rb +37 -0
- data/test/models/workarea/order/gift_wrapping_item_test.rb +52 -0
- data/test/models/workarea/pricing/calculators/gift_wrapping_calculator_test.rb +84 -0
- data/test/system/workarea/admin/gift_wrap_system_test.rb +48 -0
- data/test/system/workarea/storefront/gift_wrap_system_test.rb +93 -0
- data/test/teaspoon_env.rb +6 -0
- data/test/test_helper.rb +10 -0
- data/workarea-gift_wrapping.gemspec +21 -0
- metadata +170 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module Workarea
|
|
2
|
+
module Storefront
|
|
3
|
+
module Checkout
|
|
4
|
+
module GiftOptionsViewModel
|
|
5
|
+
extend ActiveSupport::Concern
|
|
6
|
+
|
|
7
|
+
included do
|
|
8
|
+
delegate :gift_message, to: :shipping, allow_nil: true
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def gift_message?
|
|
12
|
+
gift_message.present?
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Whether to show gift wrapping as an option in checkout.
|
|
16
|
+
# Based on whether the Catalog has any configured gift wrap.
|
|
17
|
+
#
|
|
18
|
+
# @return [Boolean]
|
|
19
|
+
#
|
|
20
|
+
def offer_gift_wrapping?
|
|
21
|
+
gift_wraps.any?
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# An array of gift wrapping options from the Catalog.
|
|
25
|
+
# First element is the name, second is the id.
|
|
26
|
+
# Used in the gift wrap select on the shipping step.
|
|
27
|
+
#
|
|
28
|
+
# @return [Array<Array>]
|
|
29
|
+
#
|
|
30
|
+
def gift_wrapping_options
|
|
31
|
+
@gift_wrapping_options ||=
|
|
32
|
+
[['None', nil]] + gift_wraps.map do |gift_wrap|
|
|
33
|
+
[gift_wrap.name, gift_wrap.id.to_s]
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def gift_wraps
|
|
40
|
+
@gift_wraps ||= Catalog::GiftWrap.all.to_a
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Workarea
|
|
2
|
+
decorate Storefront::Checkout::SummaryViewModel, with: :gift_wrapping do
|
|
3
|
+
# Whether to show order gift messages summary info.
|
|
4
|
+
#
|
|
5
|
+
# @return [Boolean]
|
|
6
|
+
#
|
|
7
|
+
def show_gift_message?
|
|
8
|
+
shippings.one? && shipping.gift_message.present?
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
.grid.grid--auto.grid--right.grid--middle
|
|
2
|
+
.grid__cell
|
|
3
|
+
- if @pricing.present?
|
|
4
|
+
= link_to t('workarea.admin.catalog_gift_wraps.edit.view_pricing'), pricing_sku_path(@pricing)
|
|
5
|
+
- else
|
|
6
|
+
= link_to t('workarea.admin.catalog_gift_wraps.edit.create_pricing'), new_pricing_sku_path('sku[id]' => model.sku)
|
|
7
|
+
= append_partials('admin.catalog_gift_wrap_aux_navigation', model: model)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
%li{ class: "primary-nav__item" }= link_to t('workarea.admin.shared.primary_nav.gift_wraps'), catalog_gift_wraps_path, class: navigation_link_classes(catalog_gift_wraps_path)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
- @page_title = t('workarea.admin.catalog_gift_wraps.edit.title', name: @gift_wrap.name)
|
|
2
|
+
|
|
3
|
+
.view
|
|
4
|
+
.view__header
|
|
5
|
+
.grid
|
|
6
|
+
.grid__cell.grid__cell--25
|
|
7
|
+
.grid__cell.grid__cell--50
|
|
8
|
+
.view__heading
|
|
9
|
+
= link_to_index_for(@gift_wrap)
|
|
10
|
+
%h1= t('workarea.admin.catalog_gift_wraps.edit.title', name: @gift_wrap.name)
|
|
11
|
+
.grid__cell.grid__cell--25
|
|
12
|
+
= render_aux_navigation_for(@gift_wrap)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
.view__container
|
|
16
|
+
- if @gift_wrap.errors.present?
|
|
17
|
+
- @gift_wrap.errors.full_messages.each do |message|
|
|
18
|
+
= render_message 'error', message
|
|
19
|
+
|
|
20
|
+
= form_tag catalog_gift_wrap_path(@gift_wrap), method: :put, id: 'shipping_gift_wrap_form', data: { unsaved_changes: '' } do
|
|
21
|
+
|
|
22
|
+
.section
|
|
23
|
+
|
|
24
|
+
.property.property--required
|
|
25
|
+
= label_tag 'gift_wrap[name]', t('workarea.admin.fields.name'), class: 'property__name'
|
|
26
|
+
= text_field_tag 'gift_wrap[name]', @gift_wrap.name, class: 'text-box text-box--i18n', required: true
|
|
27
|
+
|
|
28
|
+
.property
|
|
29
|
+
= label_tag 'gift_wrap[sku]', t('workarea.admin.fields.sku'), class: 'property__name'
|
|
30
|
+
= text_field_tag "gift_wrap[sku]", @gift_wrap.sku, class: 'text-box', required: true
|
|
31
|
+
%span.property__note= t('workarea.admin.catalog_gift_wraps.sku_note')
|
|
32
|
+
|
|
33
|
+
.workflow-bar
|
|
34
|
+
.grid
|
|
35
|
+
.grid__cell.grid__cell--50
|
|
36
|
+
= link_to t('workarea.admin.actions.delete'), catalog_gift_wrap_path(@gift_wrap), class: 'workflow-bar__button workflow-bar__button--delete', data: { method: 'delete', confirm: t('workarea.admin.actions.delete_confirmation') }
|
|
37
|
+
.grid__cell.grid__cell--50
|
|
38
|
+
.align-right= button_tag t('workarea.admin.catalog_gift_wraps.edit.button'), value: 'create_gift_wrap', class: 'workflow-bar__button workflow-bar__button--create'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
- @page_title = t('workarea.admin.catalog_gift_wraps.index.title')
|
|
2
|
+
|
|
3
|
+
.view
|
|
4
|
+
.view__header
|
|
5
|
+
.grid.grid--middle.grid--center
|
|
6
|
+
.grid__cell.grid__cell--50
|
|
7
|
+
.view__heading
|
|
8
|
+
= link_to "↑ #{t('workarea.admin.catalog.dashboard_link')}", catalog_dashboards_path, class: 'view__dashboard-button'
|
|
9
|
+
%h1= t('workarea.admin.catalog_gift_wraps.index.title')
|
|
10
|
+
|
|
11
|
+
.view__container
|
|
12
|
+
|
|
13
|
+
.browsing-controls
|
|
14
|
+
%p.browsing-controls__count{ data: { browsing_controls_count: @gift_wraps.count } }
|
|
15
|
+
= pluralize(@gift_wraps.count, t('workarea.admin.catalog_gift_wraps.name'))
|
|
16
|
+
|
|
17
|
+
- if @gift_wraps.any?
|
|
18
|
+
%table.index-table
|
|
19
|
+
%thead
|
|
20
|
+
%tr
|
|
21
|
+
%th.index-table__control-cell
|
|
22
|
+
%th= t('workarea.admin.fields.name')
|
|
23
|
+
%th= t('workarea.admin.fields.sku')
|
|
24
|
+
%th= t('workarea.admin.fields.updated_at')
|
|
25
|
+
%tbody
|
|
26
|
+
- @gift_wraps.each do |result|
|
|
27
|
+
%tr.index-table__row
|
|
28
|
+
%td.index-table__control-cell
|
|
29
|
+
.checkbox.hidden
|
|
30
|
+
= check_box_tag 'global_id', result.to_global_id.to_param, false, class: 'checkbox__input', id: dom_id(result)
|
|
31
|
+
= label_tag dom_id(result), t('workarea.admin.bulk_actions.add_summary_button'), class: 'checkbox__label'
|
|
32
|
+
%td= link_to result.name, edit_catalog_gift_wrap_path(result)
|
|
33
|
+
%td= result.sku
|
|
34
|
+
%td= local_time_ago(result.updated_at)
|
|
35
|
+
|
|
36
|
+
- if @gift_wraps.total_pages > 1
|
|
37
|
+
= render 'workarea/admin/shared/pagination', collection: @gift_wraps
|
|
38
|
+
|
|
39
|
+
.workflow-bar
|
|
40
|
+
.grid.grid--auto.grid--right
|
|
41
|
+
.grid__cell= link_to t('workarea.admin.catalog_gift_wraps.index.button'), new_catalog_gift_wrap_path, id: 'add_gift_wrap', class: 'workflow-bar__button workflow-bar__button--create'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
- @page_title = t('workarea.admin.catalog_gift_wraps.new.title')
|
|
2
|
+
|
|
3
|
+
.view
|
|
4
|
+
.view__header
|
|
5
|
+
.grid.grid--middle.grid--center
|
|
6
|
+
.grid__cell.grid__cell--50
|
|
7
|
+
.view__heading
|
|
8
|
+
= link_to_index_for(@gift_wrap)
|
|
9
|
+
%h1= t('workarea.admin.catalog_gift_wraps.new.title')
|
|
10
|
+
|
|
11
|
+
.view__container
|
|
12
|
+
- if @gift_wrap.errors.present?
|
|
13
|
+
- @gift_wrap.errors.full_messages.each do |message|
|
|
14
|
+
= render_message 'error', message
|
|
15
|
+
|
|
16
|
+
= form_tag catalog_gift_wraps_path, method: :post, id: 'shipping_gift_wrap_form', data: { unsaved_changes: '' } do
|
|
17
|
+
|
|
18
|
+
.section
|
|
19
|
+
|
|
20
|
+
.property.property--required
|
|
21
|
+
= label_tag 'gift_wrap[name]', t('workarea.admin.fields.name'), class: 'property__name'
|
|
22
|
+
= text_field_tag 'gift_wrap[name]', @gift_wrap.name, class: 'text-box text-box--i18n', required: true
|
|
23
|
+
|
|
24
|
+
.property
|
|
25
|
+
= label_tag 'gift_wrap[sku]', t('workarea.admin.fields.sku'), class: 'property__name'
|
|
26
|
+
= text_field_tag "gift_wrap[sku]", @gift_wrap.sku, class: 'text-box', required: true
|
|
27
|
+
|
|
28
|
+
.property
|
|
29
|
+
= label_tag 'pricing_sku[regular]', t('workarea.admin.fields.price'), class: 'property__name'
|
|
30
|
+
= currency_symbol
|
|
31
|
+
= text_field_tag 'pricing_sku[regular]', params['pricing'].try(:[], 'regular'), class: 'text-box text-box--small', title: t('workarea.admin.fields.regular'), placeholder: t('workarea.admin.prices.placeholder')
|
|
32
|
+
|
|
33
|
+
.property
|
|
34
|
+
= label_tag 'pricing_sku[tax_code]', t('workarea.admin.fields.tax_code'), class: 'property__name'
|
|
35
|
+
= text_field_tag 'pricing_sku[tax_code]', params['pricing'].try(:[], 'tax_code'), class: 'text-box', placeholder: t('workarea.admin.pricing_skus.tax_code_placeholder')
|
|
36
|
+
|
|
37
|
+
.workflow-bar
|
|
38
|
+
.grid.grid--auto.grid--right.grid--middle
|
|
39
|
+
.grid__cell= button_tag t('workarea.admin.catalog_gift_wraps.new.button'), value: 'create_gift_wrap', class: 'workflow-bar__button workflow-bar__button--create'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
.checkout-shipping__section
|
|
2
|
+
%h2.checkout-shipping__heading= t('workarea.storefront.checkouts.gift_message')
|
|
3
|
+
- field_name = step.shippings.many? ? "shippings[#{step.shipping.id}][gift_message]" : 'gift_message'
|
|
4
|
+
|
|
5
|
+
.property.property--responsive
|
|
6
|
+
= label_tag field_name, nil, class: 'property__name' do
|
|
7
|
+
%span.property__text= t('workarea.storefront.checkouts.gift_message')
|
|
8
|
+
.value
|
|
9
|
+
= text_area_tag field_name, step.gift_message, class: 'text-box text-box--multi-line', title: t('workarea.storefront.checkouts.gift_message'), maxlength: Workarea.config.gift_message_max_length, id: nil
|
|
10
|
+
%span.value__note= t('workarea.storefront.checkouts.gift_message_note', length: Workarea.config.gift_message_max_length)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
- if step.offer_gift_wrapping?
|
|
2
|
+
.checkout-shipping__section
|
|
3
|
+
%h2.checkout-shipping__heading= t('workarea.storefront.checkouts.gift_wrapping')
|
|
4
|
+
- field_name = step.shippings.many? ? "shippings[#{step.shipping.id}][gift_wrapping]" : 'gift_wrapping'
|
|
5
|
+
|
|
6
|
+
%ul.product-list{ data: { analytics: product_list_analytics_data('Cart').to_json } }
|
|
7
|
+
- cart.items.each_with_index do |item, index|
|
|
8
|
+
%li.product-list__item
|
|
9
|
+
.product-list__item-cell
|
|
10
|
+
.product-list__summary
|
|
11
|
+
%p.product-list__media= link_to image_tag(product_image_url(item.image, :small_thumb), alt: item.product_name, class: 'product-list__media-image'), product_url(item.product, sku: item.sku), class: 'product-list__media-link'
|
|
12
|
+
.product-list__info
|
|
13
|
+
%p.product-list__name= link_to item.product_name, product_path(item.product, sku: item.sku)
|
|
14
|
+
%p.product-list__id= item.sku_name
|
|
15
|
+
%p.product-list__inventory-status= item.inventory_status
|
|
16
|
+
- if item.has_options?
|
|
17
|
+
.product-list__option-group
|
|
18
|
+
- item.details.each do |name, value|
|
|
19
|
+
%p.product-list__option #{name.titleize}: #{value}
|
|
20
|
+
- item.customizations.each do |name, value|
|
|
21
|
+
%p.product-list__customization #{name.titleize}: #{value}
|
|
22
|
+
.grid.grid--auto
|
|
23
|
+
.grid__cell
|
|
24
|
+
- if !item.allow_gift_wrapping?
|
|
25
|
+
%span.text= t('workarea.storefront.checkouts.gift_wrapping_unavailable')
|
|
26
|
+
|
|
27
|
+
- else
|
|
28
|
+
.inline-form__cell{ data: { checkout_shipping_service: '' } }
|
|
29
|
+
= label_tag "#{field_name}[#{item.id}][gift_wrap]", nil, class: 'name' do
|
|
30
|
+
%span.text= t('workarea.storefront.checkouts.gift_wrapping')
|
|
31
|
+
.value= select_tag "#{field_name}[#{item.id}][gift_wrap]", options_for_select(step.gift_wrapping_options, item.gift_wrap_id), title: t('workarea.storefront.checkouts.gift_wrapping_title', name: item.product_name), data: { checkout_shipping_service_option: '' }
|
|
32
|
+
|
|
33
|
+
- if step.content_blocks_for('gift_wrapping').present?
|
|
34
|
+
= render_content_blocks(step.content_blocks_for('gift_wrapping'))
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
- if shipping.gift_message.present?
|
|
2
|
+
%tr
|
|
3
|
+
%td{ valign: "top" }
|
|
4
|
+
%h2{ style: "margin: 0 0 6px; font: bold 14px arial; color: #{@config.text_color};" }
|
|
5
|
+
= t('workarea.storefront.checkouts.gift_message')
|
|
6
|
+
|
|
7
|
+
%p{ style: "margin: 0 0 6px; font: 13px/1.5 arial; color: #{@config.text_color};" }
|
|
8
|
+
= shipping.gift_message
|
data/bin/rails
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This command will automatically be run when you run "rails" with Rails gems
|
|
3
|
+
# installed from the root of your application.
|
|
4
|
+
|
|
5
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
|
6
|
+
ENGINE_PATH = File.expand_path('../../lib/workarea/gift_wrapping/engine', __FILE__)
|
|
7
|
+
APP_PATH = File.expand_path('../../test/dummy/config/application', __FILE__)
|
|
8
|
+
|
|
9
|
+
# Set up gems listed in the Gemfile.
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
|
11
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
|
12
|
+
|
|
13
|
+
require 'action_controller/railtie'
|
|
14
|
+
require 'action_view/railtie'
|
|
15
|
+
require 'action_mailer/railtie'
|
|
16
|
+
require 'rails/test_unit/railtie'
|
|
17
|
+
require 'sprockets/railtie'
|
|
18
|
+
require 'teaspoon-mocha'
|
|
19
|
+
|
|
20
|
+
require 'rails/engine/commands'
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Workarea.append_partials(
|
|
2
|
+
'storefront.checkout_shipping_fields',
|
|
3
|
+
'workarea/storefront/checkouts/gift_message'
|
|
4
|
+
)
|
|
5
|
+
|
|
6
|
+
Workarea.append_partials(
|
|
7
|
+
'storefront.checkout_shipping_step_form',
|
|
8
|
+
'workarea/storefront/checkouts/gift_wrapping'
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
Workarea.append_partials(
|
|
12
|
+
'storefront.checkout_cart_summary_item_details',
|
|
13
|
+
'workarea/storefront/checkouts/gift_wrapping_summary'
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
Workarea.append_partials(
|
|
17
|
+
'storefront.checkout_summary_shipping_attributes',
|
|
18
|
+
'workarea/storefront/checkouts/gift_message_summary'
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
Workarea.append_partials(
|
|
22
|
+
'storefront.order_summary_item_details',
|
|
23
|
+
'workarea/storefront/orders/gift_wrapping'
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
Workarea.append_partials(
|
|
27
|
+
'storefront.cart_summary_item_details',
|
|
28
|
+
'workarea/storefront/orders/gift_wrapping'
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
Workarea.append_partials(
|
|
32
|
+
'storefront.order_summary_shipping',
|
|
33
|
+
'workarea/storefront/orders/gift_message'
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
Workarea.append_partials(
|
|
37
|
+
'storefront.order_mailer_summary_order_details',
|
|
38
|
+
'workarea/storefront/order_mailer/gift_wrapping'
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
Workarea.append_partials(
|
|
42
|
+
'storefront.order_mailer_summary_shipping',
|
|
43
|
+
'workarea/storefront/order_mailer/gift_message'
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
#
|
|
47
|
+
# ADMIN
|
|
48
|
+
#
|
|
49
|
+
|
|
50
|
+
Workarea.append_partials(
|
|
51
|
+
'admin.catalog_menu',
|
|
52
|
+
'workarea/admin/catalog_gift_wraps/navigation'
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
Workarea.append_partials(
|
|
56
|
+
'admin.product_fields',
|
|
57
|
+
'workarea/admin/catalog_products/gift_wrapping_fields'
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
Workarea.append_partials(
|
|
61
|
+
'admin.shipping_details',
|
|
62
|
+
'workarea/admin/shippings/gift_message'
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
Workarea.append_partials(
|
|
66
|
+
'admin.order_attributes_item_details',
|
|
67
|
+
'workarea/admin/orders/gift_wrapping'
|
|
68
|
+
)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Workarea.configure do |config|
|
|
2
|
+
# Maximum length allowed for order gift messages
|
|
3
|
+
config.gift_message_max_length = 500
|
|
4
|
+
|
|
5
|
+
# Add checkout content area for gift wrapping
|
|
6
|
+
config.content_areas['checkout'] ||= []
|
|
7
|
+
config.content_areas['checkout'] << 'gift_wrapping'
|
|
8
|
+
|
|
9
|
+
config.pricing_calculators.insert_after(
|
|
10
|
+
'Workarea::Pricing::Calculators::CustomizationsCalculator',
|
|
11
|
+
'Workarea::Pricing::Calculators::GiftWrappingCalculator'
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
config.seeds << 'Workarea::GiftWrappingSeeds'
|
|
15
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
en:
|
|
2
|
+
workarea:
|
|
3
|
+
admin:
|
|
4
|
+
catalog_products:
|
|
5
|
+
gift_wrapping_fields:
|
|
6
|
+
allow_gift_wrapping: Allow Gift Wrapping?
|
|
7
|
+
catalog_gift_wraps:
|
|
8
|
+
name: Gift Wrap
|
|
9
|
+
sku_note: SKU should correspond to pricing for this gift wrap.
|
|
10
|
+
index:
|
|
11
|
+
title: Gift Wrap
|
|
12
|
+
button: Add New Gift Wrap
|
|
13
|
+
new:
|
|
14
|
+
title: Add a Gift Wrap
|
|
15
|
+
button: Create Gift Wrap
|
|
16
|
+
edit:
|
|
17
|
+
title: Edit %{name} Gift Wrap
|
|
18
|
+
view_pricing: View Pricing
|
|
19
|
+
create_pricing: Create Pricing
|
|
20
|
+
button: Save Gift Wrap
|
|
21
|
+
flash_messages:
|
|
22
|
+
success: Gift wrap successfully saved.
|
|
23
|
+
error: There was a problem saving your gift wrap.
|
|
24
|
+
destroyed: Gift wrap has been deleted.
|
|
25
|
+
fields:
|
|
26
|
+
gift_message: Gift Message
|
|
27
|
+
orders:
|
|
28
|
+
attributes:
|
|
29
|
+
gift_wrap: Gift Wrap
|
|
30
|
+
shared:
|
|
31
|
+
primary_nav:
|
|
32
|
+
gift_wraps: Gift Wrap
|
|
33
|
+
storefront:
|
|
34
|
+
checkouts:
|
|
35
|
+
gift_message: Gift Message
|
|
36
|
+
gift_message_note: "%{length} Character Limit."
|
|
37
|
+
gift_wrapping: Gift Wrapping
|
|
38
|
+
gift_wrapping_unavailable: This item cannot be gift wrapped.
|
|
39
|
+
gift_wrapping_title: Gift wrapping for %{name}
|
|
40
|
+
item_gift_wrap: "Gift Wrap:"
|
|
41
|
+
gift_wrap:
|
|
42
|
+
price_adjustment: Gift Wrapping
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Workarea
|
|
2
|
+
module GiftWrapping
|
|
3
|
+
class Engine < ::Rails::Engine
|
|
4
|
+
include Workarea::Plugin
|
|
5
|
+
isolate_namespace Workarea::GiftWrapping
|
|
6
|
+
|
|
7
|
+
config.to_prepare do
|
|
8
|
+
Storefront::Checkout::ShippingViewModel.send(
|
|
9
|
+
:include,
|
|
10
|
+
Storefront::Checkout::GiftOptionsViewModel
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
if Plugin.installed?('split_shipping')
|
|
14
|
+
Storefront::Checkout::SplitShippingViewModel.send(
|
|
15
|
+
:include,
|
|
16
|
+
Storefront::Checkout::GiftOptionsViewModel
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/test/dummy/Rakefile
ADDED
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require_tree .
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
+
* It is generally better to create a new file per style scope.
|
|
12
|
+
*
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= yield %>
|
data/test/dummy/bin/rake
ADDED