solidus_reviews 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +322 -0
  3. data/.travis.yml +27 -14
  4. data/Gemfile +23 -8
  5. data/LICENSE.md +2 -2
  6. data/README.md +9 -11
  7. data/Rakefile +2 -0
  8. data/app/controllers/spree/admin/feedback_reviews_controller.rb +3 -1
  9. data/app/controllers/spree/admin/review_settings_controller.rb +3 -1
  10. data/app/controllers/spree/admin/reviews_controller.rb +9 -6
  11. data/app/controllers/spree/feedback_reviews_controller.rb +25 -19
  12. data/app/controllers/spree/products_controller_decorator.rb +2 -0
  13. data/app/controllers/spree/reviews_controller.rb +11 -7
  14. data/app/helpers/spree/api/api_helpers_decorator.rb +12 -0
  15. data/app/helpers/spree/reviews_helper.rb +15 -5
  16. data/app/models/spree/feedback_review.rb +5 -4
  17. data/app/models/spree/product_decorator.rb +5 -4
  18. data/app/models/spree/review.rb +28 -10
  19. data/app/models/spree/reviews_ability.rb +17 -3
  20. data/app/models/spree/reviews_configuration.rb +16 -8
  21. data/app/models/spree/user_decorator.rb +3 -0
  22. data/app/overrides/add_reviews_after_product_properties.rb +7 -5
  23. data/app/overrides/add_reviews_tab_to_admin.rb +12 -4
  24. data/app/overrides/add_reviews_to_admin_configuration_sidebar.rb +13 -5
  25. data/app/views/spree/admin/feedback_reviews/index.html.erb +9 -9
  26. data/app/views/spree/admin/review_settings/edit.html.erb +64 -35
  27. data/app/views/spree/admin/reviews/_form.html.erb +26 -5
  28. data/app/views/spree/admin/reviews/edit.html.erb +2 -2
  29. data/app/views/spree/admin/reviews/index.html.erb +100 -88
  30. data/app/views/spree/api/reviews/_review.json.jbuilder +8 -0
  31. data/app/views/spree/api/reviews/index.json.jbuilder +6 -0
  32. data/app/views/spree/api/reviews/show.json.jbuilder +3 -0
  33. data/app/views/spree/feedback_reviews/_form.html.erb +5 -5
  34. data/app/views/spree/feedback_reviews/_summary.html.erb +3 -3
  35. data/app/views/spree/feedback_reviews/create.js.erb +2 -2
  36. data/app/views/spree/reviews/_form.html.erb +15 -10
  37. data/app/views/spree/reviews/new.html.erb +2 -2
  38. data/app/views/spree/shared/_rating.html.erb +3 -3
  39. data/app/views/spree/shared/_review.html.erb +29 -19
  40. data/app/views/spree/shared/_review_summary.html.erb +3 -3
  41. data/app/views/spree/shared/_reviews.html.erb +6 -6
  42. data/app/views/spree/shared/_shortrating.html.erb +2 -2
  43. data/bin/rails +4 -2
  44. data/config/initializers/constants.rb +2 -0
  45. data/config/initializers/load_preferences.rb +2 -0
  46. data/config/locales/de-CH.yml +14 -1
  47. data/config/locales/de.yml +14 -1
  48. data/config/locales/en-GB.yml +14 -2
  49. data/config/locales/en.yml +14 -1
  50. data/config/locales/es.yml +14 -2
  51. data/config/locales/fr.yml +14 -2
  52. data/config/locales/it.yml +79 -0
  53. data/config/locales/pl.yml +14 -2
  54. data/config/locales/pt-BR.yml +14 -2
  55. data/config/locales/pt.yml +14 -2
  56. data/config/locales/ro.yml +15 -3
  57. data/config/locales/ru.yml +14 -2
  58. data/config/locales/sv.yml +14 -1
  59. data/config/locales/tr.yml +14 -2
  60. data/config/locales/uk.yml +14 -1
  61. data/config/locales/zh-CN.yml +14 -1
  62. data/config/locales/zh-TW.yml +14 -1
  63. data/config/routes.rb +18 -1
  64. data/db/migrate/20081020220724_create_reviews.rb +4 -2
  65. data/db/migrate/20101222083309_create_feedback_reviews.rb +5 -3
  66. data/db/migrate/20110406083603_add_rating_to_products.rb +7 -5
  67. data/db/migrate/20110606150524_add_user_to_reviews.rb +4 -2
  68. data/db/migrate/20110806093221_add_ip_address_to_reviews.rb +3 -1
  69. data/db/migrate/20120110172331_namespace_tables.rb +3 -1
  70. data/db/migrate/20120123141326_recalculate_ratings.rb +6 -5
  71. data/db/migrate/20120712182514_add_locale_to_reviews.rb +4 -2
  72. data/db/migrate/20120712182627_add_locale_to_feedback_reviews.rb +4 -2
  73. data/db/migrate/20140703200946_add_show_identifier_to_reviews.rb +3 -1
  74. data/db/migrate/20190613165528_add_verified_purchaser_to_reviews.rb +5 -0
  75. data/lib/controllers/spree/api/reviews_controller.rb +111 -0
  76. data/lib/generators/solidus_reviews/install/install_generator.rb +5 -4
  77. data/lib/solidus_reviews.rb +3 -1
  78. data/lib/solidus_reviews/factories.rb +3 -1
  79. data/lib/solidus_reviews/factories/feedback_review_factory.rb +6 -5
  80. data/lib/solidus_reviews/factories/review_factory.rb +19 -9
  81. data/lib/spree_reviews/engine.rb +7 -0
  82. data/solidus_reviews.gemspec +20 -18
  83. data/spec/controllers/admin/feedback_reviews_controller_spec.rb +9 -7
  84. data/spec/controllers/admin/review_settings_controller_spec.rb +18 -16
  85. data/spec/controllers/admin/reviews_controller_spec.rb +18 -16
  86. data/spec/controllers/feedback_reviews_controller_spec.rb +29 -25
  87. data/spec/controllers/products_controller_spec.rb +4 -2
  88. data/spec/controllers/reviews_controller_spec.rb +67 -40
  89. data/spec/controllers/spree/api/reviews_controller_spec.rb +233 -0
  90. data/spec/features/admin_spec.rb +3 -0
  91. data/spec/features/reviews_spec.rb +27 -11
  92. data/spec/helpers/review_helper_spec.rb +3 -2
  93. data/spec/models/feedback_review_spec.rb +19 -17
  94. data/spec/models/product_spec.rb +41 -19
  95. data/spec/models/review_spec.rb +100 -42
  96. data/spec/models/reviews_ability_spec.rb +10 -8
  97. data/spec/models/reviews_configuration_spec.rb +28 -19
  98. data/spec/spec_helper.rb +21 -35
  99. data/vendor/assets/javascripts/jquery.rating.js +389 -376
  100. metadata +108 -59
@@ -1,5 +1,13 @@
1
- Deface::Override.new(:virtual_path => "spree/admin/shared/_configuration_menu",
2
- :name => "converted_admin_configurations_menu",
3
- :insert_bottom => "[data-hook='admin_configurations_sidebar_menu'], #admin_configurations_sidebar_menu[data-hook]",
4
- :text => "<%= configurations_sidebar_menu_item Spree.t('spree_reviews.review_settings'), edit_admin_review_settings_path %>",
5
- :disabled => false)
1
+ # frozen_string_literal: true
2
+
3
+ Spree::Backend::Config.configure do |config|
4
+ config.menu_items.detect { |menu_item|
5
+ menu_item.label == :settings
6
+ }.sections << :review_settings
7
+ end
8
+
9
+ Deface::Override.new(virtual_path: "spree/admin/shared/_settings_sub_menu",
10
+ name: "converted_admin_configurations_menu",
11
+ insert_bottom: "[data-hook='admin_settings_sub_tabs']",
12
+ text: "<%= tab :reviews, url: spree.edit_admin_review_settings_path, match_path: /review_settings/ %>",
13
+ disabled: false)
@@ -1,9 +1,9 @@
1
1
  <% content_for :page_title do %>
2
- <%= Spree.t('feedback_review_for', :review => @review.title) %>
2
+ <%= I18n.t("spree.feedback_review_for", review: @review.title) %>
3
3
  <% end %>
4
4
 
5
5
  <% content_for :page_actions do %>
6
- <li><%= button_link_to Spree.t(:back_to_reviews), admin_reviews_path, { :icon => 'icon-arrow-left' } %></li>
6
+ <li><%= link_to I18n.t("spree.back_to_reviews"), admin_reviews_path %></li>
7
7
  <% end %>
8
8
 
9
9
  <% render 'spree/admin/shared/product_sub_menu' %>
@@ -18,20 +18,20 @@
18
18
  </colgroup>
19
19
  <thead>
20
20
  <tr>
21
- <th><%= Spree.t('user') %></th>
22
- <th><%= Spree.t('stars') %></th>
23
- <th><%= Spree.t('date') %></th>
24
- <th></th>
21
+ <th><%= I18n.t("spree.user") %></th>
22
+ <th><%= I18n.t("spree.stars") %></th>
23
+ <th><%= I18n.t("spree.date") %></th>
24
+ <th class="actions"></th>
25
25
  </tr>
26
26
  </thead>
27
27
  <tbody>
28
28
  <%- @collection.each do |feedback| -%>
29
29
  <tr id="<%= dom_id(feedback) %>">
30
30
  <td><%= l feedback.created_at %></td>
31
- <td><%= feedback.user.try(:login) || Spree.t(:anonymous) %></td>
31
+ <td><%= feedback.user.try(:login) || I18n.t("spree.anonymous") %></td>
32
32
  <td><%= feedback.rating %></td>
33
33
  <td class="actions">
34
- <%= link_to_delete feedback, :no_text => true %>
34
+ <%= link_to_delete feedback, no_text: true %>
35
35
  </td>
36
36
  </tr>
37
37
  <% end %>
@@ -39,6 +39,6 @@
39
39
  </table>
40
40
  <% else %>
41
41
  <div class="no-objects-found">
42
- <%= Spree.t(:no_results) %>
42
+ <%= I18n.t("spree.no_results") %>
43
43
  </div>
44
44
  <% end %>
@@ -1,40 +1,69 @@
1
- <%= render 'spree/admin/shared/configuration_menu' %>
2
-
3
1
  <% content_for :page_title do %>
4
- <%= Spree.t("spree_reviews.review_settings") %>
2
+ <%= I18n.t("spree.spree_reviews.review_settings") %>
3
+ <% end %>
4
+
5
+ <% admin_breadcrumb(I18n.t("spree.settings")) %>
6
+
7
+ <% content_for :tabs do %>
8
+ <nav>
9
+ <ul class="tabs">
10
+ <%= settings_tab_item I18n.t("spree.spree_reviews.review_settings"), spree.admin_review_settings_path %>
11
+ </ul>
12
+ </nav>
5
13
  <% end %>
6
14
 
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>
15
+ <%= form_tag(admin_review_settings_path, method: :put) do %>
16
+ <fieldset class="no-border-top">
17
+ <div class="field">
18
+ <label>
19
+ <%= check_box_tag('preferences[include_unapproved_reviews]', "1", Spree::Reviews::Config[:include_unapproved_reviews]) %>
20
+ <%= I18n.t("spree.spree_reviews.include_unapproved") %>
21
+ </label>
22
+ </div>
23
+ <div class="field">
24
+ <label>
25
+ <%= check_box_tag('preferences[display_unapproved_reviews]', "1", Spree::Reviews::Config[:display_unapproved_reviews]) %>
26
+ <%= I18n.t("spree.spree_reviews.display_unapproved") %>
27
+ </label>
28
+ </div>
29
+ <div class="field">
30
+ <label>
31
+ <%= check_box_tag('preferences[feedback_rating]', "1", Spree::Reviews::Config[:feedback_rating]) %>
32
+ <%= I18n.t("spree.spree_reviews.feedback_rating") %>
33
+ </label>
34
+ </div>
35
+ <div class="field">
36
+ <label>
37
+ <%= check_box_tag('preferences[show_email]', "1", Spree::Reviews::Config[:show_email]) %>
38
+ <%= I18n.t("spree.spree_reviews.show_email") %>
39
+ </label>
40
+ </div>
41
+ <div class="field">
42
+ <label>
43
+ <%= check_box_tag('preferences[show_verified_purchaser]', "1", Spree::Reviews::Config[:show_verified_purchaser]) %>
44
+ <%= I18n.t("spree.spree_reviews.show_verified_purchaser") %>
45
+ </label>
46
+ </div>
47
+ <div class="field">
48
+ <label>
49
+ <%= check_box_tag('preferences[require_login]', "1", Spree::Reviews::Config[:require_login]) %>
50
+ <%= I18n.t("spree.spree_reviews.require_login") %>
51
+ </label>
52
+ </div>
53
+ <div class="field">
54
+ <label>
55
+ <%= check_box_tag('preferences[track_locale]', "1", Spree::Reviews::Config[:track_locale]) %>
56
+ <%= I18n.t("spree.spree_reviews.track_locale") %>
57
+ </label>
58
+ </div>
59
+ <div class="field">
60
+ <label><%= I18n.t("spree.spree_reviews.preview_size") %></label><br>
61
+ <%= text_field_tag('preferences[preview_size]', Spree::Reviews::Config[:preview_size], size: 3) %>
62
+ </div>
33
63
 
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>
64
+ <div class="form-buttons filter-actions actions" data-hook="buttons">
65
+ <%= button_tag I18n.t("spree.actions.update") %>
66
+ <%= link_to I18n.t("spree.actions.cancel"), edit_admin_general_settings_url, class: 'button' %>
67
+ </div>
68
+ </fieldset>
40
69
  <% end %>
@@ -1,22 +1,43 @@
1
- <%= render "spree/shared/error_messages", :target => @review %>
1
+ <%= render "spree/shared/error_messages", target: @review %>
2
2
  <%= f.field_container :name do %>
3
3
  <%= f.label :name %><br />
4
- <%= f.text_field :name, :maxlength => "255", :size => "60" %>
4
+ <%= f.text_field :name, maxlength: "255", size: "60" %>
5
+ <% end %>
6
+
7
+ <%= f.field_container :email do %>
8
+ <%= f.label :email %><br />
9
+ <%= mail_to @review.email %>
5
10
  <% end %>
6
11
 
7
12
  <%= f.field_container :title do %>
8
13
  <%= f.label :title %><br />
9
- <%= f.text_field :title, :maxlength => "255", :size => "60" %>
14
+ <%= f.text_field :title, maxlength: "255", size: "60" %>
10
15
  <% end %>
11
16
 
12
17
  <%= f.field_container :review do %>
13
18
  <%= f.label :review %><br />
14
- <%= f.text_area :review, :wrap => "virtual", :rows => "10", :cols => "60" %>
19
+ <%= f.text_area :review, wrap: "virtual", rows: "10", cols: "60" %>
20
+ <% end %>
21
+
22
+ <%= f.field_container :images do %>
23
+ <%= f.label :images %>
24
+ <table>
25
+ <% @review.images.each do |image| %>
26
+ <tr>
27
+ <td>
28
+ <%= image_tag image.url(:original) %>
29
+ </td>
30
+ <td>
31
+ <%= link_to_delete image, url: admin_review_image_url(@review, image, product_id: @review.product), no_text: true %>
32
+ </td>
33
+ </tr>
34
+ <% end %>
35
+ </table>
15
36
  <% end %>
16
37
 
17
38
  <% if Spree::Reviews::Config[:track_locale] %>
18
39
  <%= f.field_container :locale do %>
19
40
  <%= f.label :locale %><br />
20
- <%= f.select :locale, I18n.available_locales.map { |lc| [t(lc, :default => lc.to_s), lc.to_s] } %>
41
+ <%= f.select :locale, I18n.available_locales.map { |lc| [t(lc, default: lc.to_s), lc.to_s] } %>
21
42
  <% end %>
22
43
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :page_title do %>
2
- <%= Spree.t(:editing_review_for_html, :link => link_to(@review.product.name, product_path(@review.product))) %>
2
+ <%= I18n.t("spree.editing_review_for_html", link: link_to(@review.product.name, product_path(@review.product))) %>
3
3
  <% end %>
4
4
 
5
5
  <% render 'spree/admin/shared/product_sub_menu' %>
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
 
17
17
  <div class="omega eight columns">
18
- <%= render 'form', :f => f %>
18
+ <%= render 'form', f: f %>
19
19
  </div>
20
20
 
21
21
  <div class="clear"></div>
@@ -1,111 +1,123 @@
1
+ <% admin_breadcrumb(link_to plural_resource_name(Spree::Product), spree.admin_products_path) %>
2
+
1
3
  <% content_for :page_title do %>
2
- <%= Spree.t('reviews') %>
4
+ <%= I18n.t("spree.reviews") %>
3
5
  <% end %>
4
6
 
5
- <% render 'spree/admin/shared/product_sub_menu' %>
6
-
7
7
  <% content_for :table_filter_title do %>
8
- <%= Spree.t('search') %>
8
+ <%= I18n.t("spree.search") %>
9
9
  <% end %>
10
10
 
11
11
  <% content_for :table_filter do %>
12
12
  <div data-hook="admin_reviews_index_search">
13
-
14
13
  <%= 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>
14
+ <div class="alpha three columns">
15
+ <div class="field">
16
+ <%= f.label :name_cont, I18n.t("spree.user") %><br />
17
+ <%= f.text_field :name_cont, class: 'fullwidth' %>
18
+ </div>
19
+ </div>
21
20
 
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>
21
+ <div class="seven columns">
22
+ <div class="field">
23
+ <%= f.label :title_cont, I18n.t("spree.title") -%><br/>
24
+ <%= f.text_field :title_cont, class: 'fullwidth' -%>
25
+ </div>
26
+ </div>
28
27
 
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>
28
+ <div class="four columns">
29
+ <div class="field">
30
+ <%= f.label :review_cont, I18n.t("spree.review") -%><br/>
31
+ <%= f.text_field :review_cont, class: 'fullwidth' -%>
32
+ </div>
33
+ </div>
35
34
 
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>
35
+ <div class="two columns omega">
36
+ <div class="field">
37
+ <%= f.label :approved_eq, I18n.t("spree.approval_status")-%><br/>
38
+ <%= f.select :approved_eq, [
39
+ [I18n.t("spree.all"), nil],
40
+ [I18n.t("spree.approved_reviews"), true],
41
+ [I18n.t("spree.unapproved_reviews"), false]
42
+ ], {}, class: 'select2 fullwidth' -%>
43
+ </div>
44
+ </div>
42
45
 
43
- <div class="clear"></div>
46
+ <div class="clear"></div>
44
47
 
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
+ <div class="form-buttons actions filter-actions" data-hook="admin_reviews_index_search_buttons">
49
+ <%= button_tag I18n.t("spree.search") %>
50
+ </div>
48
51
  <%- end -%>
49
52
  </div>
50
53
  <%- end -%>
51
54
 
52
- <% paginate @reviews %>
55
+ <%= paginate @reviews, theme: "solidus_admin" %>
53
56
 
54
57
  <% 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>
58
+ <table class="index">
59
+ <colgroup>
60
+ <col style="width: 20%;">
61
+ <col style="width: 10%;">
62
+ <col style="width: 10%;">
63
+ <col style="width: 15%;">
64
+ <col style="width: 15%;">
65
+ <col style="width: 15%;">
66
+ <col style="width: 17%;">
67
+ </colgroup>
68
+ <thead>
69
+ <tr>
70
+ <th><%= I18n.t("spree.product") %></th>
71
+ <th><%= "#{Spree::Review.human_attribute_name(:rating)}/#{I18n.t("spree.feedback")}" %></th>
72
+ <th><%= I18n.t("spree.verified_purchaser") %></th>
73
+ <th><%= Spree::Review.human_attribute_name(:user) %></th>
74
+ <th><%= Spree::Review.human_attribute_name(:created_at) %></th>
75
+ <th><%= Spree::Review.human_attribute_name(:images) %></th>
76
+ <th class="actions"></th>
77
+ </tr>
78
+ </thead>
79
+ <tbody>
80
+ <%- @reviews.each do |review| -%>
81
+ <tr id="<%= dom_id review %>">
82
+ <td>
83
+ <% if review.product %>
84
+ <%= link_to review.product.name, product_path(review.product) %>
85
+ <% end %>
86
+ </td>
87
+ <td class="align-center">
88
+ <%= txt_stars(review.rating) %><br />
89
+ <%= link_to "(#{review.feedback_stars}/#{review.feedback_reviews.size})", admin_review_feedback_reviews_path(review) %>
90
+ </td>
91
+ <td class="align-center">
92
+ <% if review.verified_purchaser? %>
93
+ <%= solidus_icon('fa fa-check') %>
94
+ <% end %>
95
+ </td>
96
+ <td class="align-center">
97
+ <%= review.user_id ? link_to(review.user.try(:email), [:admin, review.user]) : I18n.t("spree.anonymous") %></p>
98
+ <p><%= Spree::Review.human_attribute_name(:ip_address) %>: <%= review.ip_address ? link_to(review.ip_address, "http://whois.domaintools.com/#{review.ip_address}") : '-' %></p>
99
+ </td>
100
+ <td class="align-center">
101
+ <%= l review.created_at, format: :short %>
102
+ </td>
103
+ <td class="align-center">
104
+ <% review.images.each do |image| %>
105
+ <%= link_to image_tag(image.url(:product)), image.url(:original) %>
106
+ <% end %>
107
+ </td>
108
+ <td class="actions">
109
+ <%= link_to_with_icon 'ok', I18n.t("spree.approve"), approve_admin_review_url(review), no_text: true, class: 'approve' unless review.approved %>
110
+ <%= link_to_edit review, no_text: true, class: 'edit' %>
111
+ <%= link_to_delete review, no_text: true %>
112
+ </td>
113
+ </tr>
114
+ <% end %>
115
+ </tbody>
116
+ </table>
105
117
  <% else %>
106
- <div class="no-objects-found">
107
- <%= Spree.t(:no_results) %>
108
- </div>
118
+ <div class="no-objects-found">
119
+ <%= I18n.t("spree.no_results") %>
120
+ </div>
109
121
  <% end %>
110
122
 
111
- <%= paginate @reviews -%>
123
+ <%= paginate @reviews, theme: "solidus_admin" -%>
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ json.cache! [I18n.locale, review] do
4
+ json.(review, *review_attributes)
5
+ json.images(review.images) do |image|
6
+ json.partial!("spree/api/images/image", image: image)
7
+ end
8
+ end