Class: VoteFu::StarRatingComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- VoteFu::StarRatingComponent
- Defined in:
- app/components/vote_fu/star_rating_component.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(voteable:, voter: nil, scope: nil, max_stars: 5, filled_star: "★", empty_star: "☆", half_star: "⯨", show_average: true, show_count: true, readonly: false) ⇒ StarRatingComponent
constructor
Star rating component for 1-5 star ratings.
Constructor Details
#initialize(voteable:, voter: nil, scope: nil, max_stars: 5, filled_star: "★", empty_star: "☆", half_star: "⯨", show_average: true, show_count: true, readonly: false) ⇒ StarRatingComponent
Star rating component for 1-5 star ratings
Uses vote values 1-5 to represent star ratings.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/components/vote_fu/star_rating_component.rb', line 19 def initialize( voteable:, voter: nil, scope: nil, max_stars: 5, filled_star: "★", empty_star: "☆", half_star: "⯨", show_average: true, show_count: true, readonly: false ) @voteable = voteable @voter = voter @scope = scope @max_stars = max_stars @filled_star = filled_star @empty_star = empty_star @half_star = half_star @show_average = show_average @show_count = show_count @readonly = readonly end |
Instance Method Details
#call ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'app/components/vote_fu/star_rating_component.rb', line 43 def call tag.div(**wrapper_attributes) do safe_join([ star_container, ( if @show_average || @show_count) ].compact) end end |