forked from spree-contrib/spree_reviews
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bye bye hash rockets and overflow newlines.
- Loading branch information
Showing
36 changed files
with
102 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
module Spree::ReviewsHelper | ||
|
||
def star(the_class) | ||
content_tag(:span, " ✮ ".html_safe, :class => the_class) | ||
content_tag(:span, " ✮ ".html_safe, class: the_class) | ||
end | ||
|
||
def mk_stars(m) | ||
(1..5).collect {|n| n <= m ? star("lit") : star("unlit") }.join | ||
end | ||
|
||
def txt_stars(n, show_out_of = true) | ||
res = Spree.t('star', :count => n) | ||
res = Spree.t('star', count: n) | ||
res += " #{Spree.t('out_of_5')}" if show_out_of | ||
res | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
class Spree::FeedbackReview < ActiveRecord::Base | ||
belongs_to :user, :class_name => Spree.user_class.to_s | ||
|
||
belongs_to :user, class_name: Spree.user_class.to_s | ||
belongs_to :review, dependent: :destroy | ||
validates :review, presence: true | ||
|
||
validates :review, presence: true | ||
validates :rating, numericality: { only_integer: true, | ||
greater_than_or_equal_to: 1, | ||
greater_than_or_equal_to: 1, | ||
less_than_or_equal_to: 5, | ||
message: Spree.t('you_must_enter_value_for_rating') } | ||
|
||
scope :most_recent_first, -> { order("spree_feedback_reviews.created_at DESC") } | ||
default_scope { most_recent_first } | ||
|
||
scope :localized, lambda { |lc| where('spree_feedback_reviews.locale = ?', lc) } | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Deface::Override.new(:virtual_path => "spree/products/show", | ||
:name => "converted_product_properties_767643482", | ||
:insert_after => "[data-hook='product_properties']", | ||
:partial => "spree/shared/reviews", | ||
:disabled => false) | ||
Deface::Override.new(virtual_path: "spree/products/show", | ||
name: "converted_product_properties_767643482", | ||
insert_after: "[data-hook='product_properties']", | ||
partial: "spree/shared/reviews", | ||
disabled: false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Deface::Override.new(:virtual_path => "spree/admin/shared/_product_sub_menu", | ||
:name => "reviews_admin_tab", | ||
:insert_bottom => "[data-hook='admin_product_sub_tabs']", | ||
:text => "<%= tab(:reviews, :label => 'review_management') %>") | ||
Deface::Override.new(virtual_path: "spree/admin/shared/_product_sub_menu", | ||
name: "reviews_admin_tab", | ||
insert_bottom: "[data-hook='admin_product_sub_tabs']", | ||
text: "<%= tab(:reviews, label: 'review_management') %>") |
10 changes: 5 additions & 5 deletions
10
app/overrides/add_reviews_to_admin_configuration_sidebar.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Deface::Override.new(:virtual_path => "spree/admin/shared/_configuration_menu", | ||
:name => "converted_admin_configurations_menu", | ||
:insert_bottom => "[data-hook='admin_configurations_sidebar_menu'], #admin_configurations_sidebar_menu[data-hook]", | ||
:text => "<%= configurations_sidebar_menu_item Spree.t('spree_reviews.review_settings'), edit_admin_review_settings_path %>", | ||
:disabled => false) | ||
Deface::Override.new(virtual_path: "spree/admin/shared/_configuration_menu", | ||
name: "converted_admin_configurations_menu", | ||
insert_bottom: "[data-hook='admin_configurations_sidebar_menu'], #admin_configurations_sidebar_menu[data-hook]", | ||
text: "<%= configurations_sidebar_menu_item Spree.t('spree_reviews.review_settings'), edit_admin_review_settings_path %>", | ||
disabled: false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
<%= render "spree/shared/error_messages", :target => @review %> | ||
<%= render "spree/shared/error_messages", target: @review %> | ||
<%= f.field_container :name do %> | ||
<%= f.label :name %><br /> | ||
<%= f.text_field :name, :maxlength => "255", :size => "60" %> | ||
<%= f.text_field :name, maxlength: "255", size: "60" %> | ||
<% end %> | ||
|
||
<%= f.field_container :title do %> | ||
<%= f.label :title %><br /> | ||
<%= f.text_field :title, :maxlength => "255", :size => "60" %> | ||
<%= f.text_field :title, maxlength: "255", size: "60" %> | ||
<% end %> | ||
|
||
<%= f.field_container :review do %> | ||
<%= f.label :review %><br /> | ||
<%= f.text_area :review, :wrap => "virtual", :rows => "10", :cols => "60" %> | ||
<%= f.text_area :review, wrap: "virtual", rows: "10", cols: "60" %> | ||
<% end %> | ||
|
||
<% if Spree::Reviews::Config[:track_locale] %> | ||
<%= f.field_container :locale do %> | ||
<%= f.label :locale %><br /> | ||
<%= f.select :locale, I18n.available_locales.map { |lc| [t(lc, :default => lc.to_s), lc.to_s] } %> | ||
<%= f.select :locale, I18n.available_locales.map { |lc| [t(lc, default: lc.to_s), lc.to_s] } %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<%= render 'spree/feedback_reviews/summary', :review => review %> | ||
<%= form_for((@feedback_review ||= review.feedback_reviews.build), :url => feedback_reviews_path(review), :method => :post, :remote => true) do |f| %> | ||
<%= render 'spree/feedback_reviews/summary', review: review %> | ||
<%= form_for((@feedback_review ||= review.feedback_reviews.build), url: feedback_reviews_path(review), method: :post, remote: true) do |f| %> | ||
<% unless @feedback_review.errors.empty? %> | ||
<span class="error"><%= @feedback_review.errors[:rating] %></span> | ||
<br /> | ||
<% end %> | ||
<%= Spree.t(:was_this_review_helpful) %> | ||
<% for i in 1..NB_STARS %> | ||
<%= radio_button_tag "feedback_review[rating]", | ||
Spree.t('star', :count => i), false, :class => "star" %> | ||
Spree.t('star', count: i), false, class: "star" %> | ||
<% end %> | ||
<button class="feedback-review"><span><%= Spree.t(:say_yes) %></span></button> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<p> | ||
<%= Spree.t('voice', :count => review.feedback_reviews.count) %>. | ||
<%= Spree.t('voice', count: review.feedback_reviews.count) %>. | ||
<span title="<%= pluralize(review.feedback_stars, 'star') %> <%= Spree.t('out_of_5') %>"> | ||
<%= render 'spree/reviews/stars', :stars => review.feedback_stars %> | ||
<%= render 'spree/reviews/stars', stars: review.feedback_stars %> | ||
</span> | ||
</p> |
Oops, something went wrong.