alchemy-solidus 8.3.0 → 8.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5910186eafdfbac9b8a44de731612238d859f901d0089341ac05ce33dceba207
4
- data.tar.gz: dc717567f6e7976a654dca88fe6c28064aa0483d51b4be509ad61d31ad60b59f
3
+ metadata.gz: 388e43431448c1a1a17fa17d35cd664791e29cb0ce0347d0305eade52beee9f2
4
+ data.tar.gz: 0a3898bfe1729d1493192d7afc18ce9a1fd49b08a3bc104b50d1a1495ef8d903
5
5
  SHA512:
6
- metadata.gz: 242f2b28c334a3063733109a9f0f4881578e10e56050b25a6d9acc324136aefba7c06b2798de6616f4858a74f5906824f1a66c8cce79ff5990468e284f437f67
7
- data.tar.gz: 7522e15e257a9763e6ab7c89053c7353816929e1674b50c641fe4e69fef373dae1db101fce7e3bff2bc01d540f41acf6a15f1a0e9f319ee6f7eec69abf27850d
6
+ metadata.gz: 38f6dda602d371891230ea523e3de04ab5175c61e35777f29383799f8271bdf3df771f77853f2c7b17d2a520d215609fa3c3138783a40e5e0cdfc8befdc8aff7
7
+ data.tar.gz: 0c9cfc91e7d5f2bb9c0d9f0819cdc042daea377876a465a759e962ae08148934250e5cab74609f98631b49e06301b0fc9f77dd11eec66b8e4eb110743f3b002e
@@ -46,7 +46,8 @@ module Alchemy
46
46
  def serialized_selection
47
47
  {
48
48
  id: product.send(value_attribute),
49
- name: product.name
49
+ name: product.name,
50
+ image: product.master&.gallery&.images&.[](0)&.url(:mini)
50
51
  }.to_json
51
52
  end
52
53
  end
@@ -40,7 +40,8 @@ module Alchemy
40
40
  id: variant.id,
41
41
  name: variant.name,
42
42
  sku: variant.sku,
43
- options_text: variant.options_text
43
+ options_text: variant.options_text,
44
+ image: variant.gallery.images[0]&.url(:mini)
44
45
  }.to_json
45
46
  end
46
47
  end
@@ -15,7 +15,7 @@ export default class ProductSelect extends RemoteSelect {
15
15
  }
16
16
 
17
17
  /**
18
- * Parses server response into select2 results object
18
+ * Parses server response into a results object
19
19
  * @param {object} response
20
20
  * @returns {object}
21
21
  * @private
@@ -26,6 +26,7 @@ export default class ProductSelect extends RemoteSelect {
26
26
  return {
27
27
  id: this._parsedValue(product),
28
28
  name: product.name,
29
+ image: product.master?.images[0]?.mini_url,
29
30
  }
30
31
  }),
31
32
  more: response.current_page * response.per_page < response.total_count,
@@ -48,24 +49,30 @@ export default class ProductSelect extends RemoteSelect {
48
49
  }
49
50
 
50
51
  /**
51
- * result which is visible if a product was selected
52
+ * slots of a dropdown option
52
53
  * @param {object} product
53
- * @returns {string}
54
- * @private
54
+ * @param {string} term
55
+ * @returns {object}
56
+ * @protected
55
57
  */
56
- _renderResult(product) {
57
- return product.name
58
+ _entry(product, term) {
59
+ return {
60
+ primary: this._hightlightTerm(product.name, term),
61
+ media: product.image
62
+ }
58
63
  }
59
64
 
60
65
  /**
61
- * html template for each list entry
66
+ * slots of the selected product shown in the control
62
67
  * @param {object} product
63
- * @param {string} term
64
- * @returns {string}
65
- * @private
68
+ * @returns {object}
69
+ * @protected
66
70
  */
67
- _renderListEntry(product, term) {
68
- return this._hightlightTerm(product.name, term)
71
+ _selectedEntry(product) {
72
+ return {
73
+ primary: product.name,
74
+ media: product.image
75
+ }
69
76
  }
70
77
  }
71
78
 
@@ -11,7 +11,7 @@ export default class TaxonSelect extends RemoteSelect {
11
11
  }
12
12
 
13
13
  /**
14
- * Parses server response into select2 results object
14
+ * Parses server response into a results object
15
15
  * @param {object} response
16
16
  * @returns {object}
17
17
  * @private
@@ -24,24 +24,28 @@ export default class TaxonSelect extends RemoteSelect {
24
24
  }
25
25
 
26
26
  /**
27
- * result which is visible if a taxon was selected
27
+ * slots of a dropdown option
28
28
  * @param {object} taxon
29
- * @returns {string}
30
- * @private
29
+ * @param {string} term
30
+ * @returns {object}
31
+ * @protected
31
32
  */
32
- _renderResult(taxon) {
33
- return taxon.text || taxon.pretty_name
33
+ _entry(taxon, term) {
34
+ return {
35
+ primary: this._hightlightTerm(taxon.pretty_name, term)
36
+ }
34
37
  }
35
38
 
36
39
  /**
37
- * html template for each list entry
40
+ * slots of the selected taxon shown in the control
38
41
  * @param {object} taxon
39
- * @param {string} term
40
- * @returns {string}
41
- * @private
42
+ * @returns {object}
43
+ * @protected
42
44
  */
43
- _renderListEntry(taxon, term) {
44
- return this._hightlightTerm(taxon.pretty_name, term)
45
+ _selectedEntry(taxon) {
46
+ return {
47
+ primary: taxon.text || taxon.pretty_name
48
+ }
45
49
  }
46
50
  }
47
51
 
@@ -11,7 +11,7 @@ export default class VariantSelect extends RemoteSelect {
11
11
  }
12
12
 
13
13
  /**
14
- * Search query send to server from select2
14
+ * Search query send to server
15
15
  * @param {string} term
16
16
  * @param {number} page
17
17
  * @returns {object}
@@ -28,51 +28,51 @@ export default class VariantSelect extends RemoteSelect {
28
28
  }
29
29
 
30
30
  /**
31
- * Parses server response into select2 results object
31
+ * Parses server response into a results object
32
32
  * @param {object} response
33
33
  * @returns {object}
34
34
  * @private
35
35
  */
36
36
  _parseResponse(response) {
37
37
  return {
38
- results: response.variants,
38
+ results: response.variants.map((variant) => {
39
+ return {
40
+ ...variant,
41
+ image: variant.images[0]?.mini_url
42
+ }
43
+ }),
39
44
  more: response.current_page * response.per_page < response.total_count,
40
45
  }
41
46
  }
42
47
 
43
48
  /**
44
- * result which is visible if a variant was selected
49
+ * slots of a dropdown option
45
50
  * @param {object} variant
46
- * @returns {string}
47
- * @private
51
+ * @param {string} term
52
+ * @returns {object}
53
+ * @protected
48
54
  */
49
- _renderResult(variant) {
50
- return variant.options_text
51
- ? `${variant.name} - ${variant.options_text}`
52
- : variant.name
55
+ _entry(variant, term) {
56
+ return {
57
+ primary: this._hightlightTerm(variant.name, term),
58
+ secondary: variant.options_text,
59
+ secondaryAside: variant.sku,
60
+ media: variant.image
61
+ }
53
62
  }
54
63
 
55
64
  /**
56
- * html template for each list entry
65
+ * slots of the selected variant shown in the control
57
66
  * @param {object} variant
58
- * @param {string} term
59
- * @returns {string}
60
- * @private
67
+ * @returns {object}
68
+ * @protected
61
69
  */
62
- _renderListEntry(variant, term) {
63
- const name = this._hightlightTerm(variant.name, term)
64
- const sku = this._hightlightTerm(variant.sku, term)
65
- return `
66
- <div class="variant-select-result">
67
- <div>
68
- <span>${name}</span>
69
- </div>
70
- <div>
71
- <span>${variant.options_text}</span>
72
- <span>${sku}</span>
73
- </div>
74
- </div>
75
- `
70
+ _selectedEntry(variant) {
71
+ return {
72
+ primary: variant.name,
73
+ secondary: variant.options_text,
74
+ media: variant.image
75
+ }
76
76
  }
77
77
  }
78
78
 
@@ -0,0 +1,10 @@
1
+ <!-- insert_after '[data-hook="admin_user_form_roles"]' -->
2
+
3
+ <%= f.field_container :alchemy_roles do %>
4
+ <%= label_tag nil, t(".alchemy_roles") %>
5
+ <%= admin_hint t(".alchemy_roles"), t(:alchemy_roles_html, scope: [:spree, :hints, "spree/user"]) %>
6
+ <%= f.collection_select :alchemy_roles, Alchemy.config.user_roles, :to_s, :capitalize,
7
+ {include_blank: false},
8
+ multiple: true, disabled: cannot?(:update_role, @user),
9
+ class: "select2 fullwidth" %>
10
+ <% end %>
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alchemy
4
+ module Solidus
5
+ module SpreeAdminUsersControllerPatch
6
+ private
7
+
8
+ def permitted_user_attributes
9
+ attributes = super
10
+ attributes << {alchemy_roles: []} if can?(:update_role, @user)
11
+ attributes
12
+ end
13
+
14
+ if defined?(::Spree::Admin::UsersController)
15
+ ::Spree::Admin::UsersController.prepend self
16
+ end
17
+ end
18
+ end
19
+ end
@@ -6,7 +6,7 @@ module Alchemy
6
6
  end
7
7
 
8
8
  def spree_roles
9
- if admin?
9
+ if alchemy_admin?
10
10
  ::Spree::Role.where(name: "admin")
11
11
  else
12
12
  ::Spree::Role.none
@@ -11,16 +11,9 @@ module Alchemy
11
11
  email
12
12
  end
13
13
 
14
- def alchemy_roles
15
- if has_spree_role?(:admin)
16
- %w[admin]
17
- else
18
- []
19
- end
20
- end
21
-
22
14
  if defined?(::Spree::User)
23
15
  ::Spree::User.prepend self
16
+ ::Spree::User.include Alchemy::UserMethods
24
17
  end
25
18
  end
26
19
  end
@@ -18,3 +18,16 @@ de:
18
18
  users: Benutzer
19
19
  pictures: Bilder
20
20
  attachments: Dateien
21
+ users:
22
+ form:
23
+ alchemy_roles: Alchemy Rollen
24
+ hints:
25
+ spree/user:
26
+ alchemy_roles_html: |
27
+ <p>Diese Rollen steuern den Zugriff zum Alchemy CMS.</p>
28
+ <ul>
29
+ <li><kbd>Mitglied</kbd> beschreibt regulär angemeldete Kunden und ermöglicht den Zugriff auf regulär gesicherte Seiten. Sie <strong>ermöglicht nicht</strong> auf den Admin Bereich zuzugreifen.</li>
30
+ <li><kbd>Autor</kbd> ermöglicht Seiteninhalte zu bearbeiten, aber keine Seiten zu erstellen.</li>
31
+ <li><kbd>Editor</kbd> ermöglicht vollen Zugriff auf Seiten und Sprachen.</li>
32
+ <li><kbd>Admin</kbd> ermöglicht <strong>vollen Zugriff auf alles</strong>.</li>
33
+ </ul>
@@ -0,0 +1,33 @@
1
+ en:
2
+ alchemy:
3
+ choose_product_to_link: Choose a product to link to
4
+ link_overlay_tab_label:
5
+ product: Product
6
+ solidus:
7
+ search_variant: Search a variant by name or sku
8
+ search_product: Search a product by name
9
+ search_taxon: Search a taxon by name
10
+ spree:
11
+ admin:
12
+ tab:
13
+ cms: CMS
14
+ pages: Pages
15
+ sites: Sites
16
+ languages: Languages
17
+ tags: Tags
18
+ users: Users
19
+ pictures: Pictures
20
+ attachments: Attachments
21
+ users:
22
+ form:
23
+ alchemy_roles: Alchemy Roles
24
+ hints:
25
+ spree/user:
26
+ alchemy_roles_html: |
27
+ <p>These roles allow access to Alchemy CMS.</p>
28
+ <ul>
29
+ <li><kbd>Member</kbd> describes regular logged in customers and allows to visit regularly restricted pages. It <strong>does not</strong> grant access to the CMS backend.</li>
30
+ <li><kbd>Author</kbd> grants access to edit content but not to create pages.</li>
31
+ <li><kbd>Editor</kbd> grants access to fully manage pages and languages.</li>
32
+ <li><kbd>Admin</kbd> grants access <strong>to manage everything</strong>.</li>
33
+ </ul>
@@ -0,0 +1,24 @@
1
+ it:
2
+ spree:
3
+ admin:
4
+ tab:
5
+ cms: CMS
6
+ pages: "Pagine"
7
+ sites: "Siti"
8
+ languages: "Lingue"
9
+ tags: "Tags"
10
+ pictures: "Immagini"
11
+ attachments: "File"
12
+ users:
13
+ form:
14
+ alchemy_roles: Alchemy Ruoli
15
+ hints:
16
+ spree/user:
17
+ alchemy_roles_html: |
18
+ <p>Questi ruoli consentono l'accesso ad Alchemy CMS.</p>
19
+ <ul>
20
+ <li><kbd>Membro</kbd> indica i normali clienti autenticati e consente di visitare le pagine ad accesso limitato. <strong>Non</strong> concede l'accesso al backend del CMS.</li>
21
+ <li><kbd>Autore</kbd> concede l'accesso alla modifica dei contenuti, ma non alla creazione di pagine.</li>
22
+ <li><kbd>Editore</kbd> concede l'accesso alla gestione completa di pagine e lingue.</li>
23
+ <li><kbd>Amministratore</kbd> concede l'accesso <strong>alla gestione di tutto</strong>.</li>
24
+ </ul>
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module Solidus
3
- VERSION = "8.3.0"
3
+ VERSION = "8.4.1"
4
4
  end
5
5
  end
@@ -0,0 +1,16 @@
1
+ class SetAlchemyRolesOn<%= @table_name.camelcase %>Table < ActiveRecord::Migration[7.2]
2
+ def up
3
+ Spree::User.find_each do |user|
4
+ alchemy_roles = if user.has_spree_role?(:admin)
5
+ "admin"
6
+ end
7
+ user.update_column(:alchemy_roles, alchemy_roles)
8
+ end
9
+ end
10
+
11
+ def down
12
+ Spree::User.find_each do |user|
13
+ user.update_column(:alchemy_roles, nil)
14
+ end
15
+ end
16
+ end
@@ -1,5 +1,7 @@
1
1
  require "rails/generators"
2
+ require "rails/generators/active_record/migration"
2
3
  require "generators/alchemy/install/install_generator"
4
+ require "generators/alchemy/user_columns_migration/user_columns_migration_generator"
3
5
  require "generators/spree/custom_user/custom_user_generator"
4
6
  require "solidus_support"
5
7
 
@@ -11,6 +13,8 @@ end
11
13
  module Alchemy
12
14
  module Solidus
13
15
  class InstallGenerator < Rails::Generators::Base
16
+ include ActiveRecord::Generators::Migration
17
+
14
18
  SPREE_MOUNT_REGEXP = /mount\sSpree::Core::Engine.*$/
15
19
  desc "Installs Alchemy Solidus into your App."
16
20
 
@@ -24,6 +28,11 @@ module Alchemy
24
28
  type: :boolean,
25
29
  desc:
26
30
  "Set true if you don't want to run the Alchemy Devise installer. NOTE: Automatically skipped if Alchemy::Devise is not available."
31
+ class_option :skip_alchemy_user_columns_generator,
32
+ default: false,
33
+ type: :boolean,
34
+ desc:
35
+ "Set true if you don't want to run the Alchemy user columns generator. NOTE: Automatically skipped if Spree::User is not available."
27
36
  class_option :skip_spree_custom_user_generator,
28
37
  default: false,
29
38
  type: :boolean,
@@ -64,6 +73,20 @@ module Alchemy
64
73
  end
65
74
  end
66
75
 
76
+ def run_alchemy_user_columns_generator
77
+ if defined?(::Spree::User) &&
78
+ !options[:skip_alchemy_user_columns_generator]
79
+ @table_name = ::Spree::User.table_name
80
+ arguments = [
81
+ "--table-name",
82
+ @table_name, options[:auto_accept] && "--force"
83
+ ].compact
84
+ Alchemy::Generators::UserColumnsMigrationGenerator.start(arguments)
85
+ migration_template "db/migrate/set_alchemy_roles.tt", "db/migrate/set_alchemy_roles_on_#{@table_name}_table.rb"
86
+ rake("db:migrate", abort_on_failure: true)
87
+ end
88
+ end
89
+
67
90
  def run_spree_custom_user_generator
68
91
  if alchemy_devise_present? &&
69
92
  !options[:skip_spree_custom_user_generator]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-solidus
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.3.0
4
+ version: 8.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -15,7 +15,7 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: 8.3.0
18
+ version: 8.4.0.a
19
19
  - - "<"
20
20
  - !ruby/object:Gem::Version
21
21
  version: '9'
@@ -25,7 +25,7 @@ dependencies:
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: 8.3.0
28
+ version: 8.4.0.a
29
29
  - - "<"
30
30
  - !ruby/object:Gem::Version
31
31
  version: '9'
@@ -284,8 +284,10 @@ files:
284
284
  - app/overrides/alchemy/admin/pages/link/product_link_panel.html.erb.deface
285
285
  - app/overrides/alchemy/admin/pages/link/product_link_sl_tab.html.erb.deface
286
286
  - app/overrides/alchemy/admin/pages/link/product_link_tab.html.erb.deface
287
+ - app/overrides/spree/admin/users/_form/alchemy_roles_field.html.erb.deface
287
288
  - app/patches/controllers/alchemy/solidus/alchemy_base_controller_patch.rb
288
289
  - app/patches/controllers/alchemy/solidus/application_controller_patch.rb
290
+ - app/patches/controllers/alchemy/solidus/spree_admin_users_controller_patch.rb
289
291
  - app/patches/controllers/alchemy/solidus/spree_user_confirmations_controller_patch.rb
290
292
  - app/patches/controllers/alchemy/solidus/spree_user_passwords_controller_patch.rb
291
293
  - app/patches/controllers/alchemy/solidus/spree_user_registrations_controller_patch.rb
@@ -301,13 +303,13 @@ files:
301
303
  - config/initializers/alchemy.rb
302
304
  - config/initializers/spree.rb
303
305
  - config/locales/alchemy_solidus.de.yml
304
- - config/locales/alchemy_solidus_en.yml
305
- - config/locales/alchemy_solidus_it.yml
306
- - config/locales/en.yml
306
+ - config/locales/alchemy_solidus.en.yml
307
+ - config/locales/alchemy_solidus.it.yml
307
308
  - lib/alchemy-solidus.rb
308
309
  - lib/alchemy/solidus/engine.rb
309
310
  - lib/alchemy/solidus/test_support/factories/ingredient_factories.rb
310
311
  - lib/alchemy/solidus/version.rb
312
+ - lib/generators/alchemy/solidus/install/files/db/migrate/set_alchemy_roles.tt
311
313
  - lib/generators/alchemy/solidus/install/files/db/seeds/alchemy/pages.yml
312
314
  - lib/generators/alchemy/solidus/install/install_generator.rb
313
315
  - lib/patches/backend/controllers/alchemy/solidus/spree_admin_base_controller_patch.rb
@@ -330,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
330
332
  - !ruby/object:Gem::Version
331
333
  version: '0'
332
334
  requirements: []
333
- rubygems_version: 4.0.10
335
+ rubygems_version: 4.0.20
334
336
  specification_version: 4
335
337
  summary: The World's Most Flexible E-Commerce Platform meets The World's Most Flexible
336
338
  Content Management System!
@@ -1,20 +0,0 @@
1
- en:
2
- alchemy:
3
- choose_product_to_link: Choose a product to link to
4
- link_overlay_tab_label:
5
- product: Product
6
- solidus:
7
- search_variant: Search a variant by name or sku
8
- search_product: Search a product by name
9
- search_taxon: Search a taxon by name
10
- spree:
11
- admin:
12
- tab:
13
- cms: CMS
14
- pages: Pages
15
- sites: Sites
16
- languages: Languages
17
- tags: Tags
18
- users: Users
19
- pictures: Pictures
20
- attachments: Attachments
@@ -1,11 +0,0 @@
1
- it:
2
- spree:
3
- admin:
4
- tab:
5
- cms: CMS
6
- pages: "Pagine"
7
- sites: "Siti"
8
- languages: "Lingue"
9
- tags: "Tags"
10
- pictures: "Immagini"
11
- attachments: "File"
@@ -1,5 +0,0 @@
1
- en:
2
- alchemy:
3
- essences:
4
- essence_spree_taxon_editor:
5
- none: None