spree_reviews 0.30.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,7 @@
1
1
  class Admin::ReviewsController < Admin::BaseController
2
-
3
- layout 'admin'
4
-
5
2
  resource_controller
6
3
 
7
- index.before do
4
+ def index
8
5
  @unapproved_reviews = Review.not_approved.find(:all, :order => "created_at DESC")
9
6
  @approved_reviews = Review.approved.find(:all, :order => "created_at DESC")
10
7
  end
@@ -20,13 +17,8 @@ class Admin::ReviewsController < Admin::BaseController
20
17
  def approve
21
18
  r = Review.find(params[:id])
22
19
 
23
- r.approved = true
24
- if r.product.rating.nil?
25
- r.product.rating = Rating.create :value => 0, :count => 0
26
- end
27
- r.product.rating.add_rating(r.rating)
28
-
29
- if r.save
20
+ if r.update_attribute(:approved, true)
21
+ r.product.recalculate_rating
30
22
  flash[:notice] = t("info_approve_review")
31
23
  else
32
24
  flash[:error] = t("error_approve_review")
@@ -1,14 +1,17 @@
1
1
  # Add access to reviews/ratings to the product model
2
2
  Product.class_eval do
3
- has_one :rating
4
3
  has_many :reviews
5
4
 
6
5
  def get_stars
7
- if rating.nil?
8
- [0,0]
6
+ [avg_rating.round, reviews_count]
7
+ end
8
+
9
+ def recalculate_rating
10
+ reviews_count = reviews.approved.count
11
+ if reviews_count > 0
12
+ self.update_attribute :avg_rating, self.reviews.approved.sum(:rating).to_f / reviews_count
9
13
  else
10
- [rating.get_stars, rating.count]
14
+ self.update_attribute :avg_rating, 0
11
15
  end
12
16
  end
13
-
14
17
  end
data/app/models/review.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Review < ActiveRecord::Base
2
- belongs_to :product
2
+ belongs_to :product, :counter_cache => true
3
3
  has_many :feedback_reviews
4
4
 
5
5
  validates_presence_of :title, :review
@@ -0,0 +1,20 @@
1
+ class ReviewSweeper < ActionController::Caching::Sweeper
2
+ observe Review
3
+ def after_create(review)
4
+ expire_cache_for(review)
5
+ end
6
+
7
+ def after_update(review)
8
+ expire_cache_for(review)
9
+ end
10
+
11
+ def after_destroy(review)
12
+ expire_cache_for(review)
13
+ end
14
+
15
+ private
16
+
17
+ def expire_cache_for(review)
18
+ review.product.recalculate_rating
19
+ end
20
+ end
@@ -5,11 +5,11 @@
5
5
  <table>
6
6
  <tr>
7
7
  <th scope="row"><%= t("reviews.include_unapproved") %>:</th>
8
- <td><%= Spree::Reviews::Config[:include_unapproved_reviews] %></td>
8
+ <td><%= Spree::Reviews::Config[:include_unapproved_reviews] ? t('yes') : t('no') %></td>
9
9
  </tr>
10
10
  <tr>
11
11
  <th scope="row"><%= t("reviews.preview_size") %>:</th>
12
- <td><%= Spree::Reviews::Config[:preview_size] %></td>
12
+ <td><%= Spree::Reviews::Config[:preview_size] %></td>
13
13
  </tr>
14
14
  </table>
15
15
 
@@ -1,13 +1,13 @@
1
- <h1>Editing review for <%= link_to @review.product.name, product_path(@review.product) %></h1>
1
+ <h1><%= t(:editing_review_for) %> <%= link_to @review.product.name, product_path(@review.product) %></h1>
2
2
 
3
- <h2>Original version</h2>
3
+ <h2><%= t(:original_version) %></h2>
4
4
 
5
5
  <p>
6
6
  <%= @review.review %>
7
7
  </p>
8
8
  <br/>
9
9
 
10
- <h2>Edited version</h2>
10
+ <h2><%= t(:edited_version) %></h2>
11
11
 
12
12
  <% form_for([:admin, @review]) do |f| %>
13
13
  <%= render :partial => f,
@@ -6,7 +6,7 @@
6
6
  <% end %>
7
7
 
8
8
  <%= t(:was_this_review_helpful) %>
9
- <% for i in 1..Rating.get_nb_stars %>
9
+ <% for i in 1..NB_STARS %>
10
10
  <%= radio_button_tag "feedback_review[rating]", pluralize(i, 'stars'), false, :class => "star" %>
11
11
  <% end %>
12
12
  <%= hidden_field_tag "feedback_review[user_id]", current_user.try(:id) %>
@@ -1,7 +1,9 @@
1
- <br/>
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>
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
5
  <li><%= t('approved_text') %></li>
6
- <li><%= t('guideline_text') %>: <%= link_to t("review guidelines"), url_for(:action => 'submissionguidelines') %></li>
7
- </ul>
6
+ <li><%= t('guideline_text') %>
7
+ : <%= link_to t(:review_guidelines), url_for(:action => 'submissionguidelines') %></li>
8
+ </ul>
9
+ </div>
@@ -0,0 +1,23 @@
1
+ <%= form_for review, :url => product_reviews_path(product), :html => {:method => :post} do |f| %>
2
+ <%= render "shared/error_messages", :target => review %>
3
+ <%= f.hidden_field :product_id, :value => product.id %>
4
+
5
+ <p class="review_rating_field">
6
+ <%= f.label :rating, t("rating") %> <span class="required">*</span><br />
7
+ <%= render :partial => "reviews/stars", :locals => {:stars => review.rating, :edit_enabled => true} %>
8
+ </p>
9
+
10
+ <p class="review_title_field">
11
+ <%= f.label :title, t("review_title") %> <span class="required">*</span><br />
12
+ <%= f.text_field :title, :maxlength => "255", :size => "50" %>
13
+ </p>
14
+
15
+ <p class="review_review_field">
16
+ <%= f.label :review, t("review_content") %> <span class="required">*</span><br />
17
+ <%= f.text_area :review, :wrap => "virtual", :rows => "10", :cols => "50" %>
18
+ </p>
19
+
20
+ <p class="review_submit">
21
+ <%= f.submit I18n.t('submit_your_review'), :class => "button bg_darkfirst" %>
22
+ </p>
23
+ <% end %>
@@ -1,8 +1,3 @@
1
- <% content_for :head do %>
2
- <%= javascript_include_tag("jquery.rating.js") %>
3
- <%= javascript_tag("$(document).ready(function(){$('.stars').rating({required:true});});") %>
4
- <% end %>
5
-
6
1
  <% if defined? edit_enabled
7
2
  state = ""
8
3
  name = "review[rating]"
@@ -10,12 +5,9 @@
10
5
  state = 'disabled="disabled"'
11
6
  name = defined?(review).nil? ? Time.now.tv_usec.to_s : "review_#{review}"
12
7
  end %>
13
- <% for i in 1..Rating.get_nb_stars %>
8
+ <% for i in 1..NB_STARS %>
14
9
  <input name="<%= name %>"
15
10
  type="radio" class="star"
16
11
  value="<%= pluralize(i, 'stars') %>" <%= state %>
17
12
  <%= "checked=\"checked\"" if i==stars %> />
18
13
  <% end %>
19
-
20
-
21
-
@@ -5,43 +5,6 @@
5
5
 
6
6
  <h2> <%= I18n.t('leave_us_a_review_for') + ' "' + @product.name + '"' %> </h2>
7
7
 
8
- <%= form_for @review, :url => {:action => 'create'} do |f| %>
9
- <%= render "shared/error_messages", :target => @review %>
10
- <%= f.hidden_field :product_id, :value => @product.id %>
11
-
12
- <table cellspacing="0" cellpadding="2">
13
- <tbody>
14
- <tr valign="top">
15
- <td style="padding-top: 5px; padding-bottom: 5px;" class="fieldtitle right nowrap">
16
- <strong><%= I18n.t('rating') %></strong>
17
- </td>
18
- <td style="padding-top: 5px; padding-bottom: 5px;">
19
- <%= render :partial => "reviews/stars", :locals => {:stars => @review.rating, :edit_enabled => true} %>
20
- </td>
21
- </tr>
22
- <tr valign="top">
23
- <td class="fieldtitle right nowrap">
24
- <%= f.label :title, raw("<strong>#{ I18n.t('review_title')}</strong>") %>
25
- </td>
26
- <td>
27
- <%= f.text_field :title, :maxlength => "255", :size => "50" %>
28
- </td>
29
- </tr>
30
- <tr valign="top">
31
- <td class="fieldtitle right nowrap">
32
- <%= f.label :review, raw("<strong>#{ I18n.t('review_content')}</strong>") %>
33
- </td>
34
- <td>
35
- <%= f.text_area :review, :wrap => "virtual", :rows => "10", :cols => "50" %>
36
- </td>
37
- </tr>
38
- <tr>
39
- <td> </td>
40
- <td style="padding-top: 5px;">
41
- <%= f.submit I18n.t('submit_your_review'), :class => "button bg_darkfirst".html_safe %>
42
- </td>
43
- </tr>
44
- </tbody></table>
45
- <% end %>
8
+ <%= render 'form', { :review => @review, :product => @product } %>
46
9
 
47
10
  <%= render :partial => "fine_print" %>
@@ -2,13 +2,13 @@
2
2
  <span title="<%= txt_stars(review.rating) %>">
3
3
  <%= render :partial => "reviews/stars", :locals => {:stars => review.rating} %>
4
4
  </span>
5
- &nbsp; <span class="title"><%= review.title %> </span>
5
+ <span class="title">&nbsp; <%= review.title %> </span>
6
6
  <br/>
7
7
  <span class="attribution"><%= t('submitted_on') %> <strong><%= l review.created_at.to_date %></strong></span>
8
8
  <p>
9
9
  <%= review.review %>
10
10
  </p>
11
- <div id="feedback_review_<%= review.id %>">
11
+ <div class="feedback_review" id="feedback_review_<%= review.id %>">
12
12
  <%= render :partial => "feedback_reviews/form", :locals => {:review => review} %>
13
13
  </div>
14
14
  </div>
@@ -1,6 +1,3 @@
1
- <% content_for :head do %>
2
- <%= stylesheet_link_tag 'reviews.css' %>
3
- <% end %>
4
1
  <% stars = product.get_stars %>
5
2
  <span style="float:left;" title="<%= txt_stars(stars[0]) %>">
6
3
  <%= render :partial => "reviews/stars", :locals => {:stars => stars[0]} %>
@@ -0,0 +1 @@
1
+ NB_STARS = 5
@@ -1,17 +1,34 @@
1
1
  en:
2
- write_your_own_review: Write your own review
3
- review_management: Review Management
4
- review_management_description: Manage the user-submitted reviews
5
- back_reviews: Back to the reviews
2
+ approve: Approve
3
+ Approved_reviews: Approved
4
+ approved_text: Unlocked comments will be published within 1-2 business days.
6
5
  are_you_sure_review: Are you sure to delete review ?
7
- info_approve_review: Review approved
6
+ average_customer_rating: Average rating
7
+ back_reviews: Back to the reviews
8
+ based_upon: based upon
9
+ by: by
10
+ date_: Date
11
+ edited_version: 'Edited version'
12
+ editing_review_for: 'Editing review for'
8
13
  error_approve_review: Error approving review
9
- approve: Approve
14
+ feedback: Feedback
15
+ feedback_review_for: "Review: '%{review}'"
16
+ for: for
17
+ from: from
18
+ guideline_text: We reserve the right not to post opinions unrelated to your product
19
+ info_approve_review: Review approved
10
20
  leave_us_a_review_for: Please leave us a review and a rating for our
11
- review_successfully_submitted: Review was successfully submitted
21
+ original_version: 'Original version'
22
+ out_of_5: "out of 5"
12
23
  rating: rating
13
- submit_your_review: Submit your review
24
+ review:
25
+ one: one review
26
+ other: %{count} reviews
14
27
  review_content: Content
28
+ review_guidelines: Review Guidelines
29
+ review_management: Review Management
30
+ review_management_description: Manage the user-submitted reviews
31
+ review_successfully_submitted: Review was successfully submitted
15
32
  review_title: Title
16
33
  reviews:
17
34
  review_settings: Review Settings
@@ -20,34 +37,19 @@ en:
20
37
  include_unapproved: Include unapproved reviews in listings
21
38
  your_name: Your name
22
39
  your_location: Your location
23
- average_customer_rating: Average rating
24
- the_fine_print: The fine print
25
- terms_text: All opinions must comply with our terms and conditions
26
- approved_text: Unlocked comments will be published within 1-2 business days.
27
- guideline_text: We reserve the right not to post opinions unrelated to your product
28
- "terms and conditions": Terms & Conditions
29
- "review guidelines": Review Guidelines
30
- date_: Date
31
- for: for
32
- Unapproved_reviews: Unapproved
33
- Approved_reviews: Approved
34
- from: from
35
- by: by
36
- submitted_on: Submitted on
37
- based_upon: based upon
38
- review:
39
- one: one review
40
- other: %{count} reviews
41
40
  star:
42
41
  one: "1"
43
42
  other: "%{count}"
43
+ stars: Stars
44
+ submit_your_review: Submit your review
45
+ submitted_on: Submitted on
46
+ terms_text: All opinions must comply with our terms and conditions
47
+ terms_and_conditions: Terms & Conditions
48
+ the_fine_print: The fine print
49
+ Unapproved_reviews: Unapproved
44
50
  voice:
45
51
  one: "1 voice"
46
52
  other: "%{count} voices"
47
-
48
- feedback: Feedback
49
- stars: Stars
50
- feedback_review_for: "Review: '%{review}'"
51
- out_of_5: "out of 5"
53
+ write_your_own_review: Write your own review
52
54
  was_this_review_helpful: "Was this review helpful to you?"
53
- you_must_enter_value_for_rating: "You must enter a value for rating."
55
+ you_must_enter_value_for_rating: "You must enter a value for rating."
@@ -1,4 +1,10 @@
1
1
  ru:
2
+ activerecord:
3
+ attributes:
4
+ review:
5
+ title: Заголовок
6
+ review: Содержание
7
+ rating: Рейтинг
2
8
  write_your_own_review: Оставьте свой отзыв
3
9
  review_management: Управление отзывами
4
10
  review_management_description: Управляйте отзывами покупателей
@@ -15,33 +21,48 @@ ru:
15
21
  review_title: Заголовок
16
22
  reviews:
17
23
  review_settings: Настройки отзывов покупателей
18
- manage_review_settings: Control the display of reviews
19
- preview_size: Size of the review snippets
20
- include_unapproved: Включать неодобренные пока отзывы в список
24
+ manage_review_settings: Управление отображением отзывов
25
+ preview_size: Количество отзывов на странице товара
26
+ include_unapproved: Показывать неодобренные отзывы на странице товара
21
27
  your_name: Ваше имя
22
28
  your_location: Город
23
- average_customer_rating: Average rating
24
- the_fine_print: The fine print
25
- terms_text: All opinions must comply with our terms and conditions
26
- approved_text: Unlocked comments will be published within 1-2 business days.
27
- guideline_text: We reserve the right not to post opinions unrelated to your product
28
- "terms and conditions": Terms & Conditions
29
- "review guidelines": Review Guidelines
30
- date_: Date
31
- for: for
32
- Unapproved_reviews: Unapproved
33
- Approved_reviews: Approved
29
+ average_customer_rating: Средняя оценка
30
+ the_fine_print: Мелкий текст
31
+ terms_text: Все отзывы должны быть написаны в соответствии с условиями и соглашениями
32
+ approved_text: Разблокированные комментарии будут опубликованы в течение 1-2 рабочих дней.
33
+ guideline_text: Мы оставляем за собой право не публиковать отзывы не имеющие отношения к продукту
34
+ terms_and_conditions: Условия и соглашения
35
+ review_guidelines: Советы по составлению отзывов
36
+ review_header: Отзывы
37
+ date_: Дата
38
+ for: для
39
+ Unapproved_reviews: Неутверждённые отзывы
40
+ Approved_reviews: Утверждённые отзывы
34
41
  from: from
35
42
  by: by
36
- submitted_on: Submitted on
43
+ submitted_on: Добавлено
37
44
  based_upon: "на основе"
38
45
  review:
39
- zero: "0 озывов"
40
- one: "1 отзыв"
46
+ zero: "0 отзывов"
47
+ one: "%{count} отзыв"
41
48
  few: "%{count} отзыва"
42
49
  other: "%{count} отзывов"
50
+ voice:
51
+ zero: "0 голосов"
52
+ one: "%{count} голос"
53
+ few: "%{count} голоса"
54
+ other: "%{count} голосов"
55
+ star:
56
+ one: "1"
57
+ other: "%{count}"
43
58
 
44
- feedback: Feedback
45
- stars: Stars
46
- feedback_review_for: "Review: '%{review}'"
59
+ feedback: Обратная связь
60
+ stars: Звёзды
61
+ feedback_review_for: "Отзывы: '%{review}'"
62
+ out_of_5: "из 5"
63
+ was_this_review_helpful: "Был ли Вам полезен этот отзыв?"
64
+ you_must_enter_value_for_rating: "Вы должны оценить отзыв."
47
65
 
66
+ original_version: 'Исходная версия'
67
+ edited_version: 'Отредактированная версия'
68
+ editing_review_for: 'Редактируем отзыв для'
@@ -0,0 +1,17 @@
1
+ class AddRatingToProducts < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :products, :avg_rating, :decimal, :default => 0.0, :null => false, :precision => 7, :scale => 5
4
+ add_column :products, :reviews_count, :integer, :default => 0, :null => false
5
+
6
+ Product.reset_column_information
7
+ Product.all.each do |p|
8
+ Product.update_counters p.id, :reviews_count => p.reviews.length
9
+ p.recalculate_rating
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ remove_column :products, :reviews_count
15
+ remove_column :products, :avg_rating
16
+ end
17
+ end
data/lib/spree_reviews.rb CHANGED
@@ -10,6 +10,7 @@ module SpreeReviews
10
10
  Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
11
11
  Rails.env.production? ? require(c) : load(c)
12
12
  end
13
+ ProductsHelper.send(:include, ReviewsHelper)
13
14
  end
14
15
 
15
16
  config.to_prepare &method(:activate).to_proc
@@ -1,7 +1,14 @@
1
1
  class SpreeReviewsHooks < Spree::ThemeSupport::HookListener
2
2
  insert_after :product_properties, 'shared/reviews'
3
3
  insert_after :inside_head do
4
- %(<%= stylesheet_link_tag('reviews.css') %>)
4
+ %( <%= stylesheet_link_tag('reviews.css') %> )
5
+ end
6
+
7
+ insert_after :footer_right do
8
+ %(
9
+ <%= javascript_include_tag("jquery.rating.js") %>
10
+ <%= javascript_tag("$(document).ready(function(){$('.stars').rating({required:true});});") %>
11
+ )
5
12
  end
6
13
 
7
14
  insert_after :admin_product_sub_tabs do
@@ -1,20 +1,23 @@
1
1
  #reviews div.header {
2
- font-size: 12pt;
3
- font-weight: bold;
4
- border-bottom: 1px #2222aa dashed;
5
- margin-top: 10px;
6
- margin-bottom: 10px;
2
+ font-size: 12pt;
3
+ font-weight: bold;
4
+ border-bottom: 1px #2222aa dashed;
5
+ margin-top: 10px;
6
+ margin-bottom: 10px;
7
7
  }
8
+
8
9
  #reviews div.review {
9
- border-bottom: 1px #2222aa dashed;
10
- margin-bottom: 10px;
10
+ border-bottom: 1px #2222aa dashed;
11
+ margin-bottom: 10px;
11
12
  }
13
+
12
14
  #reviews div.review span.title {
13
- font-size: 11pt;
14
- font-weight: bold;
15
+ font-size: 11pt;
16
+ font-weight: bold;
15
17
  }
18
+
16
19
  #reviews div.review span.attribution {
17
- font-size: 8pt;
20
+ font-size: 8pt;
18
21
  }
19
22
 
20
23
  .lit {
@@ -23,6 +26,7 @@
23
26
  margin-right: 1px;
24
27
  padding-left: 1px;
25
28
  }
29
+
26
30
  .unlit {
27
31
  background-color: #aaaaaa;
28
32
  color: #000000;
@@ -30,15 +34,63 @@
30
34
  padding-left: 1px;
31
35
  }
32
36
 
37
+ .star-rating-control {
38
+ display: inline-block;
39
+ height: 15px;
40
+ }
41
+
42
+ .review_hr {
43
+ size: 1px;
44
+ background: silver;
45
+ border: none;
46
+ margin: 1em 0;
47
+ }
48
+
33
49
  /* jQuery.Rating Plugin CSS - http://www.fyneworks.com/jquery/star-rating/ */
34
- div.rating-cancel,div.star-rating{float:left;width:17px;height:15px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden}
35
- div.rating-cancel,div.rating-cancel a{background: transparent url('/images/delete.gif') no-repeat scroll 0 -16px;}
36
- div.star-rating,div.star-rating a{background:url('/images/star.gif') no-repeat 0 0px}
37
- div.rating-cancel a,div.star-rating a{display:block;width:16px;height:100%;background-position:0 0px;border:0}
38
- div.star-rating-on a{background-position:0 -16px!important}
39
- div.star-rating-hover a{background-position:0 -32px}
50
+ div.rating-cancel, div.star-rating {
51
+ float: left;
52
+ width: 17px;
53
+ height: 15px;
54
+ text-indent: -999em;
55
+ cursor: pointer;
56
+ display: block;
57
+ background: transparent;
58
+ overflow: hidden
59
+ }
60
+
61
+ div.rating-cancel, div.rating-cancel a {
62
+ background: transparent url('/images/delete.gif') no-repeat scroll 0 -16px;
63
+ }
64
+
65
+ div.star-rating, div.star-rating a {
66
+ background: url('/images/star.gif') no-repeat 0 0px
67
+ }
68
+
69
+ div.rating-cancel a, div.star-rating a {
70
+ display: block;
71
+ width: 16px;
72
+ height: 100%;
73
+ background-position: 0 0px;
74
+ border: 0
75
+ }
76
+
77
+ div.star-rating-on a {
78
+ background-position: 0 -16px !important
79
+ }
80
+
81
+ div.star-rating-hover a {
82
+ background-position: 0 -32px
83
+ }
84
+
40
85
  /* Read Only CSS */
41
- div.star-rating-readonly a{cursor:default !important}
86
+ div.star-rating-readonly a {
87
+ cursor: default !important
88
+ }
89
+
42
90
  /* Partial Star CSS */
43
- div.star-rating{background:transparent!important;overflow:hidden!important}
91
+ div.star-rating {
92
+ background: transparent !important;
93
+ overflow: hidden !important
94
+ }
95
+
44
96
  /* END jQuery.Rating Plugin CSS */
@@ -1,14 +1,14 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.platform = Gem::Platform::RUBY
3
3
  s.name = 'spree_reviews'
4
- s.version = '0.30.0'
4
+ s.version = '0.50.0'
5
5
  s.summary = 'Basic review and ratings facility for Spree'
6
6
  #s.description = 'Add (optional) gem description here'
7
7
  s.required_ruby_version = '>= 1.8.7'
8
8
 
9
9
  # s.author = 'David Heinemeier Hansson'
10
10
  # s.email = 'david@loudthinking.com'
11
- # s.homepage = 'http://www.rubyonrails.org'
11
+ s.homepage = 'https://github.com/romul/spree-reviews/'
12
12
  # s.rubyforge_project = 'actionmailer'
13
13
 
14
14
  s.files = `git ls-files`.split("\n")
@@ -16,7 +16,5 @@ Gem::Specification.new do |s|
16
16
  s.require_path = 'lib'
17
17
  s.requirements << 'none'
18
18
 
19
- s.has_rdoc = true
20
-
21
- s.add_dependency('spree_core', '>= 0.30.1')
19
+ s.add_dependency('spree_core', '>= 0.50.0')
22
20
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_reviews
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 215
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 30
8
+ - 50
8
9
  - 0
9
- version: 0.30.0
10
+ version: 0.50.0
10
11
  platform: ruby
11
12
  authors: []
12
13
 
@@ -14,21 +15,23 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-01-26 00:00:00 +03:00
18
+ date: 2011-04-27 00:00:00 +04:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: spree_core
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 215
27
30
  segments:
28
31
  - 0
29
- - 30
30
- - 1
31
- version: 0.30.1
32
+ - 50
33
+ - 0
34
+ version: 0.50.0
32
35
  type: :runtime
33
36
  version_requirements: *id001
34
37
  description:
@@ -53,8 +56,8 @@ files:
53
56
  - app/helpers/reviews_helper.rb
54
57
  - app/models/feedback_review.rb
55
58
  - app/models/product_decorator.rb
56
- - app/models/rating.rb
57
59
  - app/models/review.rb
60
+ - app/models/review_sweeper.rb
58
61
  - app/models/reviews_configuration.rb
59
62
  - app/views/admin/feedback_reviews/index.html.erb
60
63
  - app/views/admin/review_settings/edit.html.erb
@@ -66,13 +69,8 @@ files:
66
69
  - app/views/feedback_reviews/_summary.html.erb
67
70
  - app/views/feedback_reviews/create.js.erb
68
71
  - app/views/reviews/_fine_print.html.erb
72
+ - app/views/reviews/_form.html.erb
69
73
  - app/views/reviews/_stars.html.erb
70
- - app/views/reviews/_stars0.html.erb
71
- - app/views/reviews/_stars1.html.erb
72
- - app/views/reviews/_stars2.html.erb
73
- - app/views/reviews/_stars3.html.erb
74
- - app/views/reviews/_stars4.html.erb
75
- - app/views/reviews/_stars5.html.erb
76
74
  - app/views/reviews/index.html.erb
77
75
  - app/views/reviews/new.html.erb
78
76
  - app/views/reviews/submissionguidelines.html.erb
@@ -82,15 +80,16 @@ files:
82
80
  - app/views/shared/_review_summary.html.erb
83
81
  - app/views/shared/_reviews.html.erb
84
82
  - app/views/shared/_shortrating.html.erb
83
+ - config/initializers/constants.rb
85
84
  - config/locales/de.yml
86
85
  - config/locales/en-GB.yml
87
86
  - config/locales/en.yml
88
87
  - config/locales/fr-FR.yml
89
88
  - config/locales/ru.yml
90
89
  - config/routes.rb
91
- - db/migrate/20081020220700_create_ratings.rb
92
90
  - db/migrate/20081020220724_create_reviews.rb
93
91
  - db/migrate/20101222083309_create_feedback_reviews.rb
92
+ - db/migrate/20110406083603_add_rating_to_products.rb
94
93
  - db/sample/ratings.yml
95
94
  - db/sample/reviews.yml
96
95
  - lib/spree/reviews/config.rb
@@ -103,14 +102,13 @@ files:
103
102
  - public/stylesheets/reviews.css
104
103
  - spec/controllers/reviews_controller_spec.rb
105
104
  - spec/helpers/reviews_helper_spec.rb
106
- - spec/models/ratings_spec.rb
107
105
  - spec/models/reviews_spec.rb
108
106
  - spec/spec.opts
109
107
  - spec/spec_helper.rb
110
108
  - spec/views/reviews/submit_view_spec.rb
111
109
  - spree_reviews.gemspec
112
110
  has_rdoc: true
113
- homepage:
111
+ homepage: https://github.com/romul/spree-reviews/
114
112
  licenses: []
115
113
 
116
114
  post_install_message:
@@ -119,25 +117,29 @@ rdoc_options: []
119
117
  require_paths:
120
118
  - lib
121
119
  required_ruby_version: !ruby/object:Gem::Requirement
120
+ none: false
122
121
  requirements:
123
122
  - - ">="
124
123
  - !ruby/object:Gem::Version
124
+ hash: 57
125
125
  segments:
126
126
  - 1
127
127
  - 8
128
128
  - 7
129
129
  version: 1.8.7
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
+ none: false
131
132
  requirements:
132
133
  - - ">="
133
134
  - !ruby/object:Gem::Version
135
+ hash: 3
134
136
  segments:
135
137
  - 0
136
138
  version: "0"
137
139
  requirements:
138
140
  - none
139
141
  rubyforge_project:
140
- rubygems_version: 1.3.6
142
+ rubygems_version: 1.3.7
141
143
  signing_key:
142
144
  specification_version: 3
143
145
  summary: Basic review and ratings facility for Spree
data/app/models/rating.rb DELETED
@@ -1,20 +0,0 @@
1
- class Rating < ActiveRecord::Base
2
- belongs_to :product
3
-
4
- NB_STARS=5
5
- def self.get_nb_stars
6
- NB_STARS
7
- end
8
-
9
- def add_rating(n)
10
- self.value = value * count + n
11
- self.count = count + 1
12
- self.value = value / count
13
- save
14
- end
15
-
16
- def get_stars
17
- (self.value + 0.5).floor
18
- end
19
-
20
- end
@@ -1 +0,0 @@
1
- <span class="unlit"> &#10030; </span><span class="unlit"> &#10030; </span><span class="unlit"> &#10030; </span><span class="unlit"> &#10030; </span><span class="unlit"> &#10030; </span>
@@ -1 +0,0 @@
1
- <span class="lit"> &#10030; </span><span class="unlit"> &#10030; </span><span class="unlit"> &#10030; </span><span class="unlit"> &#10030; </span><span class="unlit"> &#10030; </span>
@@ -1 +0,0 @@
1
- <span class="lit"> &#10030; </span><span class="lit"> &#10030; </span><span class="unlit"> &#10030; </span><span class="unlit"> &#10030; </span><span class="unlit"> &#10030; </span>
@@ -1 +0,0 @@
1
- <span class="lit"> &#10030; </span><span class="lit"> &#10030; </span><span class="lit"> &#10030; </span><span class="unlit"> &#10030; </span><span class="unlit"> &#10030; </span>
@@ -1 +0,0 @@
1
- <span class="lit"> &#10030; </span><span class="lit"> &#10030; </span><span class="lit"> &#10030; </span><span class="lit"> &#10030; </span><span class="unlit"> &#10030; </span>
@@ -1 +0,0 @@
1
- <span class="lit"> &#10030; </span><span class="lit"> &#10030; </span><span class="lit"> &#10030; </span><span class="lit"> &#10030; </span><span class="lit"> &#10030;</span>
@@ -1,14 +0,0 @@
1
- class CreateRatings < ActiveRecord::Migration
2
- def self.up
3
- create_table :ratings do |t|
4
- t.integer :product_id
5
- t.decimal :value
6
- t.integer :count
7
- t.timestamps
8
- end
9
- end
10
-
11
- def self.down
12
- drop_table :ratings
13
- end
14
- end
@@ -1,11 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe Ratings do
4
- before(:each) do
5
- @ratings = Ratings.new
6
- end
7
-
8
- it "should be valid" do
9
- @ratings.should be_valid
10
- end
11
- end