Class: VoteFu::ReactionBarComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- VoteFu::ReactionBarComponent
- Defined in:
- app/components/vote_fu/reaction_bar_component.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(voteable:, voter: nil, reactions: default_reactions, show_counts: true, show_users: false, max_users: 3, allow_multiple: true) ⇒ ReactionBarComponent
constructor
Reaction bar component for emoji reactions (like Slack, GitHub, etc.).
Constructor Details
#initialize(voteable:, voter: nil, reactions: default_reactions, show_counts: true, show_users: false, max_users: 3, allow_multiple: true) ⇒ ReactionBarComponent
Reaction bar component for emoji reactions (like Slack, GitHub, etc.)
Uses scoped voting where each reaction type is a scope. Vote values indicate the reaction emoji index.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/vote_fu/reaction_bar_component.rb', line 17 def initialize( voteable:, voter: nil, reactions: default_reactions, show_counts: true, show_users: false, max_users: 3, allow_multiple: true ) @voteable = voteable @voter = voter @reactions = reactions @show_counts = show_counts @show_users = show_users @max_users = max_users @allow_multiple = allow_multiple end |
Instance Method Details
#call ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'app/components/vote_fu/reaction_bar_component.rb', line 35 def call tag.div(**wrapper_attributes) do safe_join([ reactions_container, ( if @voter && @allow_multiple) ].compact) end end |