Do not show flaggable and followable buttons on budgets_investment and proposals pages when user is not logged.
This commit is contained in:
committed by
Senén Rodero Rodríguez
parent
0ffa213a65
commit
97ee107157
@@ -13,10 +13,12 @@
|
|||||||
<%= l investment.created_at.to_date %>
|
<%= l investment.created_at.to_date %>
|
||||||
<span class="bullet"> • </span>
|
<span class="bullet"> • </span>
|
||||||
<%= investment.heading.name %>
|
<%= investment.heading.name %>
|
||||||
<span class="bullet"> • </span>
|
|
||||||
<span class="js-follow">
|
<% if current_user %>
|
||||||
|
<span class="bullet"> • </span>
|
||||||
<%= render 'follows/followable_button', followable: investment %>
|
<%= render 'follows/followable_button', followable: investment %>
|
||||||
</span>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -1,37 +1,39 @@
|
|||||||
<span class="followable-content">
|
<span class="js-follow">
|
||||||
|
<span class="followable-content">
|
||||||
|
|
||||||
<% if show_follow_action? followable %>
|
<% if show_follow_action? followable %>
|
||||||
<%= link_to "##{follow_link_wrapper_id(followable)}",
|
<%= link_to "##{follow_link_wrapper_id(followable)}",
|
||||||
id: follow_link_wrapper_id(followable),
|
id: follow_link_wrapper_id(followable),
|
||||||
title: follow_entity_text(followable),
|
title: follow_entity_text(followable),
|
||||||
data: { toggle: follow_drop_id(followable) } do %>
|
data: { toggle: follow_drop_id(followable) } do %>
|
||||||
<%= t('shared.follow') %>
|
<%= t('shared.follow') %>
|
||||||
|
<% end %>
|
||||||
|
<div class="dropdown-pane" id="<%= follow_drop_id(followable) %>"
|
||||||
|
data-dropdown data-auto-focus="true">
|
||||||
|
<%= link_to follow_entity_text(followable),
|
||||||
|
follows_path(followable_id: followable.id,
|
||||||
|
followable_type: followable.class.name),
|
||||||
|
method: :post, remote: true,
|
||||||
|
id: follow_link_id(followable) %>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="dropdown-pane" id="<%= follow_drop_id(followable) %>"
|
|
||||||
data-dropdown data-auto-focus="true">
|
|
||||||
<%= link_to follow_entity_text(followable),
|
|
||||||
follows_path(followable_id: followable.id,
|
|
||||||
followable_type: followable.class.name),
|
|
||||||
method: :post, remote: true,
|
|
||||||
id: follow_link_id(followable) %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if show_unfollow_action? followable %>
|
<% if show_unfollow_action? followable %>
|
||||||
<% follow = followable.follows.where(user: current_user).first %>
|
<% follow = followable.follows.where(user: current_user).first %>
|
||||||
<%= link_to "##{unfollow_link_wrapper_id(followable)}",
|
<%= link_to "##{unfollow_link_wrapper_id(followable)}",
|
||||||
id: unfollow_link_wrapper_id(followable),
|
id: unfollow_link_wrapper_id(followable),
|
||||||
title: unfollow_entity_text(followable),
|
title: unfollow_entity_text(followable),
|
||||||
data: { toggle: unfollow_drop_id(followable) } do %>
|
data: { toggle: unfollow_drop_id(followable) } do %>
|
||||||
<%= t('shared.unfollow') %>
|
<%= t('shared.unfollow') %>
|
||||||
|
<% end %>
|
||||||
|
<div class="dropdown-pane" id="<%= unfollow_drop_id(followable) %>"
|
||||||
|
data-dropdown data-auto-focus="true">
|
||||||
|
<%= link_to unfollow_entity_text(followable),
|
||||||
|
follow_path(follow),
|
||||||
|
method: :delete, remote: true,
|
||||||
|
id: unfollow_link_id(followable) %>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="dropdown-pane" id="<%= unfollow_drop_id(followable) %>"
|
|
||||||
data-dropdown data-auto-focus="true">
|
|
||||||
<%= link_to unfollow_entity_text(followable),
|
|
||||||
follow_path(follow),
|
|
||||||
method: :delete, remote: true,
|
|
||||||
id: unfollow_link_id(followable) %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
@@ -1,19 +1,21 @@
|
|||||||
<span class="flag-content">
|
<span class="js-flag-actions">
|
||||||
<% if show_flag_action? proposal %>
|
<span class="flag-content">
|
||||||
<a id="flag-expand-proposal-<%= proposal.id %>" data-toggle="flag-drop-proposal-<%= proposal.id %>" title="<%= t('shared.flag') %>">
|
<% if show_flag_action? proposal %>
|
||||||
<span class="icon-flag flag-disable"></span>
|
<a id="flag-expand-proposal-<%= proposal.id %>" data-toggle="flag-drop-proposal-<%= proposal.id %>" title="<%= t('shared.flag') %>">
|
||||||
</a>
|
<span class="icon-flag flag-disable"></span>
|
||||||
<div class="dropdown-pane" id="flag-drop-proposal-<%= proposal.id %>" data-dropdown data-auto-focus="true">
|
</a>
|
||||||
<%= link_to t('shared.flag'), flag_proposal_path(proposal), method: :put, remote: true, id: "flag-proposal-#{ proposal.id }" %>
|
<div class="dropdown-pane" id="flag-drop-proposal-<%= proposal.id %>" data-dropdown data-auto-focus="true">
|
||||||
</div>
|
<%= link_to t('shared.flag'), flag_proposal_path(proposal), method: :put, remote: true, id: "flag-proposal-#{ proposal.id }" %>
|
||||||
<% end %>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if show_unflag_action? proposal %>
|
<% if show_unflag_action? proposal %>
|
||||||
<a id="unflag-expand-proposal-<%= proposal.id %>" data-toggle="unflag-drop-proposal-<%= proposal.id %>" title="<%= t('shared.unflag') %>">
|
<a id="unflag-expand-proposal-<%= proposal.id %>" data-toggle="unflag-drop-proposal-<%= proposal.id %>" title="<%= t('shared.unflag') %>">
|
||||||
<span class="icon-flag flag-active"></span>
|
<span class="icon-flag flag-active"></span>
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-pane" id="unflag-drop-proposal-<%= proposal.id %>" data-dropdown data-auto-focus="true">
|
<div class="dropdown-pane" id="unflag-drop-proposal-<%= proposal.id %>" data-dropdown data-auto-focus="true">
|
||||||
<%= link_to t('shared.unflag'), unflag_proposal_path(proposal), method: :put, remote: true, id: "unflag-proposal-#{ proposal.id }" %>
|
<%= link_to t('shared.unflag'), unflag_proposal_path(proposal), method: :put, remote: true, id: "unflag-proposal-#{ proposal.id }" %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -49,14 +49,15 @@
|
|||||||
<span class="bullet"> • </span>
|
<span class="bullet"> • </span>
|
||||||
<span class="icon-comments"></span>
|
<span class="icon-comments"></span>
|
||||||
<%= link_to t("proposals.show.comments", count: @proposal.comments_count), "#comments" %>
|
<%= link_to t("proposals.show.comments", count: @proposal.comments_count), "#comments" %>
|
||||||
<span class="bullet"> • </span>
|
|
||||||
<span class="js-flag-actions">
|
<% if current_user %>
|
||||||
|
<span class="bullet"> • </span>
|
||||||
<%= render 'proposals/flag_actions', proposal: @proposal %>
|
<%= render 'proposals/flag_actions', proposal: @proposal %>
|
||||||
</span>
|
|
||||||
<span class="bullet"> • </span>
|
<span class="bullet"> • </span>
|
||||||
<span class="js-follow">
|
|
||||||
<%= render 'follows/followable_button', followable: @proposal %>
|
<%= render 'follows/followable_button', followable: @proposal %>
|
||||||
</span>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -329,6 +329,14 @@ feature 'Budget Investments' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "Not sow flaggable buttons" do
|
||||||
|
investment = create(:budget_investment, heading: heading)
|
||||||
|
|
||||||
|
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
||||||
|
|
||||||
|
expect(page).not_to have_selector ".js-follow"
|
||||||
|
end
|
||||||
|
|
||||||
scenario "Show back link contains heading id" do
|
scenario "Show back link contains heading id" do
|
||||||
investment = create(:budget_investment, heading: heading)
|
investment = create(:budget_investment, heading: heading)
|
||||||
visit budget_investment_path(budget, investment)
|
visit budget_investment_path(budget, investment)
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ feature 'Proposals' do
|
|||||||
expect(page).to have_content I18n.l(proposal.created_at.to_date)
|
expect(page).to have_content I18n.l(proposal.created_at.to_date)
|
||||||
expect(page).to have_selector(avatar(proposal.author.name))
|
expect(page).to have_selector(avatar(proposal.author.name))
|
||||||
expect(page.html).to include "<title>#{proposal.title}</title>"
|
expect(page.html).to include "<title>#{proposal.title}</title>"
|
||||||
|
expect(page).not_to have_selector ".js-flag-actions"
|
||||||
|
expect(page).not_to have_selector ".js-follow"
|
||||||
|
|
||||||
within('.social-share-button') do
|
within('.social-share-button') do
|
||||||
expect(page.all('a').count).to be(4) # Twitter, Facebook, Google+, Telegram
|
expect(page.all('a').count).to be(4) # Twitter, Facebook, Google+, Telegram
|
||||||
|
|||||||
Reference in New Issue
Block a user