spree_admin 5.0.2 → 5.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fb2e27934e0ce22324b5a7c032fbeb7d0abf76d3512f726dd0acddc30a217dc
4
- data.tar.gz: 3caabc53934c4c0bdbd2b70bfea5dcaa9685eb3acb9a2d2bcebcc362c4807e73
3
+ metadata.gz: 2314972e804657e3746e099913f84a2ffe364d955005ecd2ad0f441f6d38f44c
4
+ data.tar.gz: b5b4bc046008b7f3077c12dccb7571f5fc965f2196d3a1d077f044d911da0dd2
5
5
  SHA512:
6
- metadata.gz: ffb8d7703b134adf2439b7f035557930448883896f6e4a07daea768de52847d13dc0ed7ca8cb37fc1e38e0df637b7fcbfb54cc3d7e13fdf03adc23493714e33a
7
- data.tar.gz: 88f4985f3985761932f2e341ed62085658c925a18244718bb14ffc729b3074cc9d726fa8419c70af12a3da77e9a624f39d3bba5841b4d759a03a1cb8abaad994
6
+ metadata.gz: 0f823382a162659d30e565ff7dfc2299f4c8b5ce4e73e11c7b3a146dc0560ebadd289653d09b6c40eb33e30300f4d2032b91389b2a2eebad43657c236d2065df
7
+ data.tar.gz: 7e104c97735e15737d3b9d209a632ac7cdd8c53b0229e8482225e57e023d44d74228833fef8cb7f2fd54c1f56e696b634fff5d7d289bc6a3bdb5d2e14aa56c23
@@ -26,15 +26,23 @@ module Spree
26
26
  end
27
27
 
28
28
  def create
29
- allowed_types = Rails.application.config.spree.page_blocks.map(&:to_s)
30
29
  page_block_type = params.dig(:page_block, :type)
31
30
 
32
- if allowed_types.include?(page_block_type) && page_block_type.safe_constantize.present?
31
+ if allowed_types.map(&:to_s).include?(page_block_type) && page_block_type.safe_constantize.present?
33
32
  @page_block = page_block_type.constantize.new
34
33
  @page_block.section = @page_section
35
34
  @page_block.save!
36
35
  end
37
36
  end
37
+
38
+ private
39
+
40
+ def allowed_types
41
+ [
42
+ *Rails.application.config.spree.page_blocks,
43
+ *parent&.available_blocks_to_add
44
+ ].uniq.sort_by(&:name)
45
+ end
38
46
  end
39
47
  end
40
48
  end
@@ -7,7 +7,7 @@ module Spree
7
7
 
8
8
  def create
9
9
  page_section_type = params.dig(:page_section, :type)
10
- allowed_types = Rails.application.config.spree.page_sections.map(&:to_s)
10
+ allowed_types = available_page_section_types.map(&:to_s)
11
11
 
12
12
  if allowed_types.include?(page_section_type) && page_section_type.safe_constantize.present?
13
13
  @page_section = page_section_type.constantize.new(permitted_resource_params)
@@ -52,6 +52,18 @@ module Spree
52
52
  current_store.theme_previews.find(params[:theme_id])
53
53
  end
54
54
  end
55
+
56
+ def available_page_section_types
57
+ return [] unless @pageable.present?
58
+
59
+ if @pageable.is_a?(Spree::Theme)
60
+ @pageable.available_page_sections
61
+ elsif @pageable.respond_to?(:theme)
62
+ @pageable.theme.available_page_sections
63
+ else
64
+ []
65
+ end
66
+ end
55
67
  end
56
68
  end
57
69
  end
@@ -122,6 +122,10 @@ module Spree
122
122
  def product_list_filters_search_form_path
123
123
  [:admin, @search]
124
124
  end
125
+
126
+ def sorted_product_properties(product)
127
+ product.product_properties.sort_by { |product_property| product_property.property.position }
128
+ end
125
129
  end
126
130
  end
127
131
  end
@@ -13,7 +13,7 @@ module Spree
13
13
  @post_tags_scope ||= ActsAsTaggableOn::Tag.
14
14
  joins(:taggings).
15
15
  where("#{ActsAsTaggableOn.taggings_table}.taggable_type = ?", 'Spree::Post').
16
- for_context(:tags)
16
+ for_context(:tags).for_tenant(current_store.id)
17
17
  end
18
18
 
19
19
  def post_tags_json_array
@@ -67,6 +67,8 @@ export default class extends CheckboxSelectAll {
67
67
  .filter((internalName) => !existingVariantsOnServer.includes(internalName))
68
68
  )
69
69
  }
70
+
71
+ this.inventoryFormTarget = document.querySelector('.inventory-form');
70
72
  }
71
73
 
72
74
  toggleQuantityTracked() {
@@ -236,11 +238,14 @@ export default class extends CheckboxSelectAll {
236
238
  }
237
239
 
238
240
  optionsValueChanged(value, previousValue) {
241
+ let hasNoOptions = true
242
+
239
243
  if (this.hasNewOptionButtonTarget) {
240
244
  const label = this.newOptionButtonLabelTarget
241
245
 
242
246
  if (Object.values(value).filter(Boolean).length) {
243
247
  label.textContent = label.dataset.hasOptionsText
248
+ hasNoOptions = false
244
249
  } else {
245
250
  label.textContent = label.dataset.noOptionsText
246
251
  }
@@ -248,6 +253,8 @@ export default class extends CheckboxSelectAll {
248
253
  this.refreshOptionNameSelect()
249
254
  this.variantsValue = this.generateVariants(value)
250
255
 
256
+ this.toggleInventoryForm(hasNoOptions)
257
+
251
258
  // We want to clear the ignoredVariants when the options change
252
259
  if (previousValue && Object.keys(previousValue).length === 0) return
253
260
  this.ignoredVariants = new Set()
@@ -765,6 +772,8 @@ export default class extends CheckboxSelectAll {
765
772
  this.addOption(newOptionName, newOptionValues, newOptionId)
766
773
 
767
774
  this.hideNewOptionForm()
775
+
776
+ this.toggleInventoryForm(false)
768
777
  }
769
778
 
770
779
  hideNewOptionForm() {
@@ -1052,4 +1061,14 @@ export default class extends CheckboxSelectAll {
1052
1061
  }
1053
1062
  }
1054
1063
  }
1064
+
1065
+ toggleInventoryForm(value) {
1066
+ if (!this.inventoryFormTarget) return
1067
+
1068
+ if (value) {
1069
+ this.inventoryFormTarget.classList.remove('d-none')
1070
+ } else {
1071
+ this.inventoryFormTarget.classList.add('d-none')
1072
+ }
1073
+ }
1055
1074
  }
@@ -1,4 +1,4 @@
1
- <div class="card mb-4">
1
+ <div class="inventory-form card mb-4">
2
2
  <div class="card-header d-flex align-items-center justify-content-between">
3
3
  <h5 class="card-title"><%= Spree.t(:inventory) %></h5>
4
4
 
@@ -15,7 +15,7 @@
15
15
  </tr>
16
16
  </thead>
17
17
  <tbody>
18
- <%= f.fields_for :product_properties do |product_property_form| %>
18
+ <%= f.fields_for :product_properties, sorted_product_properties(f.object) do |product_property_form| %>
19
19
  <% property = product_property_form.object.property %>
20
20
  <%= product_property_form.hidden_field :id %>
21
21
  <%= product_property_form.hidden_field :property_id %>
@@ -1,4 +1,4 @@
1
- <%= link_to spree.admin_user_path(user), class: 'rounded hover-light p-2 d-flex justify-content-start align-items-center', data: {turbo_frame: :_top} do %>
1
+ <%= link_to spree.admin_user_path(user), class: 'rounded hover-light p-2 d-flex justify-content-start align-items-center', data: {turbo_frame: :_top, row_link_target: :link} do %>
2
2
  <% if user.name.present? %>
3
3
  <%= render_avatar(user, width: 48, height: 48, class: 'mr-3 avatar') %>
4
4
  <% else %>
@@ -44,7 +44,7 @@
44
44
  </div>
45
45
  </div>
46
46
  <div class="card-body border-top pt-4 d-none" data-reveal-target="item">
47
- <h6><%= Spree.t(:conditions) %></h6>
47
+ <h6><%= Spree.t(:rules) %></h6>
48
48
  <%= render 'spree/admin/taxons/rules_form', f: f %>
49
49
  </div>
50
50
  </div>
@@ -52,7 +52,7 @@
52
52
  <% if @taxon.automatic? %>
53
53
  <div class="card mb-4">
54
54
  <div class="card-header">
55
- <h5 class="card-title"><%= Spree.t(:conditions) %></h5>
55
+ <h5 class="card-title"><%= Spree.t(:rules) %></h5>
56
56
  </div>
57
57
  <div class="card-body">
58
58
  <div class="alert alert-info mb-3"><%= Spree.t('admin.taxon_types.automatic_info') %></div>
@@ -1,17 +1,18 @@
1
- <tr id="<%= spree_dom_id user %>">
1
+ <tr id="<%= spree_dom_id user %>" data-controller="row-link">
2
2
  <td class="pr-0 w-5">
3
3
  <%= bulk_operations_checkbox(user) %>
4
4
  </td>
5
- <td class='user_name w-50 no-wrap py-0 pl-1 pr-0'>
5
+ <td class='w-50 no-wrap py-0 pl-1 pr-0'>
6
6
  <%= render 'spree/admin/shared/user', user: user %>
7
7
  </td>
8
- <td class="no-wrap">
8
+ <td class="cursor-pointer" data-action="click->row-link#openLink">
9
9
  <%= active_badge(user.accepts_email_marketing?) %>
10
10
  </td>
11
- <td class="w-25 no-wrap">
11
+ <td class="w-25 cursor-pointer" data-action="click->row-link#openLink">
12
12
  <%= customer_location_flag(user) %>
13
13
  <%= customer_location(user) %>
14
14
  </td>
15
- <td class='user_num_orders w-10 no-wrap'><%= user.completed_orders_for_store(current_store).count %></td>
16
- <td class='user_amount_spent w-10 no-wrap'><%= user.display_amount_spent_in(current_currency) %></td>
15
+ <td class='w-10 no-wrap cursor-pointer' data-action="click->row-link#openLink"><%= user.completed_orders_for_store(current_store).count %></td>
16
+ <td class='w-10 no-wrap cursor-pointer' data-action="click->row-link#openLink"><%= user.display_amount_spent_in(current_currency) %></td>
17
+ <td class='w-10 no-wrap cursor-pointer' data-action="click->row-link#openLink"><%= local_time(user.created_at) %></td>
17
18
  </tr>
@@ -3,8 +3,8 @@
3
3
  <% end %>
4
4
 
5
5
  <% content_for :page_actions do %>
6
- <%= link_to spree.admin_users_path(q: params[:q].to_unsafe_hash, page: params[:page], per_page: params[:per_page], format: :csv), class: 'btn btn-light bg-transparent with-tip mr-2 d-none d-lg-inline-flex', title: 'Export Customers to a CSV file. To filter specific Customers use "Filters" or Customers/Subscribers tabs before clicking this button' do %>
7
- <%= icon 'table-export', class: 'mr-2' %>
6
+ <%= link_to spree.admin_users_path(q: params[:q].to_unsafe_hash, page: params[:page], per_page: params[:per_page], format: :csv), class: 'btn btn-light bg-transparent with-tip d-none d-lg-inline-flex', title: 'Export Customers to a CSV file. To filter specific Customers use "Filters" or Customers/Subscribers tabs before clicking this button' do %>
7
+ <%= icon 'table-export' %>
8
8
  <%= Spree.t(:export) %>
9
9
  <% end if can?(:export, Spree::Export) %>
10
10
 
@@ -53,6 +53,7 @@
53
53
  <th><%= Spree.t(:location) %></th>
54
54
  <th><%= Spree.t('admin.num_orders') %></th>
55
55
  <th><%= Spree.t('admin.amount_spent') %></th>
56
+ <th><%= sort_link @search, :created_at, Spree.t(:created_at) %></th>
56
57
  </tr>
57
58
  </thead>
58
59
  <tbody>
@@ -224,7 +224,7 @@ en:
224
224
  taxon_type: Taxon type
225
225
  taxon_types:
226
226
  automatic: Automatic
227
- automatic_info: Automatically match products to this taxon based on the conditions you set.
227
+ automatic_info: Automatically add products to this taxon if they match the rules you set.
228
228
  manual: Manual
229
229
  manual_info: Curate products manually. You can add or remove them in bulk.
230
230
  upload_new_asset: Upload new asset
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.2
4
+ version: 5.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vendo Connect Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-22 00:00:00.000000000 Z
11
+ date: 2025-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.0.2
19
+ version: 5.0.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 5.0.2
26
+ version: 5.0.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree_api
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 5.0.2
33
+ version: 5.0.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 5.0.2
40
+ version: 5.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: active_link_to
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -1059,9 +1059,9 @@ licenses:
1059
1059
  - AGPL-3.0-or-later
1060
1060
  metadata:
1061
1061
  bug_tracker_uri: https://github.com/spree/spree/issues
1062
- changelog_uri: https://github.com/spree/spree/releases/tag/v5.0.2
1062
+ changelog_uri: https://github.com/spree/spree/releases/tag/v5.0.3
1063
1063
  documentation_uri: https://docs.spreecommerce.org/
1064
- source_code_uri: https://github.com/spree/spree/tree/v5.0.2
1064
+ source_code_uri: https://github.com/spree/spree/tree/v5.0.3
1065
1065
  post_install_message:
1066
1066
  rdoc_options: []
1067
1067
  require_paths: