solidus_reviews 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +18 -0
  5. data/CONTRIBUTING.md +28 -0
  6. data/Gemfile +14 -0
  7. data/LICENSE.md +26 -0
  8. data/README.md +93 -0
  9. data/Rakefile +21 -0
  10. data/app/assets/images/store/reviews/delete.gif +0 -0
  11. data/app/assets/images/store/reviews/star.gif +0 -0
  12. data/app/assets/javascripts/spree/backend/solidus_reviews.js +7 -0
  13. data/app/assets/javascripts/spree/frontend/solidus_reviews.js +7 -0
  14. data/app/assets/stylesheets/spree/backend/solidus_reviews.css +3 -0
  15. data/app/assets/stylesheets/spree/frontend/solidus_reviews.scss +83 -0
  16. data/app/controllers/spree/admin/feedback_reviews_controller.rb +6 -0
  17. data/app/controllers/spree/admin/review_settings_controller.rb +21 -0
  18. data/app/controllers/spree/admin/reviews_controller.rb +34 -0
  19. data/app/controllers/spree/feedback_reviews_controller.rb +41 -0
  20. data/app/controllers/spree/products_controller_decorator.rb +5 -0
  21. data/app/controllers/spree/reviews_controller.rb +48 -0
  22. data/app/helpers/spree/reviews_helper.rb +17 -0
  23. data/app/models/spree/feedback_review.rb +17 -0
  24. data/app/models/spree/product_decorator.rb +21 -0
  25. data/app/models/spree/review.rb +36 -0
  26. data/app/models/spree/reviews_ability.rb +17 -0
  27. data/app/models/spree/reviews_configuration.rb +26 -0
  28. data/app/overrides/add_reviews_after_product_properties.rb +5 -0
  29. data/app/overrides/add_reviews_tab_to_admin.rb +4 -0
  30. data/app/overrides/add_reviews_to_admin_configuration_sidebar.rb +5 -0
  31. data/app/views/spree/admin/feedback_reviews/index.html.erb +44 -0
  32. data/app/views/spree/admin/review_settings/edit.html.erb +40 -0
  33. data/app/views/spree/admin/reviews/_form.html.erb +22 -0
  34. data/app/views/spree/admin/reviews/edit.html.erb +26 -0
  35. data/app/views/spree/admin/reviews/index.html.erb +111 -0
  36. data/app/views/spree/feedback_reviews/_form.html.erb +13 -0
  37. data/app/views/spree/feedback_reviews/_summary.html.erb +6 -0
  38. data/app/views/spree/feedback_reviews/create.js.erb +7 -0
  39. data/app/views/spree/reviews/_form.html.erb +34 -0
  40. data/app/views/spree/reviews/_stars.html.erb +13 -0
  41. data/app/views/spree/reviews/index.html.erb +1 -0
  42. data/app/views/spree/reviews/new.html.erb +3 -0
  43. data/app/views/spree/shared/_rating.html.erb +15 -0
  44. data/app/views/spree/shared/_review.html.erb +28 -0
  45. data/app/views/spree/shared/_review_summary.html.erb +9 -0
  46. data/app/views/spree/shared/_reviews.html.erb +15 -0
  47. data/app/views/spree/shared/_shortrating.html.erb +9 -0
  48. data/bin/rails +5 -0
  49. data/config/initializers/constants.rb +1 -0
  50. data/config/initializers/load_preferences.rb +5 -0
  51. data/config/locales/de-CH.yml +68 -0
  52. data/config/locales/de.yml +68 -0
  53. data/config/locales/en-GB.yml +68 -0
  54. data/config/locales/en.yml +67 -0
  55. data/config/locales/es.yml +68 -0
  56. data/config/locales/fr.yml +68 -0
  57. data/config/locales/pl.yml +72 -0
  58. data/config/locales/pt-BR.yml +68 -0
  59. data/config/locales/pt.yml +69 -0
  60. data/config/locales/ro.yml +76 -0
  61. data/config/locales/ru.yml +73 -0
  62. data/config/locales/sv.yml +66 -0
  63. data/config/locales/tr.yml +68 -0
  64. data/config/locales/uk.yml +75 -0
  65. data/config/locales/zh-CN.yml +65 -0
  66. data/config/locales/zh-TW.yml +65 -0
  67. data/config/routes.rb +17 -0
  68. data/db/migrate/20081020220724_create_reviews.rb +18 -0
  69. data/db/migrate/20101222083309_create_feedback_reviews.rb +17 -0
  70. data/db/migrate/20110406083603_add_rating_to_products.rb +21 -0
  71. data/db/migrate/20110606150524_add_user_to_reviews.rb +9 -0
  72. data/db/migrate/20110806093221_add_ip_address_to_reviews.rb +9 -0
  73. data/db/migrate/20120110172331_namespace_tables.rb +6 -0
  74. data/db/migrate/20120123141326_recalculate_ratings.rb +20 -0
  75. data/db/migrate/20120712182514_add_locale_to_reviews.rb +9 -0
  76. data/db/migrate/20120712182627_add_locale_to_feedback_reviews.rb +9 -0
  77. data/db/migrate/20140703200946_add_show_identifier_to_reviews.rb +6 -0
  78. data/db/sample/ratings.yml +16 -0
  79. data/db/sample/reviews.yml +59 -0
  80. data/lib/generators/solidus_reviews/install/install_generator.rb +30 -0
  81. data/lib/solidus_reviews/factories/feedback_review_factory.rb +8 -0
  82. data/lib/solidus_reviews/factories/review_factory.rb +20 -0
  83. data/lib/solidus_reviews/factories.rb +5 -0
  84. data/lib/solidus_reviews.rb +6 -0
  85. data/lib/spree_reviews/engine.rb +17 -0
  86. data/solidus_reviews.gemspec +35 -0
  87. data/spec/controllers/admin/feedback_reviews_controller_spec.rb +29 -0
  88. data/spec/controllers/admin/review_settings_controller_spec.rb +57 -0
  89. data/spec/controllers/admin/reviews_controller_spec.rb +63 -0
  90. data/spec/controllers/feedback_reviews_controller_spec.rb +71 -0
  91. data/spec/controllers/products_controller_spec.rb +9 -0
  92. data/spec/controllers/reviews_controller_spec.rb +136 -0
  93. data/spec/features/admin_spec.rb +35 -0
  94. data/spec/features/reviews_spec.rb +122 -0
  95. data/spec/helpers/review_helper_spec.rb +28 -0
  96. data/spec/models/feedback_review_spec.rb +78 -0
  97. data/spec/models/product_spec.rb +62 -0
  98. data/spec/models/review_spec.rb +168 -0
  99. data/spec/models/reviews_ability_spec.rb +46 -0
  100. data/spec/models/reviews_configuration_spec.rb +45 -0
  101. data/spec/spec_helper.rb +55 -0
  102. data/vendor/assets/javascripts/jquery.rating.js +376 -0
  103. metadata +357 -0
@@ -0,0 +1,44 @@
1
+ <% content_for :page_title do %>
2
+ <%= Spree.t('feedback_review_for', :review => @review.title) %>
3
+ <% end %>
4
+
5
+ <% content_for :page_actions do %>
6
+ <li><%= button_link_to Spree.t(:back_to_reviews), admin_reviews_path, { :icon => 'icon-arrow-left' } %></li>
7
+ <% end %>
8
+
9
+ <% render 'spree/admin/shared/product_sub_menu' %>
10
+
11
+ <% if @collection.any? %>
12
+ <table class="index">
13
+ <colgroup>
14
+ <col style="width: 30%;">
15
+ <col style="width: 20%;">
16
+ <col style="width: 20%;">
17
+ <col style="width: 17%;">
18
+ </colgroup>
19
+ <thead>
20
+ <tr>
21
+ <th><%= Spree.t('user') %></th>
22
+ <th><%= Spree.t('stars') %></th>
23
+ <th><%= Spree.t('date') %></th>
24
+ <th></th>
25
+ </tr>
26
+ </thead>
27
+ <tbody>
28
+ <%- @collection.each do |feedback| -%>
29
+ <tr id="<%= dom_id(feedback) %>">
30
+ <td><%= l feedback.created_at %></td>
31
+ <td><%= feedback.user.try(:login) || Spree.t(:anonymous) %></td>
32
+ <td><%= feedback.rating %></td>
33
+ <td class="actions">
34
+ <%= link_to_delete feedback, :no_text => true %>
35
+ </td>
36
+ </tr>
37
+ <% end %>
38
+ </tbody>
39
+ </table>
40
+ <% else %>
41
+ <div class="no-objects-found">
42
+ <%= Spree.t(:no_results) %>
43
+ </div>
44
+ <% end %>
@@ -0,0 +1,40 @@
1
+ <%= render 'spree/admin/shared/configuration_menu' %>
2
+
3
+ <% content_for :page_title do %>
4
+ <%= Spree.t("spree_reviews.review_settings") %>
5
+ <% end %>
6
+
7
+ <%= form_tag(admin_review_settings_path, :method => :put) do %>
8
+ <fieldset class="no-border-top">
9
+ <div class="field">
10
+ <%= check_box_tag('preferences[include_unapproved_reviews]', "1", Spree::Reviews::Config[:include_unapproved_reviews]) %>
11
+ <label><%= Spree.t("spree_reviews.include_unapproved") %></label>
12
+ </div>
13
+ <div class="field">
14
+ <%= check_box_tag('preferences[feedback_rating]', "1", Spree::Reviews::Config[:feedback_rating]) %>
15
+ <label><%= Spree.t("spree_reviews.feedback_rating") %></label>
16
+ </div>
17
+ <div class="field">
18
+ <%= check_box_tag('preferences[show_email]', "1", Spree::Reviews::Config[:show_email]) %>
19
+ <label><%= Spree.t("spree_reviews.show_email") %></label>
20
+ </div>
21
+ <div class="field">
22
+ <%= check_box_tag('preferences[require_login]', "1", Spree::Reviews::Config[:require_login]) %>
23
+ <label><%= Spree.t("spree_reviews.require_login") %></label>
24
+ </div>
25
+ <div class="field">
26
+ <%= check_box_tag('preferences[track_locale]', "1", Spree::Reviews::Config[:track_locale]) %>
27
+ <label><%= Spree.t("spree_reviews.track_locale") %></label>
28
+ </div>
29
+ <div class="field">
30
+ <label><%= Spree.t('spree_reviews.preview_size') %></label><br>
31
+ <%= text_field_tag('preferences[preview_size]', Spree::Reviews::Config[:preview_size], :size => 3) %>
32
+ </div>
33
+
34
+ <div class="form-buttons filter-actions actions" data-hook="buttons">
35
+ <%= button Spree.t('actions.update'), 'icon-refresh' %>
36
+ <span class="or"><%= Spree.t(:or) %></span>
37
+ <%= link_to_with_icon 'icon-remove', Spree.t('actions.cancel'), edit_admin_general_settings_url, :class => 'button' %>
38
+ </div>
39
+ </fieldset>
40
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <%= render "spree/shared/error_messages", :target => @review %>
2
+ <%= f.field_container :name do %>
3
+ <%= f.label :name %><br />
4
+ <%= f.text_field :name, :maxlength => "255", :size => "60" %>
5
+ <% end %>
6
+
7
+ <%= f.field_container :title do %>
8
+ <%= f.label :title %><br />
9
+ <%= f.text_field :title, :maxlength => "255", :size => "60" %>
10
+ <% end %>
11
+
12
+ <%= f.field_container :review do %>
13
+ <%= f.label :review %><br />
14
+ <%= f.text_area :review, :wrap => "virtual", :rows => "10", :cols => "60" %>
15
+ <% end %>
16
+
17
+ <% if Spree::Reviews::Config[:track_locale] %>
18
+ <%= f.field_container :locale do %>
19
+ <%= f.label :locale %><br />
20
+ <%= f.select :locale, I18n.available_locales.map { |lc| [t(lc, :default => lc.to_s), lc.to_s] } %>
21
+ <% end %>
22
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <% content_for :page_title do %>
2
+ <%= Spree.t(:editing_review_for_html, :link => link_to(@review.product.name, product_path(@review.product))) %>
3
+ <% end %>
4
+
5
+ <% render 'spree/admin/shared/product_sub_menu' %>
6
+
7
+ <%= form_for([:admin, @review]) do |f| %>
8
+ <div class="alpha eight columns">
9
+ <% unless @review.title.blank? %>
10
+ <h2><%= @review.title %></h2>
11
+ <% end %>
12
+ <p>
13
+ <%= simple_format(@review.review) %>
14
+ </p>
15
+ </div>
16
+
17
+ <div class="omega eight columns">
18
+ <%= render 'form', :f => f %>
19
+ </div>
20
+
21
+ <div class="clear"></div>
22
+
23
+ <fieldset class="no-border-top">
24
+ <%= render 'spree/admin/shared/edit_resource_links' %>
25
+ </fieldset>
26
+ <% end %>
@@ -0,0 +1,111 @@
1
+ <% content_for :page_title do %>
2
+ <%= Spree.t('reviews') %>
3
+ <% end %>
4
+
5
+ <% render 'spree/admin/shared/product_sub_menu' %>
6
+
7
+ <% content_for :table_filter_title do %>
8
+ <%= Spree.t('search') %>
9
+ <% end %>
10
+
11
+ <% content_for :table_filter do %>
12
+ <div data-hook="admin_reviews_index_search">
13
+
14
+ <%= search_form_for [:admin, @search] do |f| %>
15
+ <div class="alpha three columns">
16
+ <div class="field">
17
+ <%= label_tag nil, Spree.t(:user) %><br />
18
+ <%= f.text_field :name_cont, :size => 25 %>
19
+ </div>
20
+ </div>
21
+
22
+ <div class="seven columns">
23
+ <div class="field">
24
+ <%= label_tag nil, Spree.t(:title) -%><br/>
25
+ <%= f.text_field :title_cont, :size => 25 -%>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="four columns">
30
+ <div class="field">
31
+ <%= label_tag nil, Spree.t(:review) -%><br/>
32
+ <%= f.text_field :review_cont, :size => 25 -%>
33
+ </div>
34
+ </div>
35
+
36
+ <div class="two columns omega">
37
+ <div class="field">
38
+ <%= label_tag nil, Spree.t(:approval_status)-%><br/>
39
+ <%= f.select :approved_eq, [[Spree.t('all'), nil], [Spree.t('approved_reviews'), true], [Spree.t('unapproved_reviews'), false]] -%>
40
+ </div>
41
+ </div>
42
+
43
+ <div class="clear"></div>
44
+
45
+ <div class="form-buttons actions filter-actions" data-hook="admin_reviews_index_search_buttons">
46
+ <%= button Spree.t(:search), 'icon-search' %>
47
+ </div>
48
+ <%- end -%>
49
+ </div>
50
+ <%- end -%>
51
+
52
+ <% paginate @reviews %>
53
+
54
+ <% if @reviews.any? %>
55
+ <table class="index">
56
+ <colgroup>
57
+ <col style="width: 25%;">
58
+ <col style="width: 10%;">
59
+ <col style="width: 10%;">
60
+ <col style="width: 20%;">
61
+ <col style="width: 15%;">
62
+ <col style="width: 17%;">
63
+ </colgroup>
64
+ <thead>
65
+ <tr>
66
+ <th><%= Spree.t('product') %></th>
67
+ <th><%= Spree::Review.human_attribute_name(:rating) %></th>
68
+ <th><%= Spree.t('feedback') %></th>
69
+ <th><%= Spree::Review.human_attribute_name(:user) %></th>
70
+ <th><%= Spree::Review.human_attribute_name(:created_at) %></th>
71
+ </tr>
72
+ </thead>
73
+ <tbody>
74
+ <%- @reviews.each do |review| -%>
75
+ <tr id="<%= dom_id review %>">
76
+ <td>
77
+ <% if review.product %>
78
+ <%= link_to review.product.name, product_path(review.product) %>
79
+ <% end %>
80
+ </td>
81
+ <td class="align-center">
82
+ <%= txt_stars(review.rating) %>
83
+ </td>
84
+ <td class="align-center">
85
+ <%= link_to "(#{review.feedback_stars}/#{review.feedback_reviews.size})", admin_review_feedback_reviews_path(review) %>
86
+ </td>
87
+ <td class="align-center">
88
+ <%= review.user_id ? link_to(review.user.try(:email), [:admin, review.user]) : Spree.t(:anonymous) %></p>
89
+ <p><%= Spree::Review.human_attribute_name(:ip_address) %>: <%= review.ip_address ? link_to(review.ip_address, "http://whois.domaintools.com/#{review.ip_address}") : '-' %></p>
90
+ </td>
91
+ <td class="align-center">
92
+ <%= l review.created_at, :format => :short %>
93
+ </td>
94
+ <td class="actions">
95
+ <%= link_to_with_icon 'check', Spree.t('approve'), approve_admin_review_url(review), :no_text => true, class: 'approve' unless review.approved %>
96
+ &nbsp;
97
+ <%= link_to_edit review, :no_text => true, :class => 'edit' %>
98
+ &nbsp;
99
+ <%= link_to_delete review, :no_text => true %>
100
+ </td>
101
+ </tr>
102
+ <% end %>
103
+ </tbody>
104
+ </table>
105
+ <% else %>
106
+ <div class="no-objects-found">
107
+ <%= Spree.t(:no_results) %>
108
+ </div>
109
+ <% end %>
110
+
111
+ <%= paginate @reviews -%>
@@ -0,0 +1,13 @@
1
+ <%= render 'spree/feedback_reviews/summary', :review => review %>
2
+ <%= form_for((@feedback_review ||= review.feedback_reviews.build), :url => feedback_reviews_path(review), :method => :post, :remote => true) do |f| %>
3
+ <% unless @feedback_review.errors.empty? %>
4
+ <span class="error"><%= @feedback_review.errors[:rating] %></span>
5
+ <br />
6
+ <% end %>
7
+ <%= Spree.t(:was_this_review_helpful) %>
8
+ <% for i in 1..NB_STARS %>
9
+ <%= radio_button_tag "feedback_review[rating]",
10
+ Spree.t('star', :count => i), false, :class => "star" %>
11
+ <% end %>
12
+ <button class="feedback-review"><span><%= Spree.t(:say_yes) %></span></button>
13
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <p>
2
+ <%= Spree.t('voice', :count => review.feedback_reviews.count) %>.
3
+ <span title="<%= pluralize(review.feedback_stars, 'star') %> <%= Spree.t('out_of_5') %>">
4
+ <%= render 'spree/reviews/stars', :stars => review.feedback_stars %>
5
+ </span> &nbsp;
6
+ </p>
@@ -0,0 +1,7 @@
1
+ <% if @feedback_review.valid? %>
2
+ $("div#feedback_review_<%= @review.id %>").html("<%= escape_javascript(render('spree/feedback_reviews/summary', :review => @review)) %>");
3
+ <% else %>
4
+ $("div#feedback_review_<%= @review.id %>").html("<%= escape_javascript(render('spree/feedback_reviews/form', :review => @review)) %>");
5
+
6
+ <% end %>
7
+ $(document).ready(function(){$("div#feedback_review_<%= @review.id %>").find(".star").rating({required:true});});
@@ -0,0 +1,34 @@
1
+ <%= form_for review, :url => product_reviews_path(product), :html => {:method => :post} do |f| %>
2
+ <%= render "spree/shared/error_messages", :target => review %>
3
+
4
+ <p class="review_rating_field">
5
+ <%= f.label :rating %> <span class="required">*</span><br />
6
+ <%= render "spree/reviews/stars", :stars => review.rating, :edit_enabled => true %>
7
+ </p>
8
+
9
+ <p class="review_name_field">
10
+ <%= f.label :name %> <span class="required">*</span><br />
11
+ <%= f.text_field :name, :maxlength => "255", :size => "50" %>
12
+ </p>
13
+
14
+ <p class="review_title_field">
15
+ <%= f.label :title %><br />
16
+ <%= f.text_field :title, :maxlength => "255", :size => "50" %>
17
+ </p>
18
+
19
+ <p class="review_review_field">
20
+ <%= f.label :review %> <span class="required">*</span><br />
21
+ <%= f.text_area :review, :wrap => "virtual", :rows => "10", :cols => "50" %>
22
+ </p>
23
+
24
+ <% if Spree::Reviews::Config[:render_show_identifier_checkbox] %>
25
+ <p class="review_show_identifier_field">
26
+ <%= f.label :show_identifier %><br />
27
+ <%= f.check_box :show_identifier, :wrap => "virtual", :rows => "10", :cols => "50", :checked => true %>
28
+ </p>
29
+ <% end %>
30
+
31
+ <p class="review_submit">
32
+ <%= f.submit Spree.t(:submit_your_review), :class => "button bg_darkfirst" %>
33
+ </p>
34
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <% if defined? edit_enabled
2
+ state = ""
3
+ name = "review[rating]"
4
+ else
5
+ state = 'disabled'
6
+ name = defined?(review).nil? ? Time.now.tv_usec.to_s : "review_#{review}"
7
+ end %>
8
+ <% for i in 1..NB_STARS %>
9
+ <input name="<%= name %>"
10
+ type="radio" class="star"
11
+ value="<%= pluralize(i, 'stars') %>" <%= state %>
12
+ <%= "checked" if i == stars %> />
13
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render 'spree/shared/reviews' %>
@@ -0,0 +1,3 @@
1
+ <%= content_tag :h2, Spree.t(:leave_us_a_review_for, :name => @product.name), :class => 'new-review-title' %>
2
+
3
+ <%= render 'form', :review => @review, :product => @product %>
@@ -0,0 +1,15 @@
1
+ <% stars = product.stars %>
2
+ <% reviews_count = product.reviews_count %>
3
+ <div class="ratings">
4
+ <p><%= Spree.t('average_customer_rating') %>: </p>
5
+ <p class="ratings-stars">
6
+ <span title="<%= txt_stars(stars) %>">
7
+ <%= render 'spree/reviews/stars', :stars => stars %>
8
+ </span>
9
+ </p>
10
+ <p class="ratings-basedupon">(<%= Spree.t('based_upon_review_count', :count => reviews_count) %>)</p>
11
+ <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
12
+ <meta itemprop="ratingValue" content="<%= stars %>" />
13
+ <meta itemprop="reviewCount" content="<%= reviews_count %>" />
14
+ </div>
15
+ </div>
@@ -0,0 +1,28 @@
1
+ <div class="review" itemprop="reviews" itemscope itemtype="http://schema.org/Review">
2
+ <span class="reviews-rating" title="<%= txt_stars(review.rating) %>">
3
+ <%= render "spree/reviews/stars", :stars => review.rating %>
4
+ </span>
5
+ <span itemprop="name"><%= review.title %></span>
6
+ <br/>
7
+ <span class="attribution"><%= Spree.t(:submitted_on) %> <strong><%= l review.created_at.to_date %></strong></span>
8
+ <meta itemprop="datePublished" content="<%= review.created_at.to_date.to_s %>" />
9
+
10
+ <meta itemprop="reviewRating" content="<%= review.rating %>" />
11
+ <% if review.show_identifier %>
12
+ <% if Spree::Reviews::Config[:show_email] && review.user %>
13
+ <span itemprop="author"><%= review.user.email %></span>
14
+ <% else %>
15
+ <span itemprop="author"><%= review.name %></span>
16
+ <% end %>
17
+ <% else %>
18
+ <span itemprop="author"><%= Spree.t(:anonymous) %></span>
19
+ <% end %>
20
+ <div itemprop="reviewBody">
21
+ <%= simple_format(review.review) %>
22
+ </div>
23
+ <% if Spree::Reviews::Config[:feedback_rating] && (!Spree::Reviews::Config[:require_login] || spree_current_user) %>
24
+ <div class="feedback_review" id="feedback_review_<%= review.id %>">
25
+ <%= render "spree/feedback_reviews/form", :review => review %>
26
+ </div>
27
+ <% end %>
28
+ </div>
@@ -0,0 +1,9 @@
1
+ <div id="reviews">
2
+ <%= render 'spree/shared/rating', :locals => @product, :review => 0 %>
3
+ <% for review in (Spree::Reviews::Config[:track_locale] ? @product.reviews.localized(I18n.locale) : @product.reviews).default_approval_filter.preview %>
4
+ <%= render 'spree/shared/review', :review => review %>
5
+ <% end %>
6
+ <% if Spree::Reviews::Config[:feedback_rating] && (!Spree::Reviews::Config[:require_login] || spree_current_user) %>
7
+ <%= link_to Spree.t('write_your_own_review'), new_product_review_path(@product), :class => "button" %>
8
+ <% end %>
9
+ </div>
@@ -0,0 +1,15 @@
1
+ <div id="reviews">
2
+ <h6 class="product-section-title"><%= Spree.t(:reviews) %></h6>
3
+ <% if Spree::Reviews::Config[:include_unapproved_reviews] == false and @product.reviews.approved.count == 0 %>
4
+ <p class="reviews-none"><%= Spree.t('no_reviews_available') %></p>
5
+ <% else %>
6
+ <%= render 'spree/shared/rating', :product => @product, :review => 0 %>
7
+ <% for review in (Spree::Reviews::Config[:track_locale] ? @product.reviews.localized(I18n.locale) : @product.reviews).default_approval_filter.preview %>
8
+ <%= render 'spree/shared/review', :review => review %>
9
+ <% end %>
10
+ <% end %>
11
+ <% if !Spree::Reviews::Config[:require_login] || spree_current_user %>
12
+ <%= link_to Spree.t('write_your_own_review'), new_product_review_path(@product), :class => "button",
13
+ :rel => 'nofollow' %>
14
+ <% end %>
15
+ </div>
@@ -0,0 +1,9 @@
1
+ <% stars = product.stars %>
2
+ <% reviews_count = product.reviews_count %>
3
+ <span style="float:left;" title="<%= txt_stars(stars) %>">
4
+ <%= render 'spree/reviews/stars', :stars => stars %>
5
+ </span>
6
+ <span style="float:right;">
7
+ <%= Spree::Review.model_name.human(:count => reviews_count) %>
8
+ </span>
9
+ <br/>
data/bin/rails ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ ENGINE_PATH = File.expand_path('../..', __FILE__)
5
+ load File.expand_path('../../spec/dummy/script/rails', __FILE__)
@@ -0,0 +1 @@
1
+ NB_STARS = 5
@@ -0,0 +1,5 @@
1
+ module Spree
2
+ module Reviews
3
+ Config = Spree::ReviewsConfiguration.new
4
+ end
5
+ end
@@ -0,0 +1,68 @@
1
+ ---
2
+ de-CH:
3
+ activerecord:
4
+ attributes:
5
+ spree/review:
6
+ name: Name
7
+ title: Überschrift
8
+ review: Inhalt
9
+ rating: Bewertung
10
+ created_at: Erstellt am
11
+ ip_address: IP
12
+ user: Benutzer
13
+ locale: Sprache
14
+ models:
15
+ spree/review:
16
+ one: eine Rezension
17
+ other: "%{count} Rezensionen"
18
+ spree:
19
+ approval_status: Freischaltungsstatus
20
+ approve: Freischalten
21
+ approved_reviews: Freigeschaltete Rezensionen
22
+ approved_text: Freigeschalte Kommentare werden innerhalb von 1-2 Werktagen veröffentlicht.
23
+ average_customer_rating: Durchschnittliche Bewertung
24
+ back_reviews: Zurück zu den Rezensionen
25
+ based_upon_review_count:
26
+ one: basiert auf einer Rezension
27
+ other: "basiert auf %{count} Rezensionen"
28
+ by: Von
29
+ editing_review_for_html: 'Rezension über %{link} bearbeiten'
30
+ error_approve_review: Fehler bei der Freischaltung
31
+ error_no_product: Das rezensierte Produkt existiert nicht mehr.
32
+ feedback: Feedback
33
+ feedback_review_for: "Rezension: '%{review}'"
34
+ for: über
35
+ from: aus
36
+ info_approve_review: Die Rezension wurde freigeschaltet.
37
+ leave_us_a_review_for: "Ihre Rezension über %{name}"
38
+ no_reviews_available: "Es sind noch keine Rezensionen für dieses Produkt vorhanden."
39
+ out_of_5: "von 5"
40
+ rating: Bewertung
41
+ reviews: Rezensionen
42
+ admin:
43
+ tab:
44
+ review_management: Rezensionen
45
+ review_successfully_submitted: "Ihre Rezension wurde erfolgreich übertragen. Vielen Dank!"
46
+ spree_reviews:
47
+ feedback_rating: Feedback für Rezensionen erlauben
48
+ include_unapproved: Unveröffentlichte Rezensionen anzeigen
49
+ manage_review_settings: Einstellungen für die Darstellung von Rezensionen
50
+ preview_size: Größe der Vorschau
51
+ require_login: Login erforderlich
52
+ review_settings: Rezensionseinstellungen
53
+ show_email: E-Mail Adressen anzeigen
54
+ track_locale: Sprache des Benutzers tracken
55
+ star:
56
+ one: "ein Sternchen"
57
+ other: "%{count} Sternchen"
58
+ stars: Sternchen
59
+ submit_your_review: Rezension abschicken
60
+ submitted_on: Eingeschickt am
61
+ unapproved_reviews: Nicht freigeschaltete Rezensionen
62
+ voice:
63
+ one: "Eine Stimme"
64
+ other: "%{count} Stimmen"
65
+ was_this_review_helpful: War diese Rezension für Sie hilfreich?
66
+ write_your_own_review: Rezension schreiben
67
+ you_must_enter_value_for_rating: "Bitte geben Sie eine Bewertung an."
68
+ anonymous: Anonym
@@ -0,0 +1,68 @@
1
+ ---
2
+ de:
3
+ activerecord:
4
+ attributes:
5
+ spree/review:
6
+ name: Name
7
+ title: Überschrift
8
+ review: Inhalt
9
+ rating: Bewertung
10
+ created_at: Erstellt am
11
+ ip_address: IP
12
+ user: Benutzer
13
+ locale: Sprache
14
+ models:
15
+ spree/review:
16
+ one: eine Rezension
17
+ other: "%{count} Rezensionen"
18
+ spree:
19
+ approval_status: Freischaltungsstatus
20
+ approve: Freischalten
21
+ approved_reviews: Freigeschaltete Rezensionen
22
+ approved_text: Freigeschalte Kommentare werden innerhalb von 1-2 Werktagen veröffentlicht.
23
+ average_customer_rating: Durchschnittliche Bewertung
24
+ back_reviews: Zurück zu den Rezensionen
25
+ based_upon_review_count:
26
+ one: basiert auf einer Rezension
27
+ other: "basiert auf %{count} Rezensionen"
28
+ by: Von
29
+ editing_review_for_html: 'Rezension über %{link} bearbeiten'
30
+ error_approve_review: Fehler bei der Freischaltung
31
+ error_no_product: Das rezensierte Produkt existiert nicht mehr.
32
+ feedback: Feedback
33
+ feedback_review_for: "Rezension: '%{review}'"
34
+ for: über
35
+ from: aus
36
+ info_approve_review: Die Rezension wurde freigeschaltet.
37
+ leave_us_a_review_for: "Ihre Rezension über %{name}"
38
+ no_reviews_available: "Es sind noch keine Rezensionen für dieses Produkt vorhanden."
39
+ out_of_5: "von 5"
40
+ rating: Bewertung
41
+ reviews: Rezensionen
42
+ admin:
43
+ tab:
44
+ review_management: Rezensionen
45
+ review_successfully_submitted: Ihre Rezension wurde erfolgreich übertragen. Vielen Dank!
46
+ spree_reviews:
47
+ feedback_rating: Feedback für Rezensionen erlauben
48
+ include_unapproved: Unveröffentlichte Rezensionen anzeigen
49
+ manage_review_settings: Einstellungen für die Darstellung von Rezensionen
50
+ preview_size: Größe der Vorschau
51
+ require_login: Login erforderlich
52
+ review_settings: Rezensionseinstellungen
53
+ show_email: E-Mail Adressen anzeigen
54
+ track_locale: Sprache des Benutzers tracken
55
+ star:
56
+ one: "ein Sternchen"
57
+ other: "%{count} Sternchen"
58
+ stars: Sternchen
59
+ submit_your_review: Rezension abschicken
60
+ submitted_on: Eingeschickt am
61
+ unapproved_reviews: Nicht freigeschaltete Rezensionen
62
+ voice:
63
+ one: "Eine Stimme"
64
+ other: "%{count} Stimmen"
65
+ was_this_review_helpful: War diese Rezension für Sie hilfreich?
66
+ write_your_own_review: Rezension schreiben
67
+ you_must_enter_value_for_rating: "Bitte geben Sie eine Bewertung an."
68
+ anonymous: Anonym
@@ -0,0 +1,68 @@
1
+ ---
2
+ en-GB:
3
+ activerecord:
4
+ attributes:
5
+ spree/review:
6
+ name: Your Name
7
+ title: Title
8
+ review: Content
9
+ rating: Rating
10
+ created_at: Date
11
+ ip_address: IP
12
+ user: User
13
+ models:
14
+ spree/review:
15
+ one: one review
16
+ other: "%{count} reviews"
17
+ spree:
18
+ approval_status: Approval status
19
+ approve: Approve
20
+ approved_reviews: Approved
21
+ approved_text: Unlocked comments will be published within 1-2 business days.
22
+ average_customer_rating: Average rating
23
+ back_reviews: Back to the reviews
24
+ based_upon_review_count:
25
+ one: based upon one review
26
+ other: "based upon %{count} reviews"
27
+ by: by
28
+ editing_review_for_html: 'Editing review for %{link}'
29
+ error_approve_review: Error approving review
30
+ error_no_product: The reviewed product doesn't exist anymore
31
+ feedback: Feedback
32
+ feedback_review_for: "Review: '%{review}'"
33
+ for: for
34
+ from: from
35
+ info_approve_review: Review approved
36
+ leave_us_a_review_for: "Please leave us a review and a rating for our '%{name}'"
37
+ no_reviews_available: "No reviews have yet been written for this product."
38
+ out_of_5: "out of 5"
39
+ rating: rating
40
+ reviews: Reviews
41
+ admin:
42
+ tab:
43
+ review_management: Reviews
44
+ review_successfully_submitted: Review was successfully submitted
45
+ spree_reviews:
46
+ feedback_rating: Rate feedback
47
+ include_unapproved: Include unapproved reviews in listings
48
+ manage_review_settings: Control the display of reviews
49
+ preview_size: Size of the review snippets
50
+ require_login: Require user to be logged in
51
+ review_settings: Review Settings
52
+ show_email: Show email addresses
53
+ track_locale: Track user's locale
54
+ star:
55
+ one: "1"
56
+ other: "%{count}"
57
+ stars: Stars
58
+ submit_your_review: Submit your review
59
+ submitted_on: Submitted on
60
+ unapproved_reviews: Unapproved
61
+ voice:
62
+ one: "1 voice"
63
+ other: "%{count} voices"
64
+ was_this_review_helpful: "Was this review helpful to you?"
65
+ write_your_own_review: Write your own review
66
+ you_must_enter_value_for_rating: "You must enter a value for rating."
67
+ anonymous: Anonymous
68
+