Add empty interests list message.

This commit is contained in:
Senén Rodero Rodríguez
2017-07-26 16:55:46 +02:00
committed by Bertocq
parent 9616fd85ae
commit 1dea11ca8b
6 changed files with 79 additions and 17 deletions

View File

@@ -41,4 +41,20 @@ module UsersHelper
current_user && current_user.administrator?
end
def interests_title_text(user)
if current_user == user
t('account.show.public_interests_my_title_list')
else
t('account.show.public_interests_user_title_list')
end
end
def empty_interests_message_text(user)
if current_user == user
t('account.show.public_interests_my_empty_list')
else
t('account.show.public_interests_user_empty_list')
end
end
end

View File

@@ -0,0 +1,24 @@
<div id="public_interests" class="public-interests">
<h4><%= interests_title_text(user) %></h4>
<% if user.interests.any? %>
<% user.interests.in_groups_of(10, false) do |interests_group| %>
<div class="small-4 column end">
<ul class="no-bullet">
<% interests_group.each do |interest| %>
<li> <small><%= interest %></small> </li>
<% end %>
</ul>
</div>
<% end %>
<% else %>
<div class="callout primary">
<%= empty_interests_message_text(user) %>
</div>
<% end %>
</div>

View File

@@ -46,20 +46,7 @@
<p><%= t('users.show.private_activity') %></p>
<% end %>
<% if valid_interests_access? %>
<div id="public_interests" class="public-interests">
<h4><%= t('account.show.public_interests_title_list') %></h4>
<% @user.interests.in_groups_of(10, false) do |interests_group| %>
<div class="small-4 column end">
<ul class="no-bullet">
<% interests_group.each do |interest| %>
<li> <small><%= interest %></small> </li>
<% end %>
</ul>
</div>
<% end %>
</div>
<% end %>
<%= render 'interests', user: @user if valid_interests_access? %>
</div>
</div>