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.
Files changed (90) hide show
  1. data/README.md +7 -7
  2. data/app/assets/javascripts/store/review/index.js +13 -12
  3. data/app/assets/javascripts/store/spree_reviews_rating.js +15 -4
  4. data/app/assets/stylesheets/admin/spree_reviews_rating.css +1 -1
  5. data/app/assets/stylesheets/store/spree_reviews_rating.css +43 -0
  6. data/app/controllers/spree/admin/review_settings_controller.rb +25 -0
  7. data/app/controllers/spree/admin/reviews_controller.rb +30 -0
  8. data/app/controllers/spree/products_controller_decorator.rb +3 -0
  9. data/app/controllers/spree/reviews_controller.rb +55 -0
  10. data/app/helpers/spree/reviews_helper.rb +14 -0
  11. data/app/models/spree/ability_decorator.rb +11 -0
  12. data/app/models/{app_configuration_decorator.rb → spree/app_configuration_decorator.rb} +6 -3
  13. data/app/models/spree/product_decorator.rb +17 -0
  14. data/app/models/spree/review.rb +18 -0
  15. data/app/models/spree/review_sweeper.rb +24 -0
  16. data/app/models/spree/user_decorator.rb +7 -0
  17. data/app/overrides/add_review_bottom_sidebar.rb +2 -2
  18. data/app/overrides/reviews_admin_configuration_menu.rb +11 -0
  19. data/app/overrides/{add_reviews_tab_to_admin.rb → reviews_admin_tab.rb} +1 -1
  20. data/app/overrides/reviews_global_rating_product.rb +4 -0
  21. data/app/overrides/reviews_product_properties.rb +4 -0
  22. data/app/views/spree/admin/review_settings/edit.html.erb +18 -0
  23. data/app/views/spree/admin/review_settings/show.html.erb +44 -0
  24. data/app/views/spree/admin/reviews/_form.html.erb +6 -0
  25. data/app/views/spree/admin/reviews/edit.html.erb +19 -0
  26. data/app/views/{admin → spree/admin}/reviews/index.html.erb +7 -11
  27. data/app/views/spree/admin/shared/_reviews_setting_configurations_menu.html.erb +4 -0
  28. data/app/views/spree/reviews/_fine_print.html.erb +8 -0
  29. data/app/views/spree/reviews/_form.html.erb +22 -0
  30. data/app/views/spree/reviews/_new.html.erb +4 -0
  31. data/app/views/{reviews → spree/reviews}/_stars.html.erb +4 -1
  32. data/app/views/{reviews → spree/reviews}/all_list.html.erb +0 -0
  33. data/app/views/spree/reviews/error.js.erb +2 -0
  34. data/app/views/spree/reviews/index.html.erb +1 -0
  35. data/app/views/{reviews → spree/reviews}/new.html.erb +2 -3
  36. data/app/views/spree/reviews/success.js.erb +2 -0
  37. data/app/views/spree/shared/_rating.html.erb +28 -0
  38. data/app/views/spree/shared/_review.html.erb +19 -0
  39. data/app/views/{shared → spree/shared}/_review_link.html.erb +0 -0
  40. data/app/views/spree/shared/_review_summary.html.erb +7 -0
  41. data/app/views/spree/shared/_reviews.html.erb +23 -0
  42. data/app/views/{shared → spree/shared}/_shortrating.html.erb +1 -1
  43. data/app/views/spree/shared/_single_rating.html.erb +20 -0
  44. data/config/locales/en.yml +72 -6
  45. data/config/locales/it.yml +78 -12
  46. data/config/routes.rb +2 -9
  47. data/db/migrate/20081020220724_create_reviews.rb +2 -6
  48. data/db/migrate/20110406083603_add_rating_to_products.rb +3 -8
  49. data/db/migrate/20120123141326_recalculate_ratings.rb +3 -3
  50. data/db/migrate/20120323165848_reviews_rating_namespace.rb +5 -0
  51. data/lib/generators/spree_reviews_rating/install/install_generator.rb +1 -11
  52. data/lib/spree_reviews_rating.rb +0 -1
  53. metadata +135 -114
  54. data/app/controllers/admin/feedback_reviews_controller.rb +0 -6
  55. data/app/controllers/admin/review_settings_controller.rb +0 -16
  56. data/app/controllers/admin/reviews_controller.rb +0 -20
  57. data/app/controllers/feedback_reviews_controller.rb +0 -20
  58. data/app/controllers/products_controller_decorator.rb +0 -3
  59. data/app/controllers/reviews_controller.rb +0 -52
  60. data/app/helpers/admin/feedback_reviews_helper.rb +0 -2
  61. data/app/helpers/feedback_reviews_helper.rb +0 -2
  62. data/app/helpers/reviews_helper.rb +0 -11
  63. data/app/models/ability_decorator.rb +0 -14
  64. data/app/models/feedback_review.rb +0 -12
  65. data/app/models/product_decorator.rb +0 -15
  66. data/app/models/review.rb +0 -21
  67. data/app/models/review_sweeper.rb +0 -21
  68. data/app/models/user_decorator.rb +0 -7
  69. data/app/overrides/add_reviews_after_product_properties.rb +0 -4
  70. data/app/overrides/add_reviews_to_admin_configuration_menu.rb +0 -4
  71. data/app/views/admin/feedback_reviews/index.html.erb +0 -21
  72. data/app/views/admin/review_settings/edit.html.erb +0 -30
  73. data/app/views/admin/review_settings/show.html.erb +0 -30
  74. data/app/views/admin/reviews/_form.html.erb +0 -10
  75. data/app/views/admin/reviews/edit.html.erb +0 -17
  76. data/app/views/feedback_reviews/_form.html.erb +0 -15
  77. data/app/views/feedback_reviews/_summary.html.erb +0 -6
  78. data/app/views/feedback_reviews/create.js.erb +0 -7
  79. data/app/views/reviews/_fine_print.html.erb +0 -9
  80. data/app/views/reviews/_form.html.erb +0 -23
  81. data/app/views/reviews/index.html.erb +0 -1
  82. data/app/views/reviews/submissionguidelines.html.erb +0 -6
  83. data/app/views/reviews/terms.html.erb +0 -6
  84. data/app/views/shared/_rating.html.erb +0 -25
  85. data/app/views/shared/_review.html.erb +0 -17
  86. data/app/views/shared/_review_summary.html.erb +0 -10
  87. data/app/views/shared/_reviews.html.erb +0 -13
  88. data/config/initializers/helpers.rb +0 -2
  89. data/config/initializers/load_preferences.rb +0 -5
  90. data/db/migrate/20101222083309_create_feedback_reviews.rb +0 -18
@@ -0,0 +1,2 @@
1
+ $("#new_review").addClass("s_bgmsg_green").html("<%= escape_javascript(t('review_successfully_submitted')) %>");
2
+ //setTimeout(function() { $("#reviews_form").show(); }, 1600);
@@ -0,0 +1,28 @@
1
+ <% stars = @product.get_stars
2
+ if !stars.blank? %>
3
+ <div class="rating">
4
+ <p><%= t('average_customer_rating') %>: </p>
5
+ <div id="star" data-rating="<%= stars[:star] || 0 %>"></div>
6
+ <p>(<%= t('based_upon') %> <%= stars[:rcount] %> <%= t('reviews') %>)</p>
7
+ <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
8
+ <meta itemprop="ratingValue" content="<%= stars[:star] %>" />
9
+ <meta itemprop="reviewCount" content="<%= stars[:rcount] %>" />
10
+ </div>
11
+ </div>
12
+ <% end %>
13
+ <script type="text/javascript">
14
+ <!--//
15
+ jQuery(document).ready(function() {
16
+ $("#star").raty({
17
+ readOnly: true,
18
+ start: <%= stars[:star] %>,
19
+ half: true,
20
+ width: 180,
21
+ starHalf: 'star-half<%= "-big" if (Spree::Config[:star_big] == true) %>.png',
22
+ starOff: 'star-off<%= "-big" if (Spree::Config[:star_big] == true) %>.png',
23
+ starOn: 'star-on<%= "-big" if (Spree::Config[:star_big] == true) %>.png',
24
+ path: '/assets/'
25
+ });
26
+ });
27
+ //-->
28
+ </script>
@@ -0,0 +1,19 @@
1
+ <div class="review" itemprop="reviews" itemscope itemtype="http://schema.org/Review">
2
+ <% if Spree::Config[:show_email] && review.user %>
3
+ <p class="author" itemprop="author"><strong><%= review.user.email %></strong>
4
+ <% else %>
5
+ <p class="author" itemprop="author"><strong><%= raw review.name %></strong>
6
+ <% end %>
7
+ <small itemprop="datePublished"><%= t('submitted_on') %> (<%= l review.created_at.to_date %>)</small>
8
+ </p>
9
+ <div class="right">
10
+ <div class="single_rating_holder">
11
+ <meta itemprop="reviewRating" content="<%= review.rating %>" />
12
+ <%= render :partial => "spree/shared/single_rating", :locals => {:review => review} %>
13
+ </div>
14
+ </div>
15
+ <div class="clear"></div>
16
+ <div itemprop="reviewBody">
17
+ <%= raw simple_format(review.review) %>
18
+ </div>
19
+ </div>
@@ -0,0 +1,7 @@
1
+ <div id="reviews">
2
+ <%= render :partial => 'spree/shared/rating', :locals => {:product => @product} %>
3
+ <% for review in @product.reviews.approved.preview %>
4
+ <%= render :partial => 'spree/shared/review', :locals => {:review => review} %>
5
+ <% end %>
6
+ </div>
7
+
@@ -0,0 +1,23 @@
1
+ <div id="reviews">
2
+ <% unless @product.reviews.approved.blank? %>
3
+ <% for review in @product.reviews.approved.page(params[:page]).per(Spree::Config[:preview_size]) %>
4
+ <%= render :partial => 'spree/shared/review', :locals => {:review => review} %>
5
+ <% end %>
6
+ <% else %>
7
+ <div class="review" itemprop="reviews" itemscope itemtype="http://schema.org/Review"><%= t("reviews_rating.no_reviews_found") %></div>
8
+ <% end %>
9
+ <div class="pagination">
10
+ <div class="results"><%= paginate @product.reviews.approved.page(params[:page]).per(Spree::Config[:preview_size]) %></div>
11
+ </div>
12
+ <% if !Spree::Config[:require_login] || current_user %>
13
+ <% if !Spree::Config[:form_show] %>
14
+ <%= link_to(t('write_your_own_review'), new_product_review_path(@product), :class => "button-review", :rel => "nofollow,noindex") %>
15
+ <% else %>
16
+ <%= render "spree/reviews/new", :review => Spree::Review.new(:product => @product), :product => @product %>
17
+ <% end %>
18
+ <% end %>
19
+ <div id="new_review"></div>
20
+ <span class="clear"></span>
21
+ </div>
22
+ <%= javascript_include_tag 'store/review/index.js' %>
23
+ <%= javascript_include_tag 'store/review/new.js' %>
@@ -1,6 +1,6 @@
1
1
  <% stars = product.get_stars %>
2
2
  <span style="float:left;" title="<%= txt_stars(stars[:star]) %>">
3
- <%= render :partial => "reviews/stars", :locals => {:stars => stars[:star]} %>
3
+ <%= render :partial => "spree/reviews/stars", :locals => {:stars => stars[:star]} %>
4
4
  </span>
5
5
  <span style="float:right;">
6
6
  <%= Review.model_name.human(:count => stars[:rcount]) %>
@@ -0,0 +1,20 @@
1
+ <% if !review.rating.blank? %>
2
+ <p class="single_rating rate"><span id="star_s<%= review.id.to_s %>" data-rating="<%= review.rating || 0 %>"></span></p>
3
+ <span class="average"><%= review.rating.to_s + " " + t("reviews_rating.on_stars") + " 5 " + t(:stars) %></span>
4
+ <% end %>
5
+ <script type="text/javascript">
6
+ <!--//
7
+ jQuery(document).ready(function() {
8
+ $("#star_s<%= review.id.to_s %>").raty({
9
+ readOnly: true,
10
+ start: <%= review.rating %>,
11
+ half: true,
12
+ width: 180,
13
+ starHalf: 'star-half<%= "-big" if (Spree::Config[:star_big] == true) %>.png',
14
+ starOff: 'star-off<%= "-big" if (Spree::Config[:star_big] == true) %>.png',
15
+ starOn: 'star-on<%= "-big" if (Spree::Config[:star_big] == true) %>.png',
16
+ path: '/assets/'
17
+ });
18
+ });
19
+ //-->
20
+ </script>
@@ -1,5 +1,49 @@
1
+ ---
1
2
  en:
2
3
  activerecord:
4
+ errors: &errors
5
+ format: "%{attribute} %{message}\n"
6
+
7
+ messages: &errors_messages
8
+ inclusion: "is not included in the list"
9
+ exclusion: "is reserved"
10
+ invalid: "is invalid"
11
+ confirmation: "doesn't match confirmation"
12
+ record_invalid: "Validation failed: %{errors}"
13
+ taken: has already been taken
14
+ accepted: "must be accepted"
15
+ empty: "can't be empty"
16
+ blank: "can't be blank"
17
+ too_long:
18
+ one: "is too long (maximum is 1 character)"
19
+ other: "is too long (maximum is %{count} characters)"
20
+ too_short:
21
+ one: "is too short (minimum is 1 character)"
22
+ other: "is too short (minimum is %{count} characters)"
23
+ wrong_length:
24
+ one: "is the wrong length (should be 1 character)"
25
+ other: "is the wrong length (should be %{count} characters)"
26
+ not_a_number: "is not a number"
27
+ not_an_integer: "must be an integer"
28
+ greater_than: "must be greater than %{count}"
29
+ greater_than_or_equal_to: "must be greater than or equal to %{count}"
30
+ equal_to: "must be equal to %{count}"
31
+ less_than: "must be less than %{count}"
32
+ less_than_or_equal_to: "must be less than or equal to %{count}"
33
+ odd: "must be odd"
34
+ even: "must be even"
35
+
36
+ models:
37
+ review:
38
+ attributes:
39
+ review:
40
+ name: Your Name
41
+ title: Title
42
+ review: Content
43
+ rating: Rating
44
+ created_at: Date
45
+ ip_address: IP
46
+ user: User
3
47
  attributes:
4
48
  review:
5
49
  name: Your Name
@@ -12,17 +56,19 @@ en:
12
56
  models:
13
57
  review:
14
58
  one: one review
15
- other: "%{count} reviews"
59
+ many: "%{count} reviews"
16
60
  time:
17
61
  formats:
18
62
  default: "%a %d %b %Y, %H:%M:%S %z"
19
63
  short: "%d %b %H:%M"
20
64
  long: "%d %B %Y %H:%M"
21
- review: "%a %d.%m.%Y"
65
+ review: "%d/%m/%Y"
22
66
  hours: "%H:%M"
23
67
  dow: "%A"
24
68
 
25
69
  approve: Approve
70
+ on_stars: on
71
+ stars: stars!
26
72
  Approved_reviews: Approved
27
73
  approved_text: Unlocked comments will be published within 1-2 business days.
28
74
  are_you_sure_review: Are you sure to delete review ?
@@ -43,9 +89,12 @@ en:
43
89
  leave_us_a_review: Leave us a review and a rating
44
90
  original_version: 'Original version'
45
91
  out_of_5: "out of 5"
92
+ created_at: Created at
46
93
  rating: rating
47
94
  reviews: Reviews
48
95
  review_content: Content
96
+ review_settings: Reviews Settings
97
+ manage_review_settings: Manage Reviews Settings
49
98
  review_guidelines: Review Guidelines
50
99
  review_management: Review Management
51
100
  review_management_description: Manage the user-submitted reviews
@@ -53,13 +102,30 @@ en:
53
102
  review_successfully_submitted: Review was successfully submitted
54
103
  review_not_submitted: Review was not submitted
55
104
  review_title: Title
56
- spree_reviews:
105
+ reviews_rating:
106
+ preview_size: Size of the review snippets
107
+ include_unapproved_reviews: Include unapproved reviews in listings
108
+ show_email: Show user email
109
+ require_login: Authentication required
110
+ form_show: View form for insert review
111
+ on_stars: on
112
+ write: Write
113
+ a_review: a Review
114
+ name: Name
115
+ review: Review
116
+ note_reviews: Note
117
+ continue: Send
118
+ no_reviews_found: No review yet included
119
+ edited_version: Edited Version
120
+ original_version: Original Version
121
+ review_settings: Reviews Setting
122
+ manage_review_settings: Manage Reviews Setting
123
+ rating: Rate
124
+ note_review_description: Do not insert HTML code!
57
125
  review_settings: Review Settings
58
126
  manage_review_settings: Control the display of reviews
59
- preview_size: Size of the review snippets
60
- include_unapproved: Include unapproved reviews in listings
61
- show_email: Show email addresses
62
127
  feedback_rating: Rate feedback
128
+ star_big: Big Star
63
129
  require_login: Require user to be logged in
64
130
  your_name: Your name
65
131
  your_location: Your location
@@ -1,5 +1,49 @@
1
+ ---
1
2
  it:
2
3
  activerecord:
4
+ errors: &errors
5
+ format: "%{attribute} %{message}\n"
6
+
7
+ messages: &errors_messages
8
+ inclusion: "non è incluso nella lista"
9
+ exclusion: "è riservato"
10
+ invalid: "non è valido"
11
+ confirmation: "non coincide con la conferma"
12
+ record_invalid: "Validazione fallita: %{errors}"
13
+ taken: è già in uso
14
+ accepted: "deve essere accettata"
15
+ empty: "non può essere vuoto"
16
+ blank: "non può essere lasciato in bianco"
17
+ too_long:
18
+ one: "è troppo lungo (il massimo è 1 carattere)"
19
+ other: "è troppo lungo (il massimo è %{count} caratteri)"
20
+ too_short:
21
+ one: "è troppo corto (il minimo è 1 carattere)"
22
+ other: "è troppo corto (il minimo è %{count} caratteri)"
23
+ wrong_length:
24
+ one: "è della lunghezza sbagliata (deve essere di 1 carattere)"
25
+ other: "è della lunghezza sbagliata (deve essere di %{count} caratteri)"
26
+ not_a_number: "non è un numero"
27
+ not_an_integer: "non è un intero"
28
+ greater_than: "deve essere superiore a %{count}"
29
+ greater_than_or_equal_to: "deve essere superiore o uguale a %{count}"
30
+ equal_to: "deve essere uguale a %{count}"
31
+ less_than: "deve essere meno di %{count}"
32
+ less_than_or_equal_to: "deve essere meno o uguale a %{count}"
33
+ odd: "deve essere dispari"
34
+ even: "deve essere pari"
35
+
36
+ models:
37
+ review:
38
+ attributes:
39
+ review:
40
+ name: Nome
41
+ title: Titolo
42
+ review: Contenuto
43
+ rating: Voto
44
+ created_at: Data
45
+ ip_address: IP
46
+ user: Utente
3
47
  attributes:
4
48
  review:
5
49
  name: Nome
@@ -12,18 +56,20 @@ it:
12
56
  models:
13
57
  review:
14
58
  one: Recensione
15
- other: "%{count} recensioni"
59
+ many: "%{count} recensioni"
16
60
  time:
17
61
  formats:
18
62
  default: "%a %d %b %Y, %H:%M:%S %z"
19
63
  short: "%d %b %H:%M"
20
64
  long: "%d %B %Y %H:%M"
21
- review: "%a %d.%m.%Y"
65
+ review: "%d/%m/%Y"
22
66
  hours: "%H:%M"
23
67
  dow: "%A"
24
68
 
25
69
  approve: Approvare
26
- Approved_reviews: Approvata
70
+ on_stars: su
71
+ stars: stelle!
72
+ Approved_reviews: Approvate
27
73
  approved_text: Unlocked comments will be published within 1-2 business days.
28
74
  are_you_sure_review: Sei sicuro di eliminare la recensione ?
29
75
  average_customer_rating: Voto medio
@@ -44,23 +90,43 @@ it:
44
90
  leave_us_a_review: Lasciaci un commento e un voto
45
91
  original_version: 'Original version'
46
92
  out_of_5: "su 5"
47
- rating: voto
93
+ created_at: Creata il
94
+ rating: Voto
48
95
  review: Recensione
49
96
  review_content: Contenuto
50
97
  review_guidelines: Review Guidelines
98
+ review_settings: Configurazioni Recensioni
99
+ manage_review_settings: Imposta le configurazioni per le recensioni
51
100
  review_management: Recensioni
52
- review_management_description: Manage the user-submitted reviews
101
+ review_management_description: Amministra le recensioni inviate
53
102
  review_name: Your Name
54
103
  review_successfully_submitted: La recensione è stata inviata correttamente
55
- review_not_submitted: Non è stato possibile salvare la recensione
104
+ review_not_submitted: Non è stato possibile salvare la recensione.
56
105
  review_title: Title
57
- spree_reviews:
58
- review_settings: Impostazione recensioni
106
+ reviews_rating:
107
+ preview_size: Anteprima recensioni visualizzabili in pagina prodotto
108
+ include_unapproved_reviews: Includere le recensioni non approvate
109
+ show_email: Visualizza la mail dell'utente
110
+ require_login: Autenticazione necessaria
111
+ form_show: Visualizza direttamente il form di inserimento
112
+ on_stars: su
113
+ write: Scrivi
114
+ a_review: un Commento
115
+ name: Nome da visualizzare
116
+ review: Recensione
117
+ note_reviews: Note
118
+ continue: Invia
119
+ no_reviews_found: Nessuna Recensione ancora inserita
120
+ edited_version: Versione Modificata
121
+ original_version: Versione Originale
122
+ review_settings: Impostazioni Recensioni
123
+ manage_review_settings: Gestione Impostazioni Recensioni
124
+ rating: Vota
125
+ note_review_description: Non inserire codice HTML!
126
+ review_settings: Configurazioni Recensioni
59
127
  manage_review_settings: Control the display of reviews
60
- preview_size: Size of the review snippets
61
- include_unapproved: Include unapproved reviews in listings
62
- show_email: Mostra indirizzo email
63
128
  feedback_rating: Rate feedback
129
+ star_big: Stelle Grandi
64
130
  require_login: Devi essere loggato per procedere
65
131
  your_name: Il tuo nome
66
132
  your_location: La tua posizione
@@ -73,7 +139,7 @@ it:
73
139
  terms_text: All opinions must comply with our terms and conditions
74
140
  terms_and_conditions: Terms & Conditions
75
141
  the_fine_print: The fine print
76
- Unapproved_reviews: Non approvata
142
+ Unapproved_reviews: Non approvate
77
143
  voice:
78
144
  one: "1 voice"
79
145
  other: "%{count} voices"
data/config/routes.rb CHANGED
@@ -1,26 +1,19 @@
1
- Rails.application.routes.draw do
1
+ Spree::Core::Engine.routes.prepend do
2
+
2
3
  namespace :admin do
3
- resources :feedback_reviews
4
4
  resources :reviews do
5
5
  member do
6
6
  get :approve
7
7
  end
8
- resources :feedback_reviews
9
8
  end
10
9
  resource :review_settings
11
10
  end
12
11
 
13
12
  resources :products do
14
13
  resources :reviews do
15
- collection do
16
- get :terms
17
- get "submissionguidelines"
18
- end
19
14
  end
20
15
  end
21
- #resources :reviews
22
16
 
23
- match "/reviews/:review_id/feedback(.:format)" => "feedback_reviews#create", :via => :post, :as => "feedback_review"
24
17
  match "/reviews/all_list", :to => "reviews#all_list", :as => :all_reviews
25
18
 
26
19
  end
@@ -1,6 +1,6 @@
1
1
  class CreateReviews < ActiveRecord::Migration
2
- def self.up
3
- create_table :reviews do |t|
2
+ def change
3
+ create_table :spree_reviews do |t|
4
4
  t.string :name, :location
5
5
  t.decimal :rating
6
6
  t.text :review
@@ -11,8 +11,4 @@ class CreateReviews < ActiveRecord::Migration
11
11
  t.timestamps
12
12
  end
13
13
  end
14
-
15
- def self.down
16
- drop_table :reviews
17
- end
18
14
  end
@@ -1,11 +1,6 @@
1
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
- end
6
-
7
- def self.down
8
- remove_column :products, :reviews_count
9
- remove_column :products, :avg_rating
2
+ def change
3
+ add_column :spree_products, :avg_rating, :decimal, :default => 0.0, :null => false, :precision => 7, :scale => 5
4
+ add_column :spree_products, :reviews_count, :integer, :default => 0, :null => false
10
5
  end
11
6
  end
@@ -1,8 +1,8 @@
1
1
  class RecalculateRatings < ActiveRecord::Migration
2
2
  def change
3
- Product.reset_column_information
4
- Product.all.each do |p|
5
- Product.update_counters p.id, :reviews_count => p.reviews.length
3
+ Spree::Product.reset_column_information
4
+ Spree::Product.all.each do |p|
5
+ Spree::Product.update_counters p.id, :reviews_count => p.reviews.length
6
6
  p.recalculate_rating
7
7
  end
8
8
  end
@@ -0,0 +1,5 @@
1
+ class ReviewsRatingNamespace < ActiveRecord::Migration
2
+ def change
3
+ rename_table :reviews, :spree_reviews
4
+ end
5
+ end
@@ -1,19 +1,9 @@
1
1
  module SpreeReviewsRating
2
2
  module Generators
3
3
  class InstallGenerator < Rails::Generators::Base
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
-
4
+
14
5
  def add_javascripts
15
6
  append_file "app/assets/javascripts/store/all.js", "//= require store/spree_reviews_rating\n"
16
- #append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_reviews_rating\n"
17
7
  end
18
8
 
19
9
  def add_stylesheets
@@ -1,3 +1,2 @@
1
1
  require 'spree_core'
2
- require 'formtastic'
3
2
  require 'spree_reviews_rating/engine'