spree_reviews_rating 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -9,7 +9,7 @@ Basic Installation
9
9
 
10
10
  1. Add the following to your Gemfile
11
11
  <pre>
12
- gem 'spree_reviews_rating', '~> 1.0.2'
12
+ gem 'spree_reviews_rating', '~> 1.0.3'
13
13
  </pre>
14
14
  2. Run `bundle install`
15
15
  3. To copy and apply migrations run:
@@ -1,5 +1,6 @@
1
1
  Spree::Product.class_eval do
2
2
  has_many :reviews
3
+ attr_accessible :avg_rating, :reviews_count
3
4
 
4
5
  def get_stars
5
6
  {:star => ((2.0 * self.avg_rating).round / 2.0), :rcount => reviews_count}
@@ -3,15 +3,14 @@ module Spree
3
3
  belongs_to :product
4
4
  belongs_to :user
5
5
 
6
- attr_accessible :name, :rating, :review, :approved
6
+ attr_accessible :rating, :review, :name, :product, :user, :product_id, :user_id, :approved
7
7
 
8
8
  validates_presence_of :name, :review
9
9
  validates_numericality_of :rating, :if => Proc.new {|r| !r.rating.blank?}
10
+
10
11
  default_scope order("created_at DESC")
11
12
  scope :not_approved, where("approved = ?", false)
12
-
13
13
  scope :approved, lambda {|*args| {:conditions => ["(? = ?) or (approved = ?)", Spree::Config[:include_unapproved_reviews], true, true ]}}
14
-
15
14
  scope :oldest_first, :order => "created_at asc"
16
15
  scope :preview, :limit => Spree::Config[:preview_size], :order => "created_at desc"
17
16
  end
@@ -1,7 +1,16 @@
1
1
  module SpreeReviewsRating
2
2
  module Generators
3
3
  class InstallGenerator < Rails::Generators::Base
4
-
4
+
5
+ def add_formtastic
6
+ res = ask "Would you like to run the formtastic install now? [Y/n]"
7
+ if res == "" || res.downcase == "y"
8
+ run 'rails generate formtastic:install'
9
+ else
10
+ puts "Skiping rails generate formtastic:install, don't forget to run it!"
11
+ end
12
+ end
13
+
5
14
  def add_javascripts
6
15
  append_file "app/assets/javascripts/store/all.js", "//= require store/spree_reviews_rating\n"
7
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_reviews_rating
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-09 00:00:00.000000000 Z
12
+ date: 2012-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core
@@ -27,22 +27,6 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: spree_auth
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
30
  - !ruby/object:Gem::Dependency
47
31
  name: formtastic
48
32
  requirement: !ruby/object:Gem::Requirement