solidus_reviews 1.6.0 → 1.7.0

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: f786e0b7b86049c102cea681a540eae39543d8afa2b428092de2470c7e8caf28
4
- data.tar.gz: 7d06e09fbc10a29eae662fa260874a6c202bcde097a99fb22b7bf13bec68b193
3
+ metadata.gz: a4e942dd7285deb7b0cf758d8fbe4a953ce2b963633663548973d92d3de96011
4
+ data.tar.gz: 13c4dcf8795994edf582f417d48b584d1cebc8c393656c43d0688a75301aa500
5
5
  SHA512:
6
- metadata.gz: 50e9f5c509e0ed7a6ca2c7ef783a4cd33bc06649873266690a1e2fe70ca4d582ca530203aa6f83d94dc202b38fe6a7f56628909c9712d40f68e39d4a56197b3e
7
- data.tar.gz: 77e05282a759c6e0d8029f686263a24379408416718b5f88fd9ea2ad66274ef64f8c86fa973679410ec9095b43d7fa80fa17e183a8b4c414a2ce8ac76d7f19f0
6
+ metadata.gz: 32089cd4cb4ab16ef7da9cb8f6f865a01d0e98676f274736a2ec6978227390434b10bbe03ce64e5ee6df3ce9a69c15a306f57fab5164bd65be04ede4e67d090d
7
+ data.tar.gz: b6020cf9ef67a93fee51d2c9622a1b62d1423414396781159048f47965ec0e4b289069fb7576fea5d4aaae9eb02cfdc73abfce6231f6fedd4599734ba1f1cb2e
@@ -27,6 +27,23 @@ class Spree::Review < ApplicationRecord
27
27
  scope :not_approved, -> { where(approved: false) }
28
28
  scope :default_approval_filter, -> { Spree::Reviews::Config[:include_unapproved_reviews] ? all : approved }
29
29
 
30
+ def self.ransackable_attributes(*)
31
+ [
32
+ "approved",
33
+ "name",
34
+ "review",
35
+ "title"
36
+ ]
37
+ end
38
+
39
+ def self.ransackable_associations(*)
40
+ [
41
+ "feedback_reviews",
42
+ "product",
43
+ "user"
44
+ ]
45
+ end
46
+
30
47
  def feedback_stars
31
48
  return 0 if feedback_reviews.size <= 0
32
49
 
@@ -0,0 +1,3 @@
1
+ <!-- insert_after "[data-hook='product_properties']" -->
2
+
3
+ <%= render "spree/shared/reviews" %>
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.config.to_prepare do
4
+ Spree::Backend::Config.configure do |config|
5
+ config.menu_items = config.menu_items.map do |item|
6
+ if item.label.to_sym == :settings
7
+ # The API of the MenuItem class changes in Solidus 4.2.0
8
+ if item.respond_to?(:children)
9
+ item.children << Spree::BackendConfiguration::MenuItem.new(
10
+ label: :reviews,
11
+ condition: -> { can?(:admin, Spree::ReviewsConfiguration) },
12
+ url: -> { Spree::Core::Engine.routes.url_helpers.edit_admin_review_settings_path },
13
+ match_path: /review_settings/
14
+ )
15
+ else
16
+ item.sections << :reviews
17
+ end
18
+ elsif item.label.to_sym == :products
19
+ if item.respond_to?(:children)
20
+ item.children << Spree::BackendConfiguration::MenuItem.new(
21
+ label: :reviews,
22
+ condition: -> { can?(:admin, Spree::Review) },
23
+ url: -> { Spree::Core::Engine.routes.url_helpers.admin_reviews_path },
24
+ match_path: /reviews/
25
+ )
26
+ else
27
+ item.sections << :reviews
28
+ end
29
+ end
30
+ item
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusReviews
4
- VERSION = '1.6.0'
4
+ VERSION = '1.7.0'
5
5
  end
@@ -123,6 +123,18 @@ describe Spree::Review do
123
123
  end
124
124
  end
125
125
 
126
+ describe '.ransackable_attributes' do
127
+ subject { described_class.ransackable_attributes }
128
+
129
+ it { is_expected.to contain_exactly("approved", "name", "review", "title") }
130
+ end
131
+
132
+ describe '.ransackable_associations' do
133
+ subject { described_class.ransackable_associations }
134
+
135
+ it { is_expected.to contain_exactly("feedback_reviews", "product", "user") }
136
+ end
137
+
126
138
  describe '#recalculate_product_rating' do
127
139
  let(:product) { create(:product) }
128
140
  let!(:review) { create(:review, product: product) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_reviews
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Contrib
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-20 00:00:00.000000000 Z
11
+ date: 2024-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -115,9 +115,7 @@ files:
115
115
  - app/models/spree/review.rb
116
116
  - app/models/spree/reviews_ability.rb
117
117
  - app/models/spree/reviews_configuration.rb
118
- - app/overrides/add_reviews_after_product_properties.rb
119
- - app/overrides/add_reviews_tab_to_admin.rb
120
- - app/overrides/add_reviews_to_admin_configuration_sidebar.rb
118
+ - app/overrides/spree/products/show/add_reviews_after_product_properties.html.erb.deface
121
119
  - app/views/spree/admin/feedback_reviews/index.html.erb
122
120
  - app/views/spree/admin/review_settings/edit.html.erb
123
121
  - app/views/spree/admin/reviews/_form.html.erb
@@ -147,6 +145,7 @@ files:
147
145
  - bin/rake
148
146
  - bin/sandbox
149
147
  - bin/setup
148
+ - config/initializers/add_spree_reviews_to_menu.rb
150
149
  - config/initializers/constants.rb
151
150
  - config/initializers/load_preferences.rb
152
151
  - config/locales/de-CH.yml
@@ -233,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
232
  - !ruby/object:Gem::Version
234
233
  version: '0'
235
234
  requirements: []
236
- rubygems_version: 3.4.6
235
+ rubygems_version: 3.5.3
237
236
  signing_key:
238
237
  specification_version: 4
239
238
  summary: Review and rating functionality for your Solidus store.
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Deface::Override.new(virtual_path: "spree/products/show",
4
- name: "converted_product_properties_767643482",
5
- insert_after: "[data-hook='product_properties']",
6
- partial: "spree/shared/reviews",
7
- disabled: false)
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Spree::Backend::Config.configure do |config|
4
- config.menu_items.detect { |menu_item|
5
- menu_item.label == :products
6
- }.sections << :reviews
7
- end
8
-
9
- Deface::Override.new(
10
- virtual_path: "spree/admin/shared/_product_sub_menu",
11
- name: "reviews_admin_tab",
12
- insert_bottom: "[data-hook='admin_product_sub_tabs']",
13
- disabled: false
14
- ) do
15
- <<-HTML
16
- <% if can? :admin, Spree::Review %>
17
- <%= tab(:reviews, label: 'review_management') %>
18
- <% end %>
19
- HTML
20
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Spree::Backend::Config.configure do |config|
4
- config.menu_items.detect { |menu_item|
5
- menu_item.label == :settings
6
- }.sections << :review_settings
7
- end
8
-
9
- Deface::Override.new(
10
- virtual_path: "spree/admin/shared/_settings_sub_menu",
11
- name: "converted_admin_configurations_menu",
12
- insert_bottom: "[data-hook='admin_settings_sub_tabs']",
13
- disabled: false
14
- ) do
15
- <<-HTML
16
- <% if can? :admin, Spree::ReviewsConfiguration %>
17
- <%= tab :reviews, url: spree.edit_admin_review_settings_path, match_path: /review_settings/ %>
18
- <% end %>
19
- HTML
20
- end