Sha256: 3872c4a57685bdaf3918b5fa76353cede5fab26fdaf9e2e6d081a65a68cb655e
Contents?: true
Size: 817 Bytes
Versions: 3
Compression:
Stored size: 817 Bytes
Contents
# frozen_string_literal: true module Spree::ReviewsHelper def star(the_class) 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 = I18n.t('spree.star', count: n) res += " #{I18n.t('spree.out_of_5')}" if show_out_of res end def display_verified_purchaser?(review) Spree::Reviews::Config[:show_verified_purchaser] && review.user && Spree::LineItem.joins(:order, :variant) .where.not(spree_orders: { completed_at: nil }) .find_by( spree_variants: { product_id: review.product_id }, spree_orders: { user_id: review.user_id } ).present? end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
solidus_reviews-1.7.0 | app/helpers/spree/reviews_helper.rb |
solidus_reviews-1.6.0 | app/helpers/spree/reviews_helper.rb |
solidus_reviews-1.5.0 | app/helpers/spree/reviews_helper.rb |