spree_reviews_rating 0.70.7.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -7
- data/app/assets/javascripts/store/review/index.js +13 -12
- data/app/assets/javascripts/store/spree_reviews_rating.js +15 -4
- data/app/assets/stylesheets/admin/spree_reviews_rating.css +1 -1
- data/app/assets/stylesheets/store/spree_reviews_rating.css +43 -0
- data/app/controllers/spree/admin/review_settings_controller.rb +25 -0
- data/app/controllers/spree/admin/reviews_controller.rb +30 -0
- data/app/controllers/spree/products_controller_decorator.rb +3 -0
- data/app/controllers/spree/reviews_controller.rb +55 -0
- data/app/helpers/spree/reviews_helper.rb +14 -0
- data/app/models/spree/ability_decorator.rb +11 -0
- data/app/models/{app_configuration_decorator.rb → spree/app_configuration_decorator.rb} +6 -3
- data/app/models/spree/product_decorator.rb +17 -0
- data/app/models/spree/review.rb +18 -0
- data/app/models/spree/review_sweeper.rb +24 -0
- data/app/models/spree/user_decorator.rb +7 -0
- data/app/overrides/add_review_bottom_sidebar.rb +2 -2
- data/app/overrides/reviews_admin_configuration_menu.rb +11 -0
- data/app/overrides/{add_reviews_tab_to_admin.rb → reviews_admin_tab.rb} +1 -1
- data/app/overrides/reviews_global_rating_product.rb +4 -0
- data/app/overrides/reviews_product_properties.rb +4 -0
- data/app/views/spree/admin/review_settings/edit.html.erb +18 -0
- data/app/views/spree/admin/review_settings/show.html.erb +44 -0
- data/app/views/spree/admin/reviews/_form.html.erb +6 -0
- data/app/views/spree/admin/reviews/edit.html.erb +19 -0
- data/app/views/{admin → spree/admin}/reviews/index.html.erb +7 -11
- data/app/views/spree/admin/shared/_reviews_setting_configurations_menu.html.erb +4 -0
- data/app/views/spree/reviews/_fine_print.html.erb +8 -0
- data/app/views/spree/reviews/_form.html.erb +22 -0
- data/app/views/spree/reviews/_new.html.erb +4 -0
- data/app/views/{reviews → spree/reviews}/_stars.html.erb +4 -1
- data/app/views/{reviews → spree/reviews}/all_list.html.erb +0 -0
- data/app/views/spree/reviews/error.js.erb +2 -0
- data/app/views/spree/reviews/index.html.erb +1 -0
- data/app/views/{reviews → spree/reviews}/new.html.erb +2 -3
- data/app/views/spree/reviews/success.js.erb +2 -0
- data/app/views/spree/shared/_rating.html.erb +28 -0
- data/app/views/spree/shared/_review.html.erb +19 -0
- data/app/views/{shared → spree/shared}/_review_link.html.erb +0 -0
- data/app/views/spree/shared/_review_summary.html.erb +7 -0
- data/app/views/spree/shared/_reviews.html.erb +23 -0
- data/app/views/{shared → spree/shared}/_shortrating.html.erb +1 -1
- data/app/views/spree/shared/_single_rating.html.erb +20 -0
- data/config/locales/en.yml +72 -6
- data/config/locales/it.yml +78 -12
- data/config/routes.rb +2 -9
- data/db/migrate/20081020220724_create_reviews.rb +2 -6
- data/db/migrate/20110406083603_add_rating_to_products.rb +3 -8
- data/db/migrate/20120123141326_recalculate_ratings.rb +3 -3
- data/db/migrate/20120323165848_reviews_rating_namespace.rb +5 -0
- data/lib/generators/spree_reviews_rating/install/install_generator.rb +1 -11
- data/lib/spree_reviews_rating.rb +0 -1
- metadata +135 -114
- data/app/controllers/admin/feedback_reviews_controller.rb +0 -6
- data/app/controllers/admin/review_settings_controller.rb +0 -16
- data/app/controllers/admin/reviews_controller.rb +0 -20
- data/app/controllers/feedback_reviews_controller.rb +0 -20
- data/app/controllers/products_controller_decorator.rb +0 -3
- data/app/controllers/reviews_controller.rb +0 -52
- data/app/helpers/admin/feedback_reviews_helper.rb +0 -2
- data/app/helpers/feedback_reviews_helper.rb +0 -2
- data/app/helpers/reviews_helper.rb +0 -11
- data/app/models/ability_decorator.rb +0 -14
- data/app/models/feedback_review.rb +0 -12
- data/app/models/product_decorator.rb +0 -15
- data/app/models/review.rb +0 -21
- data/app/models/review_sweeper.rb +0 -21
- data/app/models/user_decorator.rb +0 -7
- data/app/overrides/add_reviews_after_product_properties.rb +0 -4
- data/app/overrides/add_reviews_to_admin_configuration_menu.rb +0 -4
- data/app/views/admin/feedback_reviews/index.html.erb +0 -21
- data/app/views/admin/review_settings/edit.html.erb +0 -30
- data/app/views/admin/review_settings/show.html.erb +0 -30
- data/app/views/admin/reviews/_form.html.erb +0 -10
- data/app/views/admin/reviews/edit.html.erb +0 -17
- data/app/views/feedback_reviews/_form.html.erb +0 -15
- data/app/views/feedback_reviews/_summary.html.erb +0 -6
- data/app/views/feedback_reviews/create.js.erb +0 -7
- data/app/views/reviews/_fine_print.html.erb +0 -9
- data/app/views/reviews/_form.html.erb +0 -23
- data/app/views/reviews/index.html.erb +0 -1
- data/app/views/reviews/submissionguidelines.html.erb +0 -6
- data/app/views/reviews/terms.html.erb +0 -6
- data/app/views/shared/_rating.html.erb +0 -25
- data/app/views/shared/_review.html.erb +0 -17
- data/app/views/shared/_review_summary.html.erb +0 -10
- data/app/views/shared/_reviews.html.erb +0 -13
- data/config/initializers/helpers.rb +0 -2
- data/config/initializers/load_preferences.rb +0 -5
- data/db/migrate/20101222083309_create_feedback_reviews.rb +0 -18
data/README.md
CHANGED
@@ -1,21 +1,22 @@
|
|
1
|
-
|
1
|
+
SpreeReviewsRating
|
2
2
|
=======
|
3
3
|
|
4
4
|
Straightforward review/rating facility
|
5
5
|
|
6
6
|
|
7
|
-
Installation
|
8
|
-
|
7
|
+
Basic Installation
|
8
|
+
------------------
|
9
|
+
|
9
10
|
1. Add the following to your Gemfile
|
10
11
|
<pre>
|
11
|
-
gem 'spree_reviews_rating', '~> 0.
|
12
|
+
gem 'spree_reviews_rating', '~> 1.0.0'
|
12
13
|
</pre>
|
13
14
|
2. Run `bundle install`
|
14
15
|
3. To copy and apply migrations run:
|
15
16
|
<pre>
|
16
17
|
rails g spree_reviews_rating:install
|
17
18
|
</pre>
|
18
|
-
|
19
|
+
|
19
20
|
|
20
21
|
Usage
|
21
22
|
-----
|
@@ -26,5 +27,4 @@ Usage
|
|
26
27
|
|
27
28
|
3. Administrator can edit and/or approve and/or delete reviews.
|
28
29
|
|
29
|
-
|
30
|
-
Copyright (c) 2012 [Damiano Giacomello], released under the New BSD License
|
30
|
+
Copyright (c) 2012 [Damiano Giacomello], released under the New BSD License
|
@@ -1,15 +1,16 @@
|
|
1
1
|
$(document).ready(function(){
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
3
|
+
$('.button-review').click(function (event) {
|
4
|
+
event.preventDefault();
|
5
|
+
$(this).hide();
|
6
|
+
$(".ratings").hide();
|
7
|
+
$.ajax({
|
8
|
+
type: 'GET',
|
9
|
+
url: this.href,
|
10
|
+
data: ({authenticity_token: jQuery('meta[name="csrf-token"]').attr('content')}),
|
11
|
+
beforeSend: function(r){ $('#new_review').html('<p style="padding: 20px">Loading <img src="/assets/ratyloader.gif"/></p>');},
|
12
|
+
success: function(r){ $('#new_review').html(r);}
|
13
|
+
});
|
14
|
+
});
|
15
|
+
|
15
16
|
});
|
@@ -1,3 +1,4 @@
|
|
1
|
+
//= require store/spree_core
|
1
2
|
/*
|
2
3
|
* jQuery Raty - A Star Rating Plugin - http://wbotelhos.com/raty
|
3
4
|
* ---------------------------------------------------------------------
|
@@ -435,9 +436,9 @@
|
|
435
436
|
single: false,
|
436
437
|
size: 16,
|
437
438
|
space: true,
|
438
|
-
starHalf: 'star-half
|
439
|
-
starOff: 'star-off
|
440
|
-
starOn: 'star-on
|
439
|
+
starHalf: 'star-half.png',
|
440
|
+
starOff: 'star-off.png',
|
441
|
+
starOn: 'star-on.png',
|
441
442
|
start: 0,
|
442
443
|
target: undefined,
|
443
444
|
targetFormat: '{score}',
|
@@ -447,4 +448,14 @@
|
|
447
448
|
width: undefined
|
448
449
|
};
|
449
450
|
|
450
|
-
})(jQuery);
|
451
|
+
})(jQuery);
|
452
|
+
|
453
|
+
$(function() {
|
454
|
+
$(".review_submit").live("click", function() {
|
455
|
+
$(this).parents("form:first").validate();
|
456
|
+
$(this).parents("form:first").submit();
|
457
|
+
$(this).parents("form:first").hide();
|
458
|
+
$("#new_review").removeClass().html('<p style="padding: 20px">Loading <img src="/assets/ratyloader.gif"/></p>')
|
459
|
+
return false;
|
460
|
+
});
|
461
|
+
});
|
@@ -1,3 +1,11 @@
|
|
1
|
+
/*
|
2
|
+
*= require store/spree_core
|
3
|
+
*/
|
4
|
+
|
5
|
+
#new-star img {
|
6
|
+
float: left;
|
7
|
+
}
|
8
|
+
|
1
9
|
#reviews {
|
2
10
|
padding: 10px;
|
3
11
|
}
|
@@ -68,6 +76,27 @@
|
|
68
76
|
padding: 1px;
|
69
77
|
}
|
70
78
|
|
79
|
+
.review .author {
|
80
|
+
float: left;
|
81
|
+
}
|
82
|
+
|
83
|
+
.right {
|
84
|
+
float: right !important;
|
85
|
+
}
|
86
|
+
|
87
|
+
.single_rating {
|
88
|
+
margin-right: 3px;
|
89
|
+
}
|
90
|
+
|
91
|
+
.single_rating.rate {
|
92
|
+
width: 180px;
|
93
|
+
}
|
94
|
+
|
95
|
+
.review .single_rating, .review .average {
|
96
|
+
float: left;
|
97
|
+
margin-left: 5px;
|
98
|
+
}
|
99
|
+
|
71
100
|
.lit {
|
72
101
|
background-color: #aaaaaa;
|
73
102
|
color: #0000bb;
|
@@ -92,4 +121,18 @@
|
|
92
121
|
background: silver;
|
93
122
|
border: none;
|
94
123
|
margin: 1em 0;
|
124
|
+
}
|
125
|
+
|
126
|
+
.s_bgmsg_red {
|
127
|
+
color: #84290A;
|
128
|
+
background-color: #FFE7DF !important;
|
129
|
+
width: 320px;
|
130
|
+
padding: 5px;
|
131
|
+
}
|
132
|
+
|
133
|
+
.s_bgmsg_green {
|
134
|
+
color: #468847;
|
135
|
+
background-color: #D6E9C6 !important;
|
136
|
+
width: 320px;
|
137
|
+
padding: 5px;
|
95
138
|
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Spree
|
2
|
+
module Admin
|
3
|
+
class ReviewSettingsController < ResourceController
|
4
|
+
|
5
|
+
def show
|
6
|
+
@preferences = ['preview_size']
|
7
|
+
end
|
8
|
+
|
9
|
+
def edit
|
10
|
+
@preferences = [:include_unapproved_reviews, :show_email,
|
11
|
+
:require_login, :form_show, :preview_size, :star_big]
|
12
|
+
end
|
13
|
+
|
14
|
+
def update
|
15
|
+
params.each do |name, value|
|
16
|
+
next unless Spree::Config.has_preference? name
|
17
|
+
Spree::Config[name] = value
|
18
|
+
end
|
19
|
+
|
20
|
+
redirect_to admin_review_settings_path
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Spree
|
2
|
+
module Admin
|
3
|
+
class ReviewsController < ResourceController
|
4
|
+
|
5
|
+
helper 'spree/reviews'
|
6
|
+
before_filter :load_data
|
7
|
+
|
8
|
+
def index
|
9
|
+
@unapproved_reviews = Spree::Review.not_approved.find(:all, :order => "created_at DESC")
|
10
|
+
@approved_reviews = Spree::Review.approved.find(:all, :order => "created_at DESC")
|
11
|
+
end
|
12
|
+
|
13
|
+
def approve
|
14
|
+
r = Spree::Review.find(params[:id])
|
15
|
+
|
16
|
+
if r.update_attribute(:approved, true)
|
17
|
+
r.product.recalculate_rating
|
18
|
+
flash[:notice] = t("info_approve_review")
|
19
|
+
else
|
20
|
+
flash[:error] = t("error_approve_review")
|
21
|
+
end
|
22
|
+
redirect_to spree.admin_reviews_path
|
23
|
+
end
|
24
|
+
|
25
|
+
def load_data
|
26
|
+
@reviews = Spree::Review.all
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Spree
|
2
|
+
class ReviewsController < BaseController
|
3
|
+
helper Spree::BaseHelper
|
4
|
+
|
5
|
+
before_filter :load_product, :only => [:index, :new, :create]
|
6
|
+
rescue_from ActiveRecord::RecordNotFound, :with => :render_404
|
7
|
+
|
8
|
+
def index
|
9
|
+
@approved_reviews = Spree::Review.approved.find_all_by_product_id(@product.id)
|
10
|
+
end
|
11
|
+
|
12
|
+
def all_list
|
13
|
+
@approved_reviews = Spree::Review.approved.order("created_at DESC")
|
14
|
+
respond_to do |f|
|
15
|
+
f.html
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def new
|
20
|
+
@review = Spree::Review.new(:product => @product)
|
21
|
+
authorize! :new, @review
|
22
|
+
render :layout => false
|
23
|
+
end
|
24
|
+
|
25
|
+
def create
|
26
|
+
#params[:review][:rating].sub!(/\s*stars/,'') unless params[:review][:rating].blank?
|
27
|
+
|
28
|
+
@review = Spree::Review.new(params[:review])
|
29
|
+
@review.product = @product
|
30
|
+
@review.user = current_user if user_signed_in?
|
31
|
+
@review.location = request.remote_ip
|
32
|
+
|
33
|
+
authorize! :create, @review
|
34
|
+
|
35
|
+
if @review.save
|
36
|
+
flash[:notice] = t('review_successfully_submitted')
|
37
|
+
respond_to do |format|
|
38
|
+
format.js { render "success" }
|
39
|
+
end
|
40
|
+
else
|
41
|
+
respond_to do |format|
|
42
|
+
format.js { render "error" }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def terms
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
def load_product
|
52
|
+
@product = Spree::Product.find_by_permalink!(params[:product_id])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Spree
|
2
|
+
module ReviewsHelper
|
3
|
+
def mk_stars(m)
|
4
|
+
(1..5).collect {|n| n <= m ? star("lit") : star("unlit") }.join
|
5
|
+
end
|
6
|
+
|
7
|
+
def txt_stars(n, show_out_of = true)
|
8
|
+
res = I18n.t('star', :count => n)
|
9
|
+
res += ' ' + t('out_of_5') if show_out_of
|
10
|
+
res
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Spree::AbilityDecorator
|
2
|
+
include CanCan::Ability
|
3
|
+
|
4
|
+
def initialize(user)
|
5
|
+
can :create, Spree::Review do |review|
|
6
|
+
user.has_role?(:user) || !Spree::Config[:require_login]
|
7
|
+
end
|
8
|
+
can :read, Spree::Review
|
9
|
+
end
|
10
|
+
Spree::Ability.register_ability(Spree::AbilityDecorator)
|
11
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
AppConfiguration.class_eval do
|
1
|
+
Spree::AppConfiguration.class_eval do
|
2
2
|
|
3
3
|
# include non-approved reviews in (public) listings
|
4
4
|
preference :include_unapproved_reviews, :boolean, :default => false
|
@@ -6,8 +6,11 @@ AppConfiguration.class_eval do
|
|
6
6
|
preference :preview_size, :integer, :default => 3
|
7
7
|
# show a reviewer's email address
|
8
8
|
preference :show_email, :boolean, :default => false
|
9
|
-
# show helpfullness rating form elements
|
10
|
-
preference :feedback_rating, :boolean, :default => false
|
11
9
|
# require login to post reviews
|
12
10
|
preference :require_login, :boolean, :default => true
|
11
|
+
# not view form immediatly
|
12
|
+
preference :form_show, :boolean, :default => true
|
13
|
+
# user star big or normal
|
14
|
+
preference :star_big, :boolean, :default => false
|
15
|
+
|
13
16
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Spree::Product.class_eval do
|
2
|
+
has_many :reviews
|
3
|
+
|
4
|
+
def get_stars
|
5
|
+
{:star => avg_rating.round, :rcount => reviews_count}
|
6
|
+
end
|
7
|
+
|
8
|
+
def recalculate_rating
|
9
|
+
reviews_count = reviews.reload.approved.count
|
10
|
+
if reviews_count > 0
|
11
|
+
self.update_attributes(:avg_rating => self.reviews.approved.sum(:rating).to_f / reviews_count, :reviews_count => reviews_count)
|
12
|
+
else
|
13
|
+
self.update_attribute :avg_rating, 0
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Spree
|
2
|
+
class Review < ActiveRecord::Base
|
3
|
+
belongs_to :product
|
4
|
+
belongs_to :user
|
5
|
+
|
6
|
+
validates_presence_of :name, :review
|
7
|
+
validates_numericality_of :rating, :if => Proc.new {|r| !r.rating.blank?}
|
8
|
+
default_scope order("created_at DESC")
|
9
|
+
scope :not_approved, where("approved = ?", false)
|
10
|
+
|
11
|
+
scope :approved, lambda {|*args| {:conditions => ["(? = ?) or (approved = ?)", Spree::Config[:include_unapproved_reviews], true, true ]}}
|
12
|
+
|
13
|
+
scope :oldest_first, :order => "created_at asc"
|
14
|
+
scope :preview, :limit => Spree::Config[:preview_size], :order => "created_at desc"
|
15
|
+
attr_protected :user_id, :product_id, :location
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Spree
|
2
|
+
class ReviewSweeper < ActionController::Caching::Sweeper
|
3
|
+
observe Spree::Review
|
4
|
+
|
5
|
+
def after_create(review)
|
6
|
+
expire_cache_for(review)
|
7
|
+
end
|
8
|
+
|
9
|
+
def after_update(review)
|
10
|
+
expire_cache_for(review)
|
11
|
+
end
|
12
|
+
|
13
|
+
def after_destroy(review)
|
14
|
+
expire_cache_for(review)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def expire_cache_for(review)
|
20
|
+
review.product.recalculate_rating
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Deface::Override.new(:virtual_path => "layouts/spree_application",
|
1
|
+
Deface::Override.new(:virtual_path => "spree/layouts/spree_application",
|
2
2
|
:name => "review_sidebar",
|
3
3
|
:insert_bottom => "div#sidebar",
|
4
|
-
:partial => "shared/review_link")
|
4
|
+
:partial => "spree/shared/review_link")
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Deface::Override.new(:virtual_path => "spree/admin/shared/_configuration_menu",
|
2
|
+
:name => "add_review_settings_link_configuration_menu",
|
3
|
+
:insert_bottom => "[data-hook='admin_configurations_sidebar_menu']",
|
4
|
+
:text => %q{<%= configurations_sidebar_menu_item t("reviews_rating.review_settings"), admin_review_settings_path %>},
|
5
|
+
:disabled => false)
|
6
|
+
|
7
|
+
Deface::Override.new(:virtual_path => "spree/admin/configurations/index",
|
8
|
+
:name => "add_review_settings_to_configuration_menu",
|
9
|
+
:insert_after => "[data-hook='admin_configurations_menu']",
|
10
|
+
:partial => "spree/admin/shared/reviews_setting_configurations_menu",
|
11
|
+
:disabled => false)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Deface::Override.new(:virtual_path => "admin/shared/_product_sub_menu",
|
1
|
+
Deface::Override.new(:virtual_path => "spree/admin/shared/_product_sub_menu",
|
2
2
|
:name => "reviews_admin_tab",
|
3
3
|
:insert_bottom => "[data-hook='admin_product_sub_tabs']",
|
4
4
|
:text => "<%= tab(:reviews, :label => 'review_management') %>")
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
|
2
|
+
|
3
|
+
<h1><%= t("reviews_rating.review_settings") %></h1>
|
4
|
+
|
5
|
+
<%= form_tag admin_review_settings_path, :method => :put do %>
|
6
|
+
<fieldset id="preferences" data-hook>
|
7
|
+
<% @preferences.each do |key|
|
8
|
+
type = Spree::Config.preference_type(key) %>
|
9
|
+
<%= label_tag(key, t("reviews_rating.#{key}") + ': ') + tag(:br) if type != :boolean %>
|
10
|
+
<%= preference_field_tag(key, Spree::Config[key], :type => type) %>
|
11
|
+
<%= label_tag(key, t("reviews_rating.#{key}")) + tag(:br) if type == :boolean %>
|
12
|
+
<% end %>
|
13
|
+
</fieldset>
|
14
|
+
<p class="form-buttons" data-hook="buttons">
|
15
|
+
<%= button t(:update) %>
|
16
|
+
<%= t(:or) %> <%= link_to t(:cancel), admin_review_settings_url %>
|
17
|
+
</p>
|
18
|
+
<% end %>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
|
2
|
+
|
3
|
+
<h1><%= t("reviews_rating.review_settings") %></h1>
|
4
|
+
|
5
|
+
<table data-hook="preferences">
|
6
|
+
<% @preferences.each do |key| %>
|
7
|
+
<tr>
|
8
|
+
<th scope="row"><%= t("reviews_rating.#{key}") %>:</th>
|
9
|
+
<td><%= Spree::Config[key] %></td>
|
10
|
+
</tr>
|
11
|
+
<% end %>
|
12
|
+
<tr>
|
13
|
+
<th scope="row"><%= t("reviews_rating.include_unapproved_reviews") %>:</th>
|
14
|
+
<td>
|
15
|
+
<%= (Spree::Config[:include_unapproved_reviews].blank?) ? t(:no) : t(:yes) %>
|
16
|
+
</td>
|
17
|
+
</tr>
|
18
|
+
<tr>
|
19
|
+
<th scope="row"><%= t("reviews_rating.show_email") %>:</th>
|
20
|
+
<td>
|
21
|
+
<%= (Spree::Config[:show_email].blank?) ? t(:no) : t(:yes) %>
|
22
|
+
</td>
|
23
|
+
</tr>
|
24
|
+
<tr>
|
25
|
+
<th scope="row"><%= t("reviews_rating.require_login") %>:</th>
|
26
|
+
<td>
|
27
|
+
<%= (Spree::Config[:require_login].blank?) ? t(:no) : t(:yes) %>
|
28
|
+
</td>
|
29
|
+
</tr>
|
30
|
+
<tr>
|
31
|
+
<th scope="row"><%= t("reviews_rating.form_show") %>:</th>
|
32
|
+
<td>
|
33
|
+
<%= (Spree::Config[:form_show].blank?) ? t(:no) : t(:yes) %>
|
34
|
+
</td>
|
35
|
+
</tr>
|
36
|
+
<tr>
|
37
|
+
<th scope="row"><%= t("reviews_rating.star_big") %>:</th>
|
38
|
+
<td>
|
39
|
+
<%= (Spree::Config[:star_big].blank?) ? t(:no) : t(:yes) %>
|
40
|
+
</td>
|
41
|
+
</tr>
|
42
|
+
</table>
|
43
|
+
|
44
|
+
<p><%= link_to_with_icon 'edit', t(:edit), edit_admin_review_settings_path, :id => 'admin_store_settings_link' %></p>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= f.inputs do %>
|
2
|
+
<%= f.input :name, :label => t("reviews_rating.name") %>
|
3
|
+
<%= f.input :user, :label => t("reviews_rating.user")%>
|
4
|
+
<%= f.input :product, :label => t("reviews_rating.product")%>
|
5
|
+
<%= f.input :review, :input_html => { :value => @review.review }, :label => t("reviews_rating.review_content") %>
|
6
|
+
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<h1><%= t("reviews_rating.editing_review_for") %> <%= @review.product.name %></h1>
|
2
|
+
<%= link_to t('back_reviews'), admin_reviews_path %><br />
|
3
|
+
|
4
|
+
<h2><%= t("reviews_rating.original_verision") %></h2>
|
5
|
+
<div style="padding: 15px 5px;">
|
6
|
+
<%= @review.user_id ? link_to(@review.user.try(:email), [:admin, @review.user]) : @review.name %><br />
|
7
|
+
<% if @review.product %>
|
8
|
+
<%= link_to @review.product.name, product_path(@review.product) %><br />
|
9
|
+
<% end %>
|
10
|
+
<%= h @review.review %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @review } %>
|
14
|
+
<h2><%= t("reviews_rating.edited_version") %></h2>
|
15
|
+
|
16
|
+
<%= semantic_form_for([:admin, @review]) do |f| %>
|
17
|
+
<%= render :partial => "form", :locals => { :f => f } %>
|
18
|
+
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
|
19
|
+
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% render 'admin/shared/product_sub_menu' %>
|
1
|
+
<% render 'spree/admin/shared/product_sub_menu' %>
|
2
2
|
<h1><%= t('review_management_description') %></h1>
|
3
3
|
|
4
4
|
<% for reviews in [["Unapproved", @unapproved_reviews], ["Approved", @approved_reviews]] %>
|
@@ -6,12 +6,11 @@
|
|
6
6
|
|
7
7
|
<table cellspacing=6 class="index">
|
8
8
|
<tr>
|
9
|
-
<th><%=
|
10
|
-
<th><%=
|
11
|
-
<th><%=
|
9
|
+
<th><%= t(:created_at) %></th>
|
10
|
+
<th><%= t(:user) %></th>
|
11
|
+
<th><%= t(:rating) %></th>
|
12
12
|
<th><%= t('product') %></th>
|
13
|
-
<th><%= t(
|
14
|
-
<th><%= Review.human_attribute_name(:review) %></th>
|
13
|
+
<th><%= t(:review) %></th>
|
15
14
|
<th></th>
|
16
15
|
</tr>
|
17
16
|
|
@@ -27,12 +26,9 @@
|
|
27
26
|
<%= txt_stars(review.rating) %>
|
28
27
|
</td>
|
29
28
|
<td>
|
30
|
-
|
29
|
+
<% if review.product %>
|
31
30
|
<%= link_to review.product.name, product_path(review.product) %>
|
32
|
-
|
33
|
-
</td>
|
34
|
-
<td>
|
35
|
-
<%= link_to t('feedback'), admin_review_feedback_reviews_path(review) %>(<%= review.feedback_stars %>/<%= review.feedback_reviews.count %>)
|
31
|
+
<% end %>
|
36
32
|
</td>
|
37
33
|
<td width="30%">
|
38
34
|
<%= h review.review %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<div class="review_fine_print">
|
2
|
+
<h2><%= t('the_fine_print') %></h2>
|
3
|
+
<ul>
|
4
|
+
<li><%= t('terms_text') %>: <%= link_to t(:terms_and_conditions), url_for(:action => 'terms') %></li>
|
5
|
+
<li><%= t('approved_text') %></li>
|
6
|
+
<li><%= t('guideline_text') %>: <%= link_to t(:review_guidelines), url_for(:action => 'submissionguidelines') %></li>
|
7
|
+
</ul>
|
8
|
+
</div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= form_for review, :url => product_reviews_path(product), :html => {:id => "reviews_form"}, :remote => true do |f| %>
|
2
|
+
<%= render :partial => "spree/shared/error_messages", :locals => {:target => review} %>
|
3
|
+
|
4
|
+
<div class="review_name_field">
|
5
|
+
<%= f.label :name, t("reviews_rating.name") %> <span class="required">*</span><br />
|
6
|
+
<%= f.text_field :name %>
|
7
|
+
</div>
|
8
|
+
<div class="review_review_field">
|
9
|
+
<%= f.label :review, t("reviews_rating.review") %> <span class="required">*</span><br />
|
10
|
+
<%= f.text_area :review, :wrap => "virtual", :rows => "8", :cols => "50" %>
|
11
|
+
<p class="s_legend">
|
12
|
+
<span style="color: #FF0000;"><%= t("reviews_rating.note_reviews") %></span> <%= t("reviews_rating.note_review_description") %></p>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="review_rating_field">
|
16
|
+
<%= f.label :rating, t("reviews_rating.rating") %> <span class="required">*</span><br />
|
17
|
+
<%= render :partial => "spree/reviews/stars" %>
|
18
|
+
<%= f.hidden_field :rating %>
|
19
|
+
</div>
|
20
|
+
<%= link_to content_tag(:span, t("reviews_rating.continue"), :class => "s_text"), "javascript: void(0)", :class => "s_button_1 s_main_color_bgr review_submit" %>
|
21
|
+
<%#= button_tag t('submit_your_review'), :class => "button-submit" %>
|
22
|
+
<% end %>
|
@@ -6,6 +6,9 @@ jQuery(document).ready(function() {
|
|
6
6
|
cancel: true,
|
7
7
|
half: true,
|
8
8
|
width: 180,
|
9
|
+
starHalf: 'star-half<%= "-big" if (Spree::Config[:star_big] == true) %>.png',
|
10
|
+
starOff: 'star-off<%= "-big" if (Spree::Config[:star_big] == true) %>.png',
|
11
|
+
starOn: 'star-on<%= "-big" if (Spree::Config[:star_big] == true) %>.png',
|
9
12
|
path: '/assets/',
|
10
13
|
click: function(score, evt) {
|
11
14
|
$("#review_rating").val(score);
|
@@ -13,4 +16,4 @@ jQuery(document).ready(function() {
|
|
13
16
|
});
|
14
17
|
});
|
15
18
|
//-->
|
16
|
-
</script>
|
19
|
+
</script>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => 'spree/shared/reviews' %>
|
@@ -1,5 +1,4 @@
|
|
1
|
-
<
|
1
|
+
<h2><span><%= t("reviews_rating.write") %></span> <%= t("reviews_rating.a_review") %></h2>
|
2
2
|
|
3
3
|
<%= render 'form', { :review => @review, :product => @product } %>
|
4
|
-
<%= link_to(t('cancel_your_review'), "#", :class => "cancel-review", :rel => "nofollow,noindex") %>
|
5
|
-
<%# render :partial => "reviews/fine_print" %>
|
4
|
+
<%= link_to(t('cancel_your_review'), "#", :class => "cancel-review", :rel => "nofollow,noindex") %>
|