workarea-product_additional_details 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e960d95d86b881dfd8169b49adf2578199a77d57a13ce0fdbb697e547d0bb01
4
- data.tar.gz: 58bb272159911acbc726c2de885ca1abc807df87bb7000a64868d263674a9af1
3
+ metadata.gz: 3e235f8b30c8067b9fd6366c84544be6548d3b000b4eaf58bee51bcb6da0b54f
4
+ data.tar.gz: b87b4d155c5b13e678fbeb7f2b6a9b4cf6e09aa2e067bb2335d48ac5834a75ff
5
5
  SHA512:
6
- metadata.gz: 315251934f247ad299b91852b3c337b5e52dd3066e5e69b4108d485c080645638c45cccc8a38c8ff2403d797aa00e2a671c51ed1b173dddc52811375753a6e0b
7
- data.tar.gz: 1737886c2f354846fee3ac52675d42613e5cf57e0c73344545caeba98d16ae4178e29b32a4cdc34973a45afaf839466974c6b789f34bce4d02ca451bf518dd87
6
+ metadata.gz: 5ce7b2aba4e97048e000dedf1d4b73f5860a550813dca02e8a54cb84bb441d81e7158de8a1a40382629a928ade5bde90706a1032e5acd065dd13ff9fe8e2d112
7
+ data.tar.gz: f58b83155832027b07b3c1f94f494507e4ab28718ca101e46cdcf2c279e279ca62ba7708ededc87344a4afb9ff03816f1ede02c1a19d6eb6b2531d9cda608f24
@@ -0,0 +1,27 @@
1
+ module Workarea
2
+ decorate Admin::CatalogVariantsController, with: :product_additional_details do
3
+
4
+ def update
5
+ @variant = @product.variants.find(params[:id])
6
+ set_details
7
+ set_additional_details
8
+
9
+ if @variant.update_attributes(params[:variant])
10
+ flash[:success] = t('workarea.admin.catalog_variants.flash_messages.saved')
11
+ redirect_to catalog_product_variants_path(@product)
12
+ else
13
+ flash[:error] = t('workarea.admin.catalog_variants.flash_messages.changes_error')
14
+ render :edit
15
+ end
16
+ end
17
+
18
+ def set_additional_details
19
+ @variant.additional_details = HashUpdate.new(
20
+ original: @product.additional_details,
21
+ adds: params[:new_additional_details],
22
+ updates: params[:additional_details],
23
+ removes: params[:additional_details_to_remove]
24
+ ).result_grouped
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,7 @@
1
+ module Workarea
2
+ decorate Catalog::Variant, with: :product_additional_details do
3
+ decorated do
4
+ field :additional_details, type: Hash, default: {}, localize: true
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,31 @@
1
+ .section.section--additional-details
2
+ %h2= "Additional Details"
3
+
4
+ %table
5
+ %thead
6
+ %tr
7
+ %th= t('workarea.admin.catalog_products.edit.details.name')
8
+ %th= "Content"
9
+ %th.align-center= t('workarea.admin.actions.delete')
10
+ %tbody.bottom-align
11
+ - variant.additional_details.each do |name, value|
12
+ %tr
13
+ %td
14
+ .property
15
+ = label_tag "details_#{name}" do
16
+ #{name}
17
+ %td
18
+ .property
19
+ = hidden_field_tag 'additional_details[]', name, id: nil
20
+ = text_area_tag 'additional_details[]', value, class: 'text-box text-box--i18n', id: nil
21
+ %td.align-center= check_box_tag 'additional_details_to_remove[]', name, false, id: nil, title: "#{t('workarea.admin.actions.delete')}: #{name} #{value}"
22
+ %tr{ data: { cloneable_row: '' } }
23
+ %td
24
+ .property
25
+ = text_field_tag 'new_additional_details[]', nil, id: nil, class: 'text-box text-box--i18n', title: t('workarea.admin.catalog_products.edit.details.new_attribute_name'), placeholder: t('workarea.admin.catalog_products.edit.details.new_attribute_name_placeholder')
26
+ %span.property__note= "Example: User Manual"
27
+ %td
28
+ .property
29
+ = text_area_tag 'new_additional_details[]', nil, id: nil, class: 'text-box text-box--i18n', title: t('workarea.admin.catalog_products.edit.details.new_attribute_value'), placeholder: t('workarea.admin.catalog_products.edit.details.new_attribute_value_placeholder')
30
+ %span.property__note= "Example: <a href='/manuals'>Download Manuals</a>"
31
+ %td.align-center -
@@ -2,3 +2,7 @@ Workarea.append_partials(
2
2
  'admin.additional_product_details_information',
3
3
  'workarea/admin/catalog_products/additional_details'
4
4
  )
5
+ Workarea.append_partials(
6
+ 'admin.additional_variant_information_fields',
7
+ 'workarea/admin/catalog_variants/additional_details'
8
+ )
@@ -1,5 +1,5 @@
1
1
  module Workarea
2
2
  module ProductAdditionalDetails
3
- VERSION = "2.0.1".freeze
3
+ VERSION = "2.0.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-product_additional_details
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gunasekaran Raja
@@ -46,14 +46,17 @@ files:
46
46
  - app/assets/stylesheets/workarea/storefront/product_additional_details/.keep
47
47
  - app/controllers/.keep
48
48
  - app/controllers/workarea/admin/catalog_products_controller.decorator
49
+ - app/controllers/workarea/admin/catalog_variants_controller.decorator
49
50
  - app/controllers/workarea/admin/create_catalog_products_controller.decorator
50
51
  - app/helpers/.keep
51
52
  - app/mailers/.keep
52
53
  - app/models/.keep
53
54
  - app/models/workarea/catalog/product.decorator
55
+ - app/models/workarea/catalog/variant.decorator
54
56
  - app/services/workarea/hash_update.decorator
55
57
  - app/views/.keep
56
58
  - app/views/workarea/admin/catalog_products/_additional_details.html.haml
59
+ - app/views/workarea/admin/catalog_variants/_additional_details.html.haml
57
60
  - app/views/workarea/admin/create_catalog_products/details.html.haml
58
61
  - bin/rails
59
62
  - config/initializers/appends.rb