Skip to content
Extraits de code Groupes Projets
Valider 543bf458 rédigé par danielgrippi's avatar danielgrippi
Parcourir les fichiers

extracted methods to helpers

parent 97e17759
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -3,4 +3,40 @@ module MobileHelper ...@@ -3,4 +3,40 @@ module MobileHelper
selected_id = selected == :all ? "" : selected.id selected_id = selected == :all ? "" : selected.id
'<option value="" >All</option>\n'.html_safe + options_from_collection_for_select(aspects, "id", "name", selected_id) '<option value="" >All</option>\n'.html_safe + options_from_collection_for_select(aspects, "id", "name", selected_id)
end end
end
\ No newline at end of file def mobile_reshare_icon(post)
if (post.public? || reshare?(post)) && post.author != current_user.person
root = reshare?(post) ? post.root : post
if root.author != current_user.person.id
reshare = Reshare.where(:author_id => current_user.person.id,
:root_guid => root.guid).first
klass = reshare.present? ? "active" : "inactive"
link_to '', reshares_path(:root_guid => root.guid), :title => t('reshares.reshare.reshare_confirmation', :author => root.author.name), :class => "image_link reshare_action #{klass}"
end
end
end
def mobile_like_icon(post)
if current_user && current_user.liked?(post)
link_to '', post_like_path(post.id, current_user.like_for(post).id), :class => "image_link like_action active"
else
link_to '', post_likes_path(post.id), :class => "image_link like_action inactive"
end
end
def mobile_comment_icon(post)
link_to '', new_post_comment_path(post), :class => "image_link comment_action inactive"
end
def reactions_link(post)
reactions_count = post.comments_count + post.likes_count
if reactions_count > 0
link_to "#{t('reactions', :count => reactions_count)}", post_comments_path(post, :format => "mobile"), :class => 'show_comments'
else
html = "<span class='show_comments'>"
html << "#{t('reactions', :count => reactions_count)}"
html << "</span>"
end
end
end
...@@ -17,29 +17,11 @@ ...@@ -17,29 +17,11 @@
.bottom_bar .bottom_bar
.floater .floater
= mobile_reshare_icon(post)
= mobile_comment_icon(post)
= mobile_like_icon(post)
- if (post.public? || reshare?(post)) && post.author != current_user.person != reactions_link(post)
- if reshare?(post)
- root = post.root
- else
- root = post
- reshare = Reshare.where(:author_id => current_user.person.id, :root_guid => root.guid).first ? "active" : "inactive"
= link_to '', reshares_path(:root_guid => root.guid), :title => t('reshares.reshare.reshare_confirmation', :author => root.author.name), :class => "image_link reshare_action #{reshare}"
= link_to '', new_post_comment_path(post), :class => "image_link comment_action inactive"
- if current_user && current_user.liked?(post)
= link_to '', post_like_path(post.id, current_user.like_for(post).id), :class => "image_link like_action active"
- else
= link_to '', post_likes_path(post.id), :class => "image_link like_action inactive"
- if post.comments.length + post.likes_count > 0
= link_to "#{t('reactions', :count => (post.comments.length + post.likes_count))}", post_comments_path(post, :format => "mobile"), :class => 'show_comments'
- else
%span.show_comments
= "#{t('reactions', :count => (post.comments.length + post.likes_count))}"
- if defined?(expanded_info) && expanded_info - if defined?(expanded_info) && expanded_info
.comment_container .comment_container
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter