Module: Formol::TopicsHelper
- Includes:
- PostsHelper
- Defined in:
- app/helpers/formol/topics_helper.rb
Instance Method Summary
collapse
#display_avatars?, #display_signatures?, #link_to_last_fives_post_position, #link_to_post_position
Instance Method Details
#attach_poll_checkbox(topic) ⇒ Object
16
17
18
|
# File 'app/helpers/formol/topics_helper.rb', line 16
def attach_poll_checkbox(topic)
%{<input type="checkbox" name="topic[attach_poll]" id="topic_attach_poll" value="1" #{'checked="checked"' if topic.attach_poll} />}.html_safe
end
|
20
21
22
23
24
25
|
# File 'app/helpers/formol/topics_helper.rb', line 20
def display_poll_form?(poll, topic, user)
!poll.expired? &&
!topic.locked? &&
formol_authorized?(user, :vote_poll, topic) &&
!poll.voted?(user)
end
|
#link_to_subscription(topic, user) ⇒ Object
5
6
7
8
9
10
11
12
13
14
|
# File 'app/helpers/formol/topics_helper.rb', line 5
def link_to_subscription(topic, user)
subscriber = topic.subscriber?(user)
method = subscriber ? :delete : :post
text = t('formol.topics.show.' + (subscriber ? 'unsubscribe' : 'subscribe'))
switch_text = t('formol.topics.show.' + (subscriber ? 'subscribe' : 'unsubscribe'))
link_to text, topic_subscriptions_path(topic), :method => method,
:remote => true,
:'data-switch-text' => switch_text
end
|