spree_reviews_rating 0.70.6.1 → 0.70.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,7 +8,7 @@ Installation
8
8
  ------------
9
9
  1. Add the following to your Gemfile
10
10
  <pre>
11
- gem 'spree_reviews_rating', '~> 0.70.3'
11
+ gem 'spree_reviews_rating', '~> 0.70.7'
12
12
  </pre>
13
13
  2. Run `bundle install`
14
14
  3. To copy and apply migrations run:
@@ -1,3 +1,17 @@
1
1
  /*
2
2
  *= require admin/spree_core
3
+ *= require formtastic
3
4
  */
5
+
6
+ .formtastic input, .formtastic textarea, .formtastic select {
7
+ font-size: 100%;
8
+ padding: 5px;
9
+ }
10
+
11
+ .formtastic button {
12
+ margin: 0;
13
+ padding: 0 20px 0 0;
14
+ }
15
+ .formtastic button:hover {
16
+ text-shadow: #FFFFFF -1px -1px 0px;
17
+ }
@@ -1,10 +1,12 @@
1
1
  class FeedbackReview < ActiveRecord::Base
2
2
  belongs_to :review
3
3
  belongs_to :user
4
-
4
+
5
+ attr_accessible :rating, :comment, :review, :user, :review_id, :user_id
6
+
5
7
  validates_presence_of :review_id
6
8
  validates_numericality_of :rating, :only_integer => true, :greater_than_or_equal_to => 1, :less_than_or_equal_to => 5, :message => I18n.t('you_must_enter_value_for_rating')
7
-
9
+
8
10
  default_scope order("created_at DESC")
9
11
 
10
12
  end
@@ -1,5 +1,7 @@
1
1
  Product.class_eval do
2
2
  has_many :reviews
3
+
4
+ attr_accessible :avg_rating, :reviews_count
3
5
 
4
6
  def get_stars
5
7
  {:star => ((2.0 * self.avg_rating).round / 2.0), :rcount => reviews_count}
data/app/models/review.rb CHANGED
@@ -2,17 +2,17 @@ class Review < ActiveRecord::Base
2
2
  belongs_to :product
3
3
  belongs_to :user
4
4
  has_many :feedback_reviews
5
-
5
+
6
+ attr_accessible :rating, :review, :name, :product, :user, :product_id, :user_id
7
+
6
8
  validates_presence_of :name, :review
7
9
  validates_numericality_of :rating, :if => Proc.new {|r| !r.rating.blank?}
10
+
8
11
  default_scope order("created_at DESC")
9
12
  scope :not_approved, where("approved = ?", false)
10
-
11
13
  scope :approved, lambda {|*args| {:conditions => ["(? = ?) or (approved = ?)", Spree::Config[:include_unapproved_reviews], true, true ]}}
12
-
13
14
  scope :oldest_first, :order => "created_at asc"
14
15
  scope :preview, :limit => Spree::Config[:preview_size], :order => "created_at desc"
15
- attr_protected :user_id, :product_id, :location
16
16
 
17
17
  def feedback_stars
18
18
  return 0 if feedback_reviews.count <= 0
@@ -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
  #append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_reviews_rating\n"
@@ -9,7 +18,7 @@ module SpreeReviewsRating
9
18
 
10
19
  def add_stylesheets
11
20
  inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree_reviews_rating\n", :before => /\*\//, :verbose => true
12
- #inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/spree_reviews_rating\n", :before => /\*\//, :verbose => true
21
+ inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/spree_reviews_rating\n", :before => /\*\//, :verbose => true
13
22
  end
14
23
 
15
24
  def add_migrations
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: 0.70.6.1
4
+ version: 0.70.7
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-06-19 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