Module: TopicsHelper

Defined in:
app/helpers/topics_helper.rb

Instance Method Summary collapse

Instance Method Details


2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/topics_helper.rb', line 2

def like_link(topic)
  if signed_in?
    if topic.user == current_user
      button_to t('topic.edit'), edit_topic_path(topic), method: :get
    elsif like = topic.already_liked?(current_user)
      button_to t('topic.unlike'), topic_like_path(like.topic, like), method: :delete
    else
      button_to t('topic.like'), topic_likes_path(topic), method: :post
    end
  else
    button_to t('topic.like'), '', data: { disable: t('show.login_before_attend') }
  end
end

#proposal_type_selectionObject


16
17
18
# File 'app/helpers/topics_helper.rb', line 16

def proposal_type_selection
  Hash[Topic::PROPOSAL_TYPES.map { |type| [I18n.t("topic.proposal_types.#{type}"), type] }]
end