Skip to content
This repository
Newer
Older
100644 43 lines (37 sloc) 1.725 kb
218aa1c0 »
2010-11-21 MSSM aspect switcher in mobile interface plus tests; added check for …
1 module MobileHelper
2 def aspect_select_options(aspects, selected)
3 selected_id = selected == :all ? "" : selected.id
4 '<option value="" >All</option>\n'.html_safe + options_from_collection_for_select(aspects, "id", "name", selected_id)
5 end
543bf458 »
2011-10-03 extracted methods to helpers
6
7 def mobile_reshare_icon(post)
1ab2ead1 »
2011-10-03 check for current user on tag pages
8 if (post.public? || reshare?(post)) && (user_signed_in? && post.author != current_user.person)
543bf458 »
2011-10-03 extracted methods to helpers
9 root = reshare?(post) ? post.root : post
10
11 if root.author != current_user.person.id
12 reshare = Reshare.where(:author_id => current_user.person.id,
13 :root_guid => root.guid).first
14 klass = reshare.present? ? "active" : "inactive"
15 link_to '', reshares_path(:root_guid => root.guid), :title => t('reshares.reshare.reshare_confirmation', :author => root.author.name), :class => "image_link reshare_action #{klass}"
16 end
17 end
18 end
19
20 def mobile_like_icon(post)
21 if current_user && current_user.liked?(post)
22 link_to '', post_like_path(post.id, current_user.like_for(post).id), :class => "image_link like_action active"
23 else
24 link_to '', post_likes_path(post.id), :class => "image_link like_action inactive"
25 end
26 end
27
28 def mobile_comment_icon(post)
29 link_to '', new_post_comment_path(post), :class => "image_link comment_action inactive"
30 end
31
32 def reactions_link(post)
33 reactions_count = post.comments_count + post.likes_count
34 if reactions_count > 0
35 link_to "#{t('reactions', :count => reactions_count)}", post_comments_path(post, :format => "mobile"), :class => 'show_comments'
36 else
37 html = "<span class='show_comments'>"
38 html << "#{t('reactions', :count => reactions_count)}"
39 html << "</span>"
40 end
41 end
42 end
Something went wrong with that request. Please try again.