MatthewKennedy / spree_product_reviews

Product Reviews For Spree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

spree_product_reviews

CI Standard Rb

  • CSS Customizable stars
  • Optional one review per user (Helps stops spam reviews)
  • Reviews page with pagination.
  • Users must be logged in to leave a review (Helps stops spam reviews)

Installation

  1. Add this extension to your Gemfile with this line:

    gem 'spree_product_reviews', github: 'matthewkennedy/spree_product_reviews'
  2. Install the gem using Bundler

    bundle install
  3. Copy & run migrations

    bundle exec rails g spree_product_reviews:install
  4. Restart your server

If your server was running, restart it so that it can find the assets properly.

Usage

Reviews will be up and running out of the box, but you will most likely want to place elements such as the stars and reviews where you prefer. To do this disable the default placement of review elements in your product page by setting the preference below in your spree.rb initializer file.

SpreeProductReviews::Config.disable_default_review_placment = true

Use the following partials where you like:

Adds star rating with context and options to view and review:

<%= render 'spree/shared/price_stars', stars: @product.stars %>

Shows only the stars:

<%= render 'spree/reviews/stars', stars: @product.stars %>

This partial is used to show recent reviews:

<%= render 'spree/shared/reviews', stars: @product.stars %>

Customize The Stars

You can customize the stars by creating a custom CSS file and setting the variables seen in spree_product_reviews_vars.scss

Testing

First bundle your dependencies, then run rake. rake will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app.

bundle
bundle exec rake

When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:

require 'spree_product_reviews/factories'

Contributing

If you'd like to contribute, please take a look at the instructions for installing dependencies and crafting a good pull request.

Copyright (c) 2021 Matthew Kennedy, released under the New BSD License

About

Product Reviews For Spree

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Ruby 72.9%Language:HTML 22.9%Language:SCSS 4.2%