-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Price owl #186
base: master
Are you sure you want to change the base?
Price owl #186
Changes from all commits
25c967e
9bb4a94
8962888
d5b7900
eaa4515
4c05dda
4cb3e56
29d3c26
5ec3ead
562379e
004b6e5
e10e3b9
6c80ac1
5f592ad
e2a2c36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,55 @@ | ||
<%= form_for review, url: product_reviews_path(product), html: { method: :post } do |f| %> | ||
<%= render 'spree/shared/error_messages', target: review %> | ||
<%= render 'spree/shared/error_messages', target: review %> | ||
|
||
<div class="form-group"> | ||
<%= f.label :rating %> | ||
<%= render 'spree/reviews/stars', stars: review.rating, edit_enabled: true %> | ||
</div> | ||
<div class="form-group"> | ||
<%= f.label :rating %> | ||
<%= render 'spree/reviews/stars', stars: review.rating, edit_enabled: true %> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<%= f.label :name %> | ||
<%= f.text_field :name, maxlength: 255, size: 50, class: 'form-control', required: true %> | ||
<div class="form-group"> | ||
<%= f.label :title %> | ||
<%= f.text_field :title, maxlength: 20, size: 50, class: 'form-control' %> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<%= f.label :review %> | ||
<span class="review_modal"> Max limit 40 characters </span> | ||
<%= f.text_area :review, maxlength: 40, wrap: 'virtual', rows: 4, cols: 50, class: 'form-control', required: true %> | ||
</div> | ||
|
||
<div class="radio mt-2"> | ||
<p class="mb-1"><b>Is this product worth?</b></p> | ||
<%= f.radio_button :product_worth, "yes", style: "display:none" %> <span class="m-1 select-label product_worth_select_value" data-product_worth-value = "yes"> YES </span> | ||
<%= f.radio_button :product_worth, "no", style: "display:none" %> <span class="m-1 select-label product_worth_select_value" data-product_worth-value = "no" > NO </span> | ||
<%= f.radio_button :product_worth, "dont_know", style: "display:none" %> <span class="m-1 select-label product_worth_select_value" data-product_worth-value = "dont_know" > Don't know </span> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<%= f.label :title %> | ||
<%= f.text_field :title, maxlength: 255, size: 50, class: 'form-control' %> | ||
<div class="radio mt-2"> | ||
<p class="mb-1"><b>Do you recommend this product?</b></p> | ||
<%= f.radio_button :product_recommend, "yes", style: "display:none" %> <span class="m-1 select-label product_recommend_select_value" data-product_recommend-value = "yes"> YES </span> | ||
<%= f.radio_button :product_recommend, "no", style: "display:none" %> <span class="m-1 select-label product_recommend_select_value" data-product_recommend-value = "no"> NO </span> | ||
<%= f.radio_button :product_recommend, "dont_know", style: "display:none" %> <span class="m-1 select-label product_recommend_select_value" data-product_recommend-value = "dont_know"> Don't know </span> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<%= f.label :review %> | ||
<%= f.text_area :review, wrap: 'virtual', rows: 10, cols: 50, class: 'form-control', required: true %> | ||
<div class="radio mt-2 mb-5"> | ||
<p class="mb-1"><b>Was the experience with the vendor good?</b></p> | ||
<%= f.radio_button :vendor_recommend, "yes", style: "display:none" %> <span class="m-1 select-label vendor_recommend_select_value" data-vendor_recommend-value = "yes"> YES </span> | ||
<%= f.radio_button :vendor_recommend, "no", style: "display:none" %> <span class="m-1 select-label vendor_recommend_select_value" data-vendor_recommend-value = "no"> NO </span> | ||
<%= f.radio_button :vendor_recommend, "dont_know", style: "display:none" %> <span class="m-1 select-label vendor_recommend_select_value" data-vendor_recommend-value = "dont_know"> Don't know </span> | ||
</div> | ||
|
||
<% if Spree::Reviews::Config[:show_identifier] %> | ||
<div class="checkbox"> | ||
<%= f.label :show_identifier do %> | ||
<%= f.check_box :show_identifier, checked: true %> | ||
<%= Spree::Review.human_attribute_name(:show_identifier) %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<% if Spree::Reviews::Config[:show_identifier] %> | ||
<div class="checkbox"> | ||
<%= f.label :show_identifier do %> | ||
<%= f.check_box :show_identifier, checked: true %> | ||
<%= Spree::Review.human_attribute_name(:show_identifier) %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
|
||
<div class="form-actions"> | ||
<%= f.submit Spree.t(:submit_your_review), class: 'btn btn-primary' %> | ||
<%= Spree.t(:or) %> | ||
<%= link_to Spree.t(:cancel), product_path(@product), class: 'btn btn-outline-primary', rel: 'nofollow' %> | ||
</div> | ||
<% end %> | ||
<div class="form-actions"> | ||
<%= f.submit Spree.t(:submit_your_review), class: 'btn btn-primary' %> | ||
<%= Spree.t(:or) %> | ||
<%= link_to Spree.t(:cancel), product_path(@product), class: 'btn btn-outline-primary', rel: 'nofollow' %> | ||
</div> | ||
<% end %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<div class="container"> | ||
<div class="row my-4"> | ||
<div class="col-12"> | ||
<h3 class="product-section-title"><%= Spree.t(:reviews) %></h3> | ||
<h3 class="product-section-title mt-3"><%= Spree.t(:reviews) %></h3> | ||
<% if Spree::Reviews::Config[:include_unapproved_reviews] == false and @product.reviews.approved.count == 0 %> | ||
<p class="reviews-none"><%= Spree.t(:no_reviews_available) %></p> | ||
<% else %> | ||
|
@@ -15,11 +15,9 @@ | |
<%= render 'spree/shared/review', review: review %> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= link_to Spree.t(:write_your_own_review), new_product_review_path(@product), class: 'btn btn-primary', rel: 'nofollow' %> | ||
<%= Spree.t(:or) %> | ||
<%= link_to Spree.t(:back_to) + " " [email protected], product_path(@product), class: 'btn btn-outline-primary', rel: 'nofollow' %> | ||
|
||
<% if Spree.version.to_f < 4.0 %> | ||
<% if @approved_reviews.respond_to?(:total_pages) %> | ||
<div class="mt-4"> | ||
|
@@ -40,4 +38,4 @@ | |
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<% @review = Spree::Review.new(product: @product) %> | ||
<div class="modal product-added-modal" tabindex="-1" role="dialog" aria-hidden="true"> | ||
<div class="modal-dialog modal-md" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header align-items-center pb-2 pt-2 border-0"> | ||
<h1 class="mb-0">Post a review</h1> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true"> | ||
<%= icon(name: 'close', | ||
classes: 'd-block d-lg-none', | ||
width: 16, | ||
height: 16) %> | ||
<%= icon(name: 'close', | ||
classes: 'd-none d-lg-block', | ||
width: 30, | ||
height: 30) %> | ||
</span> | ||
</button> | ||
</div> | ||
<div class="modal-body p-4"> | ||
<%= render 'spree/reviews/form', review: @review, product: @product %> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,72 @@ | ||
<% stars = product.stars %> | ||
<% reviews_count = product.reviews_count %> | ||
<% @average_rating = product.reviews.count > 0 ? product.reviews.sum(:rating).to_f / product.reviews.count : 0 %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this line and use stars |
||
|
||
<% reviews_count = product.reviews.count %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change to reviews_count |
||
<% rating_with_five = reviews_count != 0 ? product.reviews.rating_with_five * 100 / reviews_count : 0 %> | ||
<% rating_with_four = reviews_count != 0 ? product.reviews.rating_with_four * 100 / reviews_count : 0 %> | ||
<% rating_with_three = reviews_count != 0 ? product.reviews.rating_with_three * 100 / reviews_count : 0 %> | ||
<% rating_with_two = reviews_count != 0 ? product.reviews.rating_with_two * 100 / reviews_count : 0%> | ||
<% rating_with_one = reviews_count != 0 ? product.reviews.rating_with_one * 100 / reviews_count : 0 %> | ||
|
||
<div class="ratings"> | ||
<p><%= Spree.t(:average_customer_rating) %>:</p> | ||
<p class="ratings-stars"> | ||
<span title="<%= txt_stars(stars) %>"> | ||
<%= render 'spree/reviews/stars', stars: stars %> | ||
</span> | ||
<p class="product-review-description"> | ||
Let us know your thoughts on a product or view reviews from our members, | ||
independent experts and other websites. | ||
</p> | ||
<p class="ratings-basedupon">(<%= Spree.t(:based_upon_review_count, count: reviews_count) %>)</p> | ||
<div class="d-flex"> | ||
<p class="ratings-stars product-review-rating-stars"> | ||
<% if product.reviews.count > 0 %> | ||
<%= @average_rating.try(:round) %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use stars |
||
<% else %> | ||
0 | ||
<% end %> | ||
<span title="<%= txt_stars(@average_rating) %>"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use stars |
||
<%= render 'spree/reviews/stars', stars: @average_rating.try(:round) %> | ||
</span> | ||
</p> | ||
</div> | ||
<p class="ratings-basedupon product-review-basedupon"><%= Spree.t(:based_upon_review_count, count: reviews_count) %></p> | ||
|
||
<div class="product-review-bars"> | ||
<div class="product-review-bar"> | ||
<p class="mb-0 mr-3">5</p> | ||
<div class="progress product-review-progress-bar"> | ||
<div class="progress-bar bg-warning" role="progressbar" style="width: <%= rating_with_five %>%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> | ||
</div> | ||
<p class="mb-0"><%= rating_with_five %>%</p> | ||
</div> | ||
<div class="product-review-bar"> | ||
<p class="mb-0 mr-3">4</p> | ||
<div class="progress product-review-progress-bar"> | ||
<div class="progress-bar bg-warning" role="progressbar" style="width: <%= rating_with_four %>%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> | ||
</div> | ||
<p class="mb-0"><%= rating_with_four %>%</p> | ||
</div> | ||
<div class="product-review-bar"> | ||
<p class="mb-0 mr-3">3</p> | ||
<div class="progress product-review-progress-bar"> | ||
<div class="progress-bar bg-warning" role="progressbar" style="width: <%= rating_with_three %>%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> | ||
</div> | ||
<p class="mb-0"><%= rating_with_three %>%</p> | ||
</div> | ||
<div class="product-review-bar"> | ||
<p class="mb-0 mr-3">2</p> | ||
<div class="progress product-review-progress-bar"> | ||
<div class="progress-bar bg-warning" role="progressbar" style="width: <%= rating_with_two %>%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> | ||
</div> | ||
<p class="mb-0"><%= rating_with_two %>%</p> | ||
</div> | ||
<div class="product-review-bar"> | ||
<p class="mb-0 mr-3">1</p> | ||
<div class="progress product-review-progress-bar"> | ||
<div class="progress-bar bg-warning" role="progressbar" style="width: <%= rating_with_one %>%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> | ||
</div> | ||
<p class="mb-0"><%= rating_with_one %>%</p> | ||
</div> | ||
</div> | ||
|
||
|
||
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"> | ||
<span itemprop="ratingValue" content="<%= stars %>"></span> | ||
<span itemprop="ratingValue" content="<%= @average_rating %>"></span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. revert |
||
<span itemprop="reviewCount" content="<%= reviews_count %>"></span> | ||
</div> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
<div class="review" itemprop="reviews" itemscope itemtype="http://schema.org/Review"> | ||
<div class="review mt-4" itemprop="reviews" itemscope itemtype="http://schema.org/Review"> | ||
<span class="reviews-rating" title="<%= txt_stars(review.rating) %>"> | ||
<%= render 'spree/reviews/stars', stars: review.rating %> | ||
<%= render 'spree/reviews/stars', stars: review&.rating %> | ||
</span> | ||
<span itemprop="name"><%= review.title %></span> | ||
<br> | ||
<span class="attribution"><%= Spree.t(:submitted_on) %> | ||
<strong><%= l review.created_at.to_date %></strong> | ||
<span itemprop="name"><strong><%= review&.title %></strong></span> | ||
<br> | ||
<div itemprop="reviewBody"> | ||
<p class="mb-1 product-review-description"><%= review.review %></p> | ||
</div> | ||
<% if Spree::Reviews::Config[:feedback_rating] && (!Spree::Reviews::Config[:require_login] || spree_current_user) %> | ||
<div class="feedback_review my-3" id="feedback_review_<%= review.id %>"> | ||
<%= render 'spree/feedback_reviews/form', review: review %> | ||
</div> | ||
<% end %> | ||
<span class="attribution product-review-attribution"> | ||
<%#= Spree.t(:submitted_on) %> | ||
<%= l review.created_at.to_date %> | ||
</span> | ||
<span itemprop="datePublished" content="<%= review.created_at.to_date.to_s %>"></span> | ||
<span itemprop="reviewRating" content="<%= review.rating %>"></span> | ||
<% if review.show_identifier %> | ||
<% if Spree::Reviews::Config[:show_email] && review.user %> | ||
<span itemprop="author"><%= review.user.email %></span> | ||
<% else %> | ||
<span itemprop="author"><%= review.name %></span> | ||
<span itemprop="author" class="product-review-author">- <%= review.user&.first_name %></span> | ||
<% end %> | ||
<% else %> | ||
<span itemprop="author"><%= Spree.t(:anonymous) %></span> | ||
<% end %> | ||
<div itemprop="reviewBody"> | ||
<%= simple_format(review.review) %> | ||
</div> | ||
<% if Spree::Reviews::Config[:feedback_rating] && (!Spree::Reviews::Config[:require_login] || spree_current_user) %> | ||
<div class="feedback_review my-3" id="feedback_review_<%= review.id %>"> | ||
<%= render 'spree/feedback_reviews/form', review: review %> | ||
</div> | ||
<% end %> | ||
</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
<div id="reviews"> | ||
<h3 class="product-section-title"><%= Spree.t(:reviews) %></h3> | ||
<% if Spree::Reviews::Config[:include_unapproved_reviews] == false and @product.reviews.approved.count == 0 %> | ||
<p class="reviews-none"><%= Spree.t(:no_reviews_available) %></p> | ||
<h3 class="product-section-title mt-3"><%= Spree.t(:reviews) %></h3> | ||
<% if @product.reviews.count == 0 %> | ||
<p class="reviews-none product-review-description"><%= Spree.t(:no_reviews_available) %></p> | ||
<div class="d-flex align-items-center mt-4"> | ||
<p class = "btn btn-primary mb-0 <%= spree_current_user.present? ? "review_new_button" : "review_btn_blur" %>"> <%= Spree.t(:write_your_own_review) %></p> | ||
</div> | ||
<% unless spree_current_user.present? %> | ||
<p class="review_note">You need to login to Post a review</p> | ||
<% end %> | ||
|
||
<% else %> | ||
<%= render 'spree/shared/rating', product: @product, review: 0 %> | ||
<div class="d-flex align-items-center mt-4"> | ||
<p class = "btn btn-primary mb-0 <%= spree_current_user.present? ? "review_new_button" : "review_btn_blur" %>"> <%= Spree.t(:write_your_own_review) %></p> | ||
</div> | ||
<% unless spree_current_user.present? %> | ||
<p class="review_note">You need to login to Post a review</p> | ||
<% end %> | ||
<% for review in (Spree::Reviews::Config[:track_locale] ? @product.reviews.localized(I18n.locale) : @product.reviews).default_approval_filter.preview %> | ||
<%= render 'spree/shared/review', review: review %> | ||
<% end %> | ||
<% end %> | ||
<%= link_to Spree.t(:write_your_own_review), new_product_review_path(@product), class: 'btn btn-primary', rel: 'nofollow' %> | ||
|
||
<% unless Spree::Reviews::Config[:include_unapproved_reviews] == false and @product.reviews.approved.count == 0 %> | ||
<%= Spree.t(:or) %> | ||
<%= link_to Spree.t(:read_all_reviews), product_reviews_path(@product), class: 'btn btn-primary', rel: 'nofollow' %> | ||
<% end %> | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert to reviews_count