Class: Decidim::DecidimAwesome::Voting::VotingCardsBaseCell

Inherits:
ViewModel
  • Object
show all
Includes:
ComponentPathHelper, IconHelper, Proposals::ProposalVotesHelper
Defined in:
app/cells/decidim/decidim_awesome/voting/voting_cards_base_cell.rb

Direct Known Subclasses

VotingCardsProposalCell

Instance Method Summary collapse

Instance Method Details

#component_settingsObject



26
27
28
# File 'app/cells/decidim/decidim_awesome/voting/voting_cards_base_cell.rb', line 26

def component_settings
  current_component.settings
end

#current_componentObject



22
23
24
# File 'app/cells/decidim/decidim_awesome/voting/voting_cards_base_cell.rb', line 22

def current_component
  proposal.component
end

#current_voteObject



30
31
32
# File 'app/cells/decidim/decidim_awesome/voting/voting_cards_base_cell.rb', line 30

def current_vote
  @current_vote ||= Decidim::Proposals::ProposalVote.find_by(author: current_user, proposal: model)
end

#proposalObject



14
15
16
# File 'app/cells/decidim/decidim_awesome/voting/voting_cards_base_cell.rb', line 14

def proposal
  model
end

#sanitized_titleObject



18
19
20
# File 'app/cells/decidim/decidim_awesome/voting/voting_cards_base_cell.rb', line 18

def sanitized_title
  strip_tags(translated_attribute(proposal.title))
end

#user_voted_weightObject



34
35
36
# File 'app/cells/decidim/decidim_awesome/voting/voting_cards_base_cell.rb', line 34

def user_voted_weight
  current_vote&.weight
end