Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Rails warning about auto-loading Spree::ReviewsConfiguration again #108

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ Style/ClassAndModuleChildren:
- 'app/models/spree/feedback_review.rb'
- 'app/models/spree/review.rb'
- 'app/models/spree/reviews_ability.rb'
- 'app/models/spree/reviews_configuration.rb'

# Offense count: 2
Style/ClassVars:
Expand Down
43 changes: 0 additions & 43 deletions app/models/spree/reviews_configuration.rb

This file was deleted.

12 changes: 7 additions & 5 deletions app/overrides/add_reviews_after_product_properties.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

Deface::Override.new(virtual_path: "spree/products/show",
name: "converted_product_properties_767643482",
insert_after: "[data-hook='product_properties']",
partial: "spree/shared/reviews",
disabled: false)
Deface::Override.new(
virtual_path: "spree/products/show",
name: "converted_product_properties_767643482",
insert_after: "[data-hook='product_properties']",
partial: "spree/shared/reviews",
disabled: false
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'solidus_reviews/reviews_configuration'

module Spree
module Reviews
Config = Spree::ReviewsConfiguration.new
Expand Down
1 change: 1 addition & 0 deletions lib/solidus_reviews/engine.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'spree/core'
require 'solidus_reviews/config'

module SolidusReviews
class Engine < Rails::Engine
Expand Down
45 changes: 45 additions & 0 deletions lib/solidus_reviews/reviews_configuration.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# frozen_string_literal: true

module Spree
class ReviewsConfiguration < Spree::Preferences::Configuration
def self.boolean_preferences
%w(display_unapproved_reviews include_unapproved_reviews feedback_rating show_email require_login track_locale allow_image_upload)
end

# include non-approved reviews in (public) listings
preference :include_unapproved_reviews, :boolean, default: false

# displays non-approved reviews in (public) listings
preference :display_unapproved_reviews, :boolean, default: false

# control how many reviews are shown in summaries etc.
preference :preview_size, :integer, default: 3

# show a reviewer's email address
preference :show_email, :boolean, default: false

# show if a reviewer actually purchased the product
preference :show_verified_purchaser, :boolean, default: false

# show helpfullness rating form elements
preference :feedback_rating, :boolean, default: false

# require login to post reviews
preference :require_login, :boolean, default: true

# whether to keep track of the reviewer's locale
preference :track_locale, :boolean, default: false

# render checkbox for a user to approve to show their identifier (name or email) on their review
preference :render_show_identifier_checkbox, :boolean, default: false

# Approves star only reviews automatically (Reviews without a Title/Review)
preference :approve_star_only, :boolean, default: false

# Approves star only reviews for verified purchasers only.
preference :approve_star_only_for_verified_purchaser, :boolean, default: false

# allow customer to update image with the review
preference :allow_image_upload, :boolean, default: true
end
end