improves following view and updates specs
This commit is contained in:
@@ -64,12 +64,4 @@ module UsersHelper
|
|||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|||||||
@@ -2,18 +2,10 @@
|
|||||||
<h4><%= interests_title_text(user) %></h4>
|
<h4><%= interests_title_text(user) %></h4>
|
||||||
|
|
||||||
<% if user.interests.any? %>
|
<% if user.interests.any? %>
|
||||||
|
|
||||||
<ul class="no-bullet tags">
|
<ul class="no-bullet tags">
|
||||||
<% user.interests.each do |interest| %>
|
<% user.interests.each do |interest| %>
|
||||||
<li class="inline-block"><span><%= interest %></span></li>
|
<li class="inline-block"><span><%= interest %></span></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<% else %>
|
|
||||||
|
|
||||||
<div class="callout primary">
|
|
||||||
<%= empty_interests_message_text(user) %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -38,16 +38,20 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= t("users.show.no_activity") if @activity_counts.values.inject(&:+) == 0 %>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<% if @activity_counts.values.inject(&:+) == 0 %>
|
||||||
|
<div class="callout primary">
|
||||||
|
<%= t("users.show.no_activity") %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= render "activity_page" %>
|
<%= render "activity_page" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="callout warning margin">
|
<div class="callout warning margin">
|
||||||
<%= t('users.show.private_activity') %>
|
<%= t('users.show.private_activity') %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ en:
|
|||||||
public_interests_label: Keep my interests public
|
public_interests_label: Keep my interests public
|
||||||
public_interests_my_title_list: Tags of elements you follow
|
public_interests_my_title_list: Tags of elements you follow
|
||||||
public_interests_user_title_list: Tags of elements this user follows
|
public_interests_user_title_list: Tags of elements this user follows
|
||||||
public_interests_my_empty_list: You do not follow any elements yet.
|
|
||||||
public_interests_user_empty_list: This user does not follow any elements yet.
|
|
||||||
save_changes_submit: Save changes
|
save_changes_submit: Save changes
|
||||||
subscription_to_website_newsletter_label: Receive by email website relevant information
|
subscription_to_website_newsletter_label: Receive by email website relevant information
|
||||||
email_on_direct_message_label: Receive emails about direct messages
|
email_on_direct_message_label: Receive emails about direct messages
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ es:
|
|||||||
public_interests_label: Mostrar públicamente mis intereses
|
public_interests_label: Mostrar públicamente mis intereses
|
||||||
public_interests_my_title_list: Etiquetas de los elementos que sigues
|
public_interests_my_title_list: Etiquetas de los elementos que sigues
|
||||||
public_interests_user_title_list: Etiquetas de los elementos que sigue este usuario
|
public_interests_user_title_list: Etiquetas de los elementos que sigue este usuario
|
||||||
public_interests_my_empty_list: Aún no sigues ningún elemento.
|
|
||||||
public_interests_user_empty_list: Este usuario no sigue ningún elemento todavía.
|
|
||||||
save_changes_submit: Guardar cambios
|
save_changes_submit: Guardar cambios
|
||||||
subscription_to_website_newsletter_label: Recibir emails con información interesante sobre la web
|
subscription_to_website_newsletter_label: Recibir emails con información interesante sobre la web
|
||||||
email_on_direct_message_label: Recibir emails con mensajes privados
|
email_on_direct_message_label: Recibir emails con mensajes privados
|
||||||
|
|||||||
@@ -259,6 +259,9 @@ feature 'Users' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario 'User can display public page' do
|
scenario 'User can display public page' do
|
||||||
|
proposal = create(:proposal, tag_list: "Sport")
|
||||||
|
create(:follow, :followed_proposal, followable: proposal, user: @user)
|
||||||
|
|
||||||
login_as(@user)
|
login_as(@user)
|
||||||
visit account_path
|
visit account_path
|
||||||
|
|
||||||
@@ -267,22 +270,29 @@ feature 'Users' do
|
|||||||
|
|
||||||
logout
|
logout
|
||||||
|
|
||||||
visit user_path(@user)
|
visit user_path(@user, filter: 'follows', page: '1')
|
||||||
|
|
||||||
expect(page).to have_css('#public_interests')
|
expect(page).to have_css('#public_interests')
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Is always visible for the owner' do
|
scenario 'Is always visible for the owner' do
|
||||||
|
proposal = create(:proposal, tag_list: "Sport")
|
||||||
|
create(:follow, :followed_proposal, followable: proposal, user: @user)
|
||||||
|
|
||||||
login_as(@user)
|
login_as(@user)
|
||||||
visit account_path
|
visit account_path
|
||||||
|
|
||||||
uncheck 'account_public_interests'
|
uncheck 'account_public_interests'
|
||||||
click_button 'Save changes'
|
click_button 'Save changes'
|
||||||
|
|
||||||
visit user_path(@user)
|
visit user_path(@user, filter: 'follows', page: '1')
|
||||||
expect(page).to have_css('#public_interests')
|
expect(page).to have_css('#public_interests')
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Is always visible for admins' do
|
scenario 'Is always visible for admins' do
|
||||||
|
proposal = create(:proposal, tag_list: "Sport")
|
||||||
|
create(:follow, :followed_proposal, followable: proposal, user: @user)
|
||||||
|
|
||||||
login_as(@user)
|
login_as(@user)
|
||||||
visit account_path
|
visit account_path
|
||||||
|
|
||||||
@@ -292,11 +302,14 @@ feature 'Users' do
|
|||||||
logout
|
logout
|
||||||
|
|
||||||
login_as(create(:administrator).user)
|
login_as(create(:administrator).user)
|
||||||
visit user_path(@user)
|
visit user_path(@user, filter: 'follows', page: '1')
|
||||||
expect(page).to have_css('#public_interests')
|
expect(page).to have_css('#public_interests')
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Is always visible for moderators' do
|
scenario 'Is always visible for moderators' do
|
||||||
|
proposal = create(:proposal, tag_list: "Sport")
|
||||||
|
create(:follow, :followed_proposal, followable: proposal, user: @user)
|
||||||
|
|
||||||
login_as(@user)
|
login_as(@user)
|
||||||
visit account_path
|
visit account_path
|
||||||
|
|
||||||
@@ -306,39 +319,30 @@ feature 'Users' do
|
|||||||
logout
|
logout
|
||||||
|
|
||||||
login_as(create(:moderator).user)
|
login_as(create(:moderator).user)
|
||||||
visit user_path(@user)
|
visit user_path(@user, filter: 'follows', page: '1')
|
||||||
expect(page).to have_css('#public_interests')
|
expect(page).to have_css('#public_interests')
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Should display generic interests title' do
|
scenario 'Should display generic interests title' do
|
||||||
|
proposal = create(:proposal, tag_list: "Sport")
|
||||||
|
create(:follow, :followed_proposal, followable: proposal, user: @user)
|
||||||
|
|
||||||
@user.update(public_interests: true)
|
@user.update(public_interests: true)
|
||||||
visit user_path(@user)
|
visit user_path(@user, filter: 'follows', page: '1')
|
||||||
|
|
||||||
expect(page).to have_content("Tags of elements this user follows")
|
expect(page).to have_content("Tags of elements this user follows")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Should display custom interests title when user is visiting own user page' do
|
scenario 'Should display custom interests title when user is visiting own user page' do
|
||||||
|
proposal = create(:proposal, tag_list: "Sport")
|
||||||
|
create(:follow, :followed_proposal, followable: proposal, user: @user)
|
||||||
|
|
||||||
@user.update(public_interests: true)
|
@user.update(public_interests: true)
|
||||||
login_as(@user)
|
login_as(@user)
|
||||||
visit user_path(@user)
|
visit user_path(@user, filter: 'follows', page: '1')
|
||||||
|
|
||||||
expect(page).to have_content("Tags of elements you follow")
|
expect(page).to have_content("Tags of elements you follow")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Should display generic empty interests list message when visited user has not interests defined' do
|
|
||||||
@user.update(public_interests: true)
|
|
||||||
visit user_path(@user)
|
|
||||||
|
|
||||||
expect(page).to have_content("This user does not follow any elements yet.")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'Should display custom empty interests list message when user has not interests defined and user is visiting own user page' do
|
|
||||||
@user.update(public_interests: true)
|
|
||||||
login_as(@user)
|
|
||||||
visit user_path(@user)
|
|
||||||
|
|
||||||
expect(page).to have_content("You do not follow any elements yet.")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
feature 'Special comments' do
|
feature 'Special comments' do
|
||||||
@@ -418,22 +422,22 @@ feature 'Users' do
|
|||||||
expect(page).to have_content('1 Following')
|
expect(page).to have_content('1 Following')
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Display accordion proposal tab when user is following one proposal at least' do
|
scenario 'Display proposal tab when user is following one proposal at least' do
|
||||||
proposal = create(:proposal)
|
proposal = create(:proposal)
|
||||||
create(:follow, followable: proposal, user: @user)
|
create(:follow, followable: proposal, user: @user)
|
||||||
|
|
||||||
visit user_path(@user, filter: "follows")
|
visit user_path(@user, filter: "follows")
|
||||||
|
|
||||||
expect(page).to have_link('Citizen proposals', href: "#")
|
expect(page).to have_link('Citizen proposals', href: "#citizen_proposals")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Not display accordion proposal tab when user is not following any proposal' do
|
scenario 'Not display proposal tab when user is not following any proposal' do
|
||||||
visit user_path(@user, filter: "follows")
|
visit user_path(@user, filter: "follows")
|
||||||
|
|
||||||
expect(page).not_to have_link('Citizen proposals', href: "#")
|
expect(page).not_to have_link('Citizen proposals', href: "#citizen_proposals")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Display proposal with action buttons inside accordion proposal tab when current user is proposal author', :js do
|
scenario 'Display proposals with link to proposal' do
|
||||||
proposal = create(:proposal, author: @user)
|
proposal = create(:proposal, author: @user)
|
||||||
create(:follow, followable: proposal, user: @user)
|
create(:follow, followable: proposal, user: @user)
|
||||||
login_as @user
|
login_as @user
|
||||||
@@ -442,35 +446,7 @@ feature 'Users' do
|
|||||||
click_link 'Citizen proposals'
|
click_link 'Citizen proposals'
|
||||||
|
|
||||||
expect(page).to have_content proposal.title
|
expect(page).to have_content proposal.title
|
||||||
expect(page).to have_link "Send notification"
|
|
||||||
expect(page).to have_link "Retire"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Display proposal with action buttons inside accordion proposal tab when there is no logged user', :js do
|
|
||||||
proposal = create(:proposal, author: @user)
|
|
||||||
create(:follow, followable: proposal, user: @user)
|
|
||||||
|
|
||||||
visit user_path(@user, filter: "follows")
|
|
||||||
click_link 'Citizen proposals'
|
|
||||||
|
|
||||||
expect(page).to have_content proposal.title
|
|
||||||
expect(page).not_to have_link "Send notification"
|
|
||||||
expect(page).not_to have_link "Retire"
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'Display proposal without action buttons inside accordion proposal tab when current user is not proposal author', :js do
|
|
||||||
proposal = create(:proposal)
|
|
||||||
create(:follow, followable: proposal, user: @user)
|
|
||||||
login_as @user
|
|
||||||
|
|
||||||
visit user_path(@user, filter: "follows")
|
|
||||||
click_link 'Citizen proposals'
|
|
||||||
|
|
||||||
expect(page).to have_content proposal.title
|
|
||||||
expect(page).not_to have_link "Send notification"
|
|
||||||
expect(page).not_to have_link "Retire"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'Budget Investments' do
|
describe 'Budget Investments' do
|
||||||
@@ -484,35 +460,22 @@ feature 'Users' do
|
|||||||
expect(page).to have_content('1 Following')
|
expect(page).to have_content('1 Following')
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Display accordion budget investment tab when user is following one budget investment at least' do
|
scenario 'Display budget investment tab when user is following one budget investment at least' do
|
||||||
budget_investment = create(:budget_investment)
|
budget_investment = create(:budget_investment)
|
||||||
create(:follow, followable: budget_investment, user: @user)
|
create(:follow, followable: budget_investment, user: @user)
|
||||||
|
|
||||||
visit user_path(@user, filter: "follow")
|
visit user_path(@user, filter: "follows")
|
||||||
|
|
||||||
expect(page).to have_link('Investments', href: "#")
|
expect(page).to have_link('Investments', href: "#investments")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Not display accordion budget investment tab when user is not following any budget investment' do
|
scenario 'Not display budget investment tab when user is not following any budget investment' do
|
||||||
visit user_path(@user, filter: "follow")
|
visit user_path(@user, filter: "follows")
|
||||||
|
|
||||||
expect(page).not_to have_link('Investments', href: "#")
|
expect(page).not_to have_link('Investments', href: "#investments")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Display budget investment with action buttons inside accordion budget investment tab when current user is a verified user and author', :js do
|
scenario 'Display budget investment with link to budget investment' do
|
||||||
user = create(:user, :level_two)
|
|
||||||
budget_investment = create(:budget_investment, author: user)
|
|
||||||
create(:follow, followable: budget_investment, user: user)
|
|
||||||
login_as user
|
|
||||||
|
|
||||||
visit user_path(user, filter: "follows")
|
|
||||||
click_link 'Investments'
|
|
||||||
|
|
||||||
expect(page).to have_link budget_investment.title
|
|
||||||
expect(page).to have_link "Delete"
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'Display budget investment with action buttons inside accordion budget investment tab when there is no logged user', :js do
|
|
||||||
user = create(:user, :level_two)
|
user = create(:user, :level_two)
|
||||||
budget_investment = create(:budget_investment, author: user)
|
budget_investment = create(:budget_investment, author: user)
|
||||||
create(:follow, followable: budget_investment, user: user)
|
create(:follow, followable: budget_investment, user: user)
|
||||||
@@ -521,22 +484,7 @@ feature 'Users' do
|
|||||||
click_link 'Investments'
|
click_link 'Investments'
|
||||||
|
|
||||||
expect(page).to have_link budget_investment.title
|
expect(page).to have_link budget_investment.title
|
||||||
expect(page).not_to have_link "Delete"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Display budget investment without action buttons inside accordion budget investment tab when current user is not budget investment author', :js do
|
|
||||||
user = create(:user, :level_two)
|
|
||||||
budget_investment = create(:budget_investment)
|
|
||||||
create(:follow, followable: budget_investment, user: user)
|
|
||||||
login_as user
|
|
||||||
|
|
||||||
visit user_path(user, filter: "follows")
|
|
||||||
click_link 'Investments'
|
|
||||||
|
|
||||||
expect(page).to have_link budget_investment.title
|
|
||||||
expect(page).not_to have_link "Delete"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user