solidus_reviews 1.2.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +6 -0
  3. data/.gem_release.yml +5 -0
  4. data/.gitignore +13 -6
  5. data/.rspec +1 -1
  6. data/.rubocop.yml +3 -321
  7. data/.rubocop_todo.yml +197 -0
  8. data/CHANGELOG.md +155 -0
  9. data/Gemfile +14 -17
  10. data/{LICENSE.md → LICENSE} +1 -1
  11. data/README.md +63 -41
  12. data/Rakefile +3 -20
  13. data/app/assets/stylesheets/spree/frontend/solidus_reviews.css +4 -0
  14. data/app/controllers/spree/feedback_reviews_controller.rb +2 -8
  15. data/app/controllers/spree/reviews_controller.rb +29 -2
  16. data/app/decorators/controllers/solidus_reviews/spree/{admin/products_controller_decorator.rb → products_controller_decorator.rb} +0 -4
  17. data/app/decorators/models/solidus_reviews/spree/product_decorator.rb +6 -5
  18. data/app/helpers/spree/reviews_helper.rb +6 -6
  19. data/app/models/spree/feedback_review.rb +2 -2
  20. data/app/models/spree/permission_sets/review_display.rb +11 -0
  21. data/app/models/spree/permission_sets/review_management.rb +11 -0
  22. data/app/models/spree/review.rb +25 -10
  23. data/app/models/spree/reviews_ability.rb +7 -2
  24. data/app/models/spree/reviews_configuration.rb +10 -1
  25. data/app/overrides/add_reviews_tab_to_admin.rb +12 -4
  26. data/app/overrides/add_reviews_to_admin_configuration_sidebar.rb +12 -5
  27. data/app/views/spree/admin/review_settings/edit.html.erb +7 -0
  28. data/app/views/spree/admin/reviews/edit.html.erb +4 -2
  29. data/app/views/spree/admin/reviews/index.html.erb +9 -5
  30. data/app/views/spree/api/reviews/_feedback_review.json.jbuilder +1 -1
  31. data/app/views/spree/api/reviews/_review.json.jbuilder +1 -1
  32. data/app/views/spree/reviews/_form.html.erb +6 -4
  33. data/app/views/spree/reviews/edit.html.erb +3 -0
  34. data/app/views/spree/shared/_review.html.erb +6 -4
  35. data/bin/console +17 -0
  36. data/bin/rails +5 -5
  37. data/bin/rails-engine +13 -0
  38. data/bin/rails-sandbox +16 -0
  39. data/bin/rake +7 -0
  40. data/bin/sandbox +86 -0
  41. data/bin/setup +8 -0
  42. data/config/locales/de-CH.yml +1 -1
  43. data/config/locales/de.yml +1 -1
  44. data/config/locales/en-GB.yml +2 -1
  45. data/config/locales/en.yml +2 -1
  46. data/config/locales/es.yml +2 -1
  47. data/config/locales/fr.yml +1 -1
  48. data/config/locales/it.yml +1 -1
  49. data/config/locales/pl.yml +1 -1
  50. data/config/locales/pt-BR.yml +1 -1
  51. data/config/locales/pt.yml +1 -1
  52. data/config/locales/ro.yml +1 -1
  53. data/config/locales/sv.yml +1 -1
  54. data/config/locales/tr.yml +1 -1
  55. data/config/locales/uk.yml +1 -1
  56. data/config/locales/zh-CN.yml +1 -1
  57. data/config/locales/zh-TW.yml +1 -1
  58. data/config/routes.rb +3 -1
  59. data/db/migrate/20120123141326_recalculate_ratings.rb +1 -2
  60. data/db/migrate/20190613165528_add_verified_purchaser_to_reviews.rb +2 -0
  61. data/lib/controllers/spree/api/feedback_reviews_controller.rb +91 -0
  62. data/lib/controllers/spree/api/reviews_controller.rb +16 -14
  63. data/lib/generators/solidus_reviews/install/install_generator.rb +8 -7
  64. data/lib/solidus_reviews/engine.rb +26 -0
  65. data/lib/solidus_reviews/version.rb +5 -0
  66. data/lib/solidus_reviews.rb +4 -4
  67. data/solidus_reviews.gemspec +31 -34
  68. data/spec/controllers/spree/admin/feedback_reviews_controller_spec.rb +1 -1
  69. data/spec/controllers/spree/admin/review_settings_controller_spec.rb +3 -4
  70. data/spec/controllers/spree/admin/reviews_controller_spec.rb +3 -3
  71. data/spec/controllers/spree/api/feedback_reviews_controller_spec.rb +136 -0
  72. data/spec/controllers/spree/api/reviews_controller_spec.rb +27 -25
  73. data/spec/controllers/spree/feedback_reviews_controller_spec.rb +8 -8
  74. data/spec/controllers/spree/reviews_controller_spec.rb +145 -8
  75. data/spec/features/admin_spec.rb +6 -6
  76. data/spec/features/reviews_spec.rb +33 -32
  77. data/spec/fixtures/thinking-cat.jpg +0 -0
  78. data/spec/models/feedback_review_spec.rb +13 -13
  79. data/spec/models/product_spec.rb +13 -10
  80. data/spec/models/review_spec.rb +64 -41
  81. data/spec/models/reviews_ability_spec.rb +14 -14
  82. data/spec/models/reviews_configuration_spec.rb +21 -10
  83. data/spec/spec_helper.rb +18 -13
  84. data/spec/support/config.rb +7 -0
  85. data/spec/support/factories.rb +3 -0
  86. metadata +52 -213
  87. data/CONTRIBUTING.md +0 -28
  88. data/lib/spree_reviews/engine.rb +0 -22
  89. data/spec/controllers/spree/products_controller_spec.rb +0 -11
@@ -7,11 +7,16 @@ class Spree::ReviewsAbility
7
7
  review_ability_class = self.class
8
8
 
9
9
  can :create, Spree::Review do |_review|
10
- review_ability_class.allow_anonymous_reviews? || !user.email.blank?
10
+ review_ability_class.allow_anonymous_reviews? || user.email.present?
11
11
  end
12
12
 
13
13
  can :create, Spree::FeedbackReview do |_review|
14
- review_ability_class.allow_anonymous_reviews? || !user.email.blank?
14
+ review_ability_class.allow_anonymous_reviews? || user.email.present?
15
+ end
16
+
17
+ # You can only change your own feedback_review
18
+ can [:update, :destroy], Spree::FeedbackReview do |feedback_review|
19
+ feedback_review.user == user
15
20
  end
16
21
 
17
22
  # You can read your own reviews, and everyone can read approved ones
@@ -2,7 +2,7 @@
2
2
 
3
3
  class Spree::ReviewsConfiguration < Spree::Preferences::Configuration
4
4
  def self.boolean_preferences
5
- %w(display_unapproved_reviews include_unapproved_reviews feedback_rating show_email require_login track_locale)
5
+ %w(display_unapproved_reviews include_unapproved_reviews feedback_rating show_email require_login track_locale allow_image_upload)
6
6
  end
7
7
 
8
8
  # include non-approved reviews in (public) listings
@@ -31,4 +31,13 @@ class Spree::ReviewsConfiguration < Spree::Preferences::Configuration
31
31
 
32
32
  # render checkbox for a user to approve to show their identifier (name or email) on their review
33
33
  preference :render_show_identifier_checkbox, :boolean, default: false
34
+
35
+ # Approves star only reviews automatically (Reviews without a Title/Review)
36
+ preference :approve_star_only, :boolean, default: false
37
+
38
+ # Approves star only reviews for verified purchasers only.
39
+ preference :approve_star_only_for_verified_purchaser, :boolean, default: false
40
+
41
+ # allow customer to update image with the review
42
+ preference :allow_image_upload, :boolean, default: true
34
43
  end
@@ -6,7 +6,15 @@ Spree::Backend::Config.configure do |config|
6
6
  }.sections << :reviews
7
7
  end
8
8
 
9
- Deface::Override.new(virtual_path: "spree/admin/shared/_product_sub_menu",
10
- name: "reviews_admin_tab",
11
- insert_bottom: "[data-hook='admin_product_sub_tabs']",
12
- text: "<%= tab(:reviews, label: 'review_management') %>")
9
+ Deface::Override.new(
10
+ virtual_path: "spree/admin/shared/_product_sub_menu",
11
+ name: "reviews_admin_tab",
12
+ insert_bottom: "[data-hook='admin_product_sub_tabs']",
13
+ disabled: false
14
+ ) do
15
+ <<-HTML
16
+ <% if can? :admin, Spree::Review %>
17
+ <%= tab(:reviews, label: 'review_management') %>
18
+ <% end %>
19
+ HTML
20
+ end
@@ -6,8 +6,15 @@ Spree::Backend::Config.configure do |config|
6
6
  }.sections << :review_settings
7
7
  end
8
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)
9
+ Deface::Override.new(
10
+ virtual_path: "spree/admin/shared/_settings_sub_menu",
11
+ name: "converted_admin_configurations_menu",
12
+ insert_bottom: "[data-hook='admin_settings_sub_tabs']",
13
+ disabled: false
14
+ ) do
15
+ <<-HTML
16
+ <% if can? :admin, Spree::ReviewsConfiguration %>
17
+ <%= tab :reviews, url: spree.edit_admin_review_settings_path, match_path: /review_settings/ %>
18
+ <% end %>
19
+ HTML
20
+ end
@@ -56,6 +56,13 @@
56
56
  <%= I18n.t("spree.spree_reviews.track_locale") %>
57
57
  </label>
58
58
  </div>
59
+ <div class="field">
60
+ <label>
61
+ <%= check_box_tag('preferences[allow_image_upload]', "1", Spree::Reviews::Config[:allow_image_upload]) %>
62
+ <%= I18n.t("spree.spree_reviews.allow_image_upload") %>
63
+ </label>
64
+ </div>
65
+
59
66
  <div class="field">
60
67
  <label><%= I18n.t("spree.spree_reviews.preview_size") %></label><br>
61
68
  <%= text_field_tag('preferences[preview_size]', Spree::Reviews::Config[:preview_size], size: 3) %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :page_title do %>
2
- <%= I18n.t("spree.editing_review_for_html", link: link_to(@review.product.name, product_path(@review.product))) %>
2
+ <%= I18n.t("spree.editing_review_for_html", product_name: @review.product.name) %>
3
3
  <% end %>
4
4
 
5
5
  <% render 'spree/admin/shared/product_sub_menu' %>
@@ -21,6 +21,8 @@
21
21
  <div class="clear"></div>
22
22
 
23
23
  <fieldset class="no-border-top">
24
- <%= render 'spree/admin/shared/edit_resource_links' %>
24
+ <% if can? :manage, Spree::Review %>
25
+ <%= render 'spree/admin/shared/edit_resource_links' %>
26
+ <% end %>
25
27
  </fieldset>
26
28
  <% end %>
@@ -5,7 +5,9 @@
5
5
  <% end %>
6
6
 
7
7
  <% content_for :table_filter_title do %>
8
- <%= I18n.t("spree.search") %>
8
+ <% if can? :display, Spree::Review %>
9
+ <%= I18n.t("spree.search") %>
10
+ <% end %>
9
11
  <% end %>
10
12
 
11
13
  <% content_for :table_filter do %>
@@ -94,7 +96,7 @@
94
96
  <% end %>
95
97
  </td>
96
98
  <td class="align-center">
97
- <%= review.user_id ? link_to(review.user.try(:email), [:admin, review.user]) : I18n.t("spree.anonymous") %></p>
99
+ <p><%= review.user_id ? link_to(review.user.try(:email), [:admin, review.user]) : I18n.t("spree.anonymous") %></p>
98
100
  <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
101
  </td>
100
102
  <td class="align-center">
@@ -106,9 +108,11 @@
106
108
  <% end %>
107
109
  </td>
108
110
  <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 %>
111
+ <% if can? :manage, Spree::Review %>
112
+ <%= link_to_with_icon 'ok', I18n.t("spree.approve"), approve_admin_review_url(review), no_text: true, class: 'approve' unless review.approved %>
113
+ <%= link_to_edit review, no_text: true, class: 'edit' %>
114
+ <%= link_to_delete review, no_text: true %>
115
+ <% end %>
112
116
  </td>
113
117
  </tr>
114
118
  <% end %>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  json.cache! [I18n.locale, feedback_review] do
4
- json.(feedback_review, *feedback_review_attributes)
4
+ json.call(feedback_review, *feedback_review_attributes)
5
5
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  json.cache! [I18n.locale, review] do
4
- json.(review, *review_attributes)
4
+ json.call(review, *review_attributes)
5
5
  json.images(review.images) do |image|
6
6
  json.partial!("spree/api/images/image", image: image)
7
7
  end
@@ -21,10 +21,12 @@
21
21
  <%= f.text_area :review, wrap: "virtual", rows: "10", cols: "50" %>
22
22
  </p>
23
23
 
24
- <p class="review_images_field">
25
- <%= f.label :images %><br>
26
- <%= f.file_field :images, :accept => "image/*", multiple: true %>
27
- </p>
24
+ <% if Spree::Reviews::Config[:allow_image_upload] %>
25
+ <p class="review_images_field">
26
+ <%= f.label :images %><br>
27
+ <%= f.file_field :images, :accept => "image/*", multiple: true %>
28
+ </p>
29
+ <% end %>
28
30
 
29
31
  <% if Spree::Reviews::Config[:render_show_identifier_checkbox] %>
30
32
  <p class="review_show_identifier_field">
@@ -0,0 +1,3 @@
1
+ <%= content_tag :h2, I18n.t("spree.leave_us_a_review_for", name: @product.name), class: 'new-review-title' %>
2
+
3
+ <%= render 'form', review: @review, product: @product %>
@@ -24,10 +24,12 @@
24
24
  <div itemprop="reviewBody">
25
25
  <%= simple_format(review.review) %>
26
26
  </div>
27
- <% review.images.each do |image| %>
28
- <div itemprop="image">
29
- <%= link_to image_tag(image.url(:product)), image.url(:original) %>
30
- </div>
27
+ <% if Spree::Reviews::Config[:allow_image_upload] %>
28
+ <% review.images.each do |image| %>
29
+ <div itemprop="image">
30
+ <%= link_to image_tag(image.url(:product)), image.url(:original) %>
31
+ </div>
32
+ <% end %>
31
33
  <% end %>
32
34
  <% if Spree::Reviews::Config[:feedback_rating] && (!Spree::Reviews::Config[:require_login] || spree_current_user) %>
33
35
  <div class="feedback_review" id="feedback_review_<%= review.id %>">
data/bin/console ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require "bundler/setup"
6
+ require "solidus_reviews"
7
+
8
+ # You can add fixtures and/or initialization code here to make experimenting
9
+ # with your gem easier. You can also use a different console, if you like.
10
+ $LOAD_PATH.unshift(*Dir["#{__dir__}/../app/*"])
11
+
12
+ # (If you use this, don't forget to add pry to your Gemfile!)
13
+ # require "pry"
14
+ # Pry.start
15
+
16
+ require "irb"
17
+ IRB.start(__FILE__)
data/bin/rails CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
2
 
4
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
5
-
6
- ENGINE_PATH = File.expand_path('..', __dir__)
7
- load File.expand_path('../spec/dummy/script/rails', __dir__)
3
+ if %w[g generate].include? ARGV.first
4
+ exec "#{__dir__}/rails-engine", *ARGV
5
+ else
6
+ exec "#{__dir__}/rails-sandbox", *ARGV
7
+ end
data/bin/rails-engine ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path('..', __dir__)
6
+ ENGINE_PATH = File.expand_path('../lib/solidus_reviews/engine', __dir__)
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
10
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
11
+
12
+ require 'rails/all'
13
+ require 'rails/engine/commands'
data/bin/rails-sandbox ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ app_root = 'sandbox'
4
+
5
+ unless File.exist? "#{app_root}/bin/rails"
6
+ warn 'Creating the sandbox app...'
7
+ Dir.chdir "#{__dir__}/.." do
8
+ system "#{__dir__}/sandbox" or begin
9
+ warn 'Automatic creation of the sandbox app failed'
10
+ exit 1
11
+ end
12
+ end
13
+ end
14
+
15
+ Dir.chdir app_root
16
+ exec 'bin/rails', *ARGV
data/bin/rake ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "rubygems"
5
+ require "bundler/setup"
6
+
7
+ load Gem.bin_path("rake", "rake")
data/bin/sandbox ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ case "$DB" in
6
+ postgres|postgresql)
7
+ RAILSDB="postgresql"
8
+ ;;
9
+ mysql)
10
+ RAILSDB="mysql"
11
+ ;;
12
+ sqlite|'')
13
+ RAILSDB="sqlite3"
14
+ ;;
15
+ *)
16
+ echo "Invalid DB specified: $DB"
17
+ exit 1
18
+ ;;
19
+ esac
20
+
21
+ if [ ! -z $SOLIDUS_BRANCH ]
22
+ then
23
+ BRANCH=$SOLIDUS_BRANCH
24
+ else
25
+ BRANCH="master"
26
+ fi
27
+
28
+ extension_name="solidus_reviews"
29
+
30
+ # Stay away from the bundler env of the containing extension.
31
+ function unbundled {
32
+ ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- $@
33
+ }
34
+
35
+ rm -rf ./sandbox
36
+ unbundled bundle exec rails new sandbox --database="$RAILSDB" \
37
+ --skip-bundle \
38
+ --skip-git \
39
+ --skip-keeps \
40
+ --skip-rc \
41
+ --skip-spring \
42
+ --skip-test \
43
+ --skip-javascript
44
+
45
+ if [ ! -d "sandbox" ]; then
46
+ echo 'sandbox rails application failed'
47
+ exit 1
48
+ fi
49
+
50
+ cd ./sandbox
51
+ cat <<RUBY >> Gemfile
52
+ gem 'solidus', github: 'solidusio/solidus', branch: '$BRANCH'
53
+ gem 'solidus_auth_devise', '>= 2.1.0'
54
+ gem 'rails-i18n'
55
+ gem 'solidus_i18n'
56
+
57
+ gem '$extension_name', path: '..'
58
+
59
+ group :test, :development do
60
+ platforms :mri do
61
+ gem 'pry-byebug'
62
+ end
63
+ end
64
+ RUBY
65
+
66
+ unbundled bundle install --gemfile Gemfile
67
+
68
+ unbundled bundle exec rake db:drop db:create
69
+
70
+ unbundled bundle exec rails generate spree:install \
71
+ --auto-accept \
72
+ --user_class=Spree::User \
73
+ --enforce_available_locales=true \
74
+ --with-authentication=false \
75
+ --payment-method=none
76
+ $@
77
+
78
+ unbundled bundle exec rails generate solidus:auth:install
79
+ unbundled bundle exec rails generate ${extension_name}:install
80
+
81
+ echo
82
+ echo "🚀 Sandbox app successfully created for $extension_name!"
83
+ echo "🚀 Using $RAILSDB and Solidus $BRANCH"
84
+ echo "🚀 Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter"
85
+ echo "🚀 Use 'export SOLIDUS_BRANCH=<BRANCH-NAME>' to control the Solidus version"
86
+ echo "🚀 This app is intended for test purposes."
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ gem install bundler --conservative
7
+ bundle update
8
+ bin/rake clobber
@@ -36,7 +36,7 @@ de-CH:
36
36
  one: basiert auf einer Rezension
37
37
  other: "basiert auf %{count} Rezensionen"
38
38
  by: Von
39
- editing_review_for_html: 'Rezension über %{link} bearbeiten'
39
+ editing_review_for_html: 'Rezension über %{product_name} bearbeiten'
40
40
  error_approve_review: Fehler bei der Freischaltung
41
41
  error_no_product: Das rezensierte Produkt existiert nicht mehr.
42
42
  feedback: Feedback
@@ -36,7 +36,7 @@ de:
36
36
  one: basiert auf einer Rezension
37
37
  other: "basiert auf %{count} Rezensionen"
38
38
  by: Von
39
- editing_review_for_html: 'Rezension über %{link} bearbeiten'
39
+ editing_review_for_html: 'Rezension über %{product_name} bearbeiten'
40
40
  error_approve_review: Fehler bei der Freischaltung
41
41
  error_no_product: Das rezensierte Produkt existiert nicht mehr.
42
42
  feedback: Feedback
@@ -35,7 +35,7 @@ en-GB:
35
35
  one: based upon one review
36
36
  other: "based upon %{count} reviews"
37
37
  by: by
38
- editing_review_for_html: 'Editing review for %{link}'
38
+ editing_review_for_html: 'Editing review for %{product_name}'
39
39
  error_approve_review: Error approving review
40
40
  error_no_product: The reviewed product doesn't exist anymore
41
41
  feedback: Feedback
@@ -64,6 +64,7 @@ en-GB:
64
64
  show_email: Show email addresses
65
65
  show_verified_purchaser: Show verified purchaser
66
66
  track_locale: Track user's locale
67
+ allow_image_upload: Allow images to be attached to reviews
67
68
  star:
68
69
  one: "1"
69
70
  other: "%{count}"
@@ -35,7 +35,7 @@ en:
35
35
  one: based upon one review
36
36
  other: "based upon %{count} reviews"
37
37
  by: by
38
- editing_review_for_html: 'Editing review for %{link}'
38
+ editing_review_for_html: 'Editing review for %{product_name}'
39
39
  error_approve_review: Error approving review
40
40
  error_no_product: The reviewed product doesn't exist anymore
41
41
  feedback: Feedback
@@ -64,6 +64,7 @@ en:
64
64
  show_email: Show email addresses
65
65
  show_verified_purchaser: Show verified purchaser
66
66
  track_locale: Track user's locale
67
+ allow_image_upload: Allow images to be attached to reviews
67
68
  star:
68
69
  one: "1"
69
70
  other: "%{count}"
@@ -35,7 +35,7 @@ es:
35
35
  one: "basado en una valoración"
36
36
  other: "basado en %{count} valoraciones"
37
37
  by: por
38
- editing_review_for_html: 'Editando la valoración para %{link}'
38
+ editing_review_for_html: 'Editando la valoración para %{product_name}'
39
39
  error_approve_review: "Error aprobando la valoración"
40
40
  error_no_product: "El producto valorado ya no existe"
41
41
  feedback: Feedback
@@ -64,6 +64,7 @@ es:
64
64
  show_email: "Mostrar las direcciones de correo"
65
65
  show_verified_purchaser: Mostrar comprador verificado
66
66
  track_locale: "Rastrear el locale del usuario"
67
+ allow_image_upload: "Permitir adjuntar imagenes con el comentario"
67
68
  star:
68
69
  one: "1"
69
70
  other: "%{count}"
@@ -35,7 +35,7 @@ fr:
35
35
  one: basé sur un commentaire
36
36
  other: "basé sur %{count} commentaires"
37
37
  by: par
38
- editing_review_for_html: 'Modification du commentaire pour %{link}'
38
+ editing_review_for_html: 'Modification du commentaire pour %{product_name}'
39
39
  error_approve_review: Erreur en approuvant le commentaire
40
40
  error_no_product: Le produit commenté n'existe plus
41
41
  feedback: Réaction
@@ -34,7 +34,7 @@ it:
34
34
  one: basato su una recensione
35
35
  other: "basato su %{count} recensioni"
36
36
  by: da
37
- editing_review_for_html: 'Modifica la recensione per %{link}'
37
+ editing_review_for_html: 'Modifica la recensione per %{product_name}'
38
38
  error_approve_review: Errore approvazione recensione
39
39
  error_no_product: "Il prodotto recensito non esiste più"
40
40
  feedback: Feedback
@@ -37,7 +37,7 @@ pl:
37
37
  few: "na podstawie %{count} opinii"
38
38
  other: "na podstawie %{count} opinii"
39
39
  by: "przez"
40
- editing_review_for_html: 'Edycja opinii dla %{link}'
40
+ editing_review_for_html: 'Edycja opinii dla %{product_name}'
41
41
  error_approve_review: Błąd przy zatwierdzaniu opinii
42
42
  error_no_product: Oceniamy produkt nie istnieje
43
43
  feedback: Komentarz
@@ -35,7 +35,7 @@ pt-BR:
35
35
  one: 'baseado em uma avaliação'
36
36
  other: "baseado em %{count} avaliações"
37
37
  by: 'por'
38
- editing_review_for_html: 'Editando avaliação para %{link}'
38
+ editing_review_for_html: 'Editando avaliação para %{product_name}'
39
39
  error_approve_review: 'Erro aprovando avaliação'
40
40
  error_no_product: "O produto avaliado não existe mais"
41
41
  feedback: 'Parecer'
@@ -35,7 +35,7 @@ pt:
35
35
  one: baseada numa avaliação
36
36
  other: "baseada em %{count} avaliações"
37
37
  by: por
38
- editing_review_for_html: 'Editando a avaliação para %{link}'
38
+ editing_review_for_html: 'Editando a avaliação para %{product_name}'
39
39
  error_approve_review: Erro aprovando a avaliação
40
40
  error_no_product: O produto avaliado já não existe
41
41
  feedback: Feedback
@@ -39,7 +39,7 @@ ro:
39
39
  other: "bazată pe %{count} recenzii"
40
40
  many: "bazată pe %{count} de recenzii"
41
41
  by: de
42
- editing_review_for_html: 'Editare recenzie pentru %{link}'
42
+ editing_review_for_html: 'Editare recenzie pentru %{product_name}'
43
43
  error_approve_review: Eroare la aprobarea recenziei
44
44
  error_no_product: Produsul recenziat nu mai există
45
45
  feedback: Feedback
@@ -35,7 +35,7 @@ sv:
35
35
  one: "baserad på en recension"
36
36
  other: "baserad på %{count} recensioner"
37
37
  by: av
38
- editing_review_for_html: "Editerad recension för %{link}"
38
+ editing_review_for_html: "Editerad recension för %{product_name}"
39
39
  error_approve_review: "Problem med att godkänna recension"
40
40
  error_no_product: "Den betygsatta produkten finns inte längre"
41
41
  feedback: Återkoppling
@@ -35,7 +35,7 @@ tr:
35
35
  one: bir incelemeye göre
36
36
  other: "%{count} incelemeye göre"
37
37
  by: tarafından
38
- editing_review_for_html: 'Yorumu düzenle %{link}'
38
+ editing_review_for_html: 'Yorumu düzenle %{product_name}'
39
39
  error_approve_review: Yorum onaylamada hata
40
40
  error_no_product: Yorumlanan ürün artık yok
41
41
  feedback: Geri bildirim
@@ -39,7 +39,7 @@ uk:
39
39
  many: "на основі %{count} відгуків"
40
40
  other: "на основі %{count} відгуків"
41
41
  by: від
42
- editing_review_for_html: 'Редагувати відгук на %{link}'
42
+ editing_review_for_html: 'Редагувати відгук на %{product_name}'
43
43
  error_approve_review: Не вдалось схвалити відгук
44
44
  error_no_product: Товару, на який писався відгук, більше не існує
45
45
  feedback: Корисність
@@ -33,7 +33,7 @@ zh-CN:
33
33
  one: 以评论为基础
34
34
  other: "以 %{count} 個评论为基础"
35
35
  by: 由
36
- editing_review_for_html: '正在修改 %{link} 的评论'
36
+ editing_review_for_html: '正在修改 %{product_name} 的评论'
37
37
  error_approve_review: 出错了,不能核准评论
38
38
  error_no_product: 被评论的产品不存在了。
39
39
  feedback: 回馈
@@ -33,7 +33,7 @@ zh-TW:
33
33
  one: 以評論為基礎
34
34
  other: '以 %{count} 個評論為基礎'
35
35
  by: 由
36
- editing_review_for_html: '正在修改 %{link} 的評論'
36
+ editing_review_for_html: '正在修改 %{product_name} 的評論'
37
37
  error_approve_review: 出錯了,不能核準評論
38
38
  error_no_product: 被評論的產品不存在了。
39
39
  feedback: 回饋
data/config/routes.rb CHANGED
@@ -13,7 +13,7 @@ Spree::Core::Engine.routes.draw do
13
13
  end
14
14
 
15
15
  resources :products, only: [] do
16
- resources :reviews, only: [:index, :new, :create] do
16
+ resources :reviews, only: [:index, :new, :create, :edit, :update] do
17
17
  end
18
18
  end
19
19
  post '/reviews/:review_id/feedback(.:format)' => 'feedback_reviews#create', as: :feedback_reviews
@@ -22,6 +22,8 @@ Spree::Core::Engine.routes.draw do
22
22
  namespace :api, defaults: { format: 'json' } do
23
23
  resources :reviews, only: [:show, :create, :update, :destroy]
24
24
 
25
+ resources :feedback_reviews, only: [:create, :update, :destroy]
26
+
25
27
  resources :products do
26
28
  resources :reviews, only: [:index]
27
29
  end
@@ -16,6 +16,5 @@ class RecalculateRatings < SolidusSupport::Migration[4.2]
16
16
  end
17
17
  end
18
18
 
19
- def down
20
- end
19
+ def down; end
21
20
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddVerifiedPurchaserToReviews < SolidusSupport::Migration[4.2]
2
4
  def change
3
5
  add_column :spree_reviews, :verified_purchaser, :boolean, default: false