Module: Biovision::Vote::ApplicationHelper

Defined in:
app/helpers/biovision/vote/application_helper.rb

Instance Method Summary collapse

Instance Method Details

Parameters:



14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/biovision/vote/application_helper.rb', line 14

def biovision_votable_link(entity)
  text = entity.model_name.human
  if entity.respond_to?(:title)
    text << " «#{entity.title}»"
  elsif entity.respond_to?(:name)
    text << " «#{entity.name}»"
  else
    text << "#{entity.id}"
  end
  link_to(text, entity)
end

#vote_image(vote) ⇒ Object

Parameters:



5
6
7
8
9
10
11
# File 'app/helpers/biovision/vote/application_helper.rb', line 5

def vote_image(vote)
  if vote.upvote?
    image_tag('biovision/vote/icons/upvote-active.svg', alt: '')
  else
    image_tag('biovision/vote/icons/downvote-active.svg', alt: '')
  end
end