Do not show flaggable and followable buttons on budgets_investment and proposals pages when user is not logged.

This commit is contained in:
taitus
2017-07-04 16:28:54 +02:00
committed by Senén Rodero Rodríguez
parent 0ffa213a65
commit 97ee107157
7 changed files with 76 additions and 59 deletions

View File

@@ -13,10 +13,12 @@
<%= l investment.created_at.to_date %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= investment.heading.name %>
<% if current_user %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="js-follow">
<%= render 'follows/followable_button', followable: investment %>
</span>
<% end %>
</div>
<br>

View File

@@ -1,3 +1,4 @@
<span class="js-follow">
<span class="followable-content">
<% if show_follow_action? followable %>
@@ -35,3 +36,4 @@
<% end %>
</span>
</span>

View File

@@ -1,3 +1,4 @@
<span class="js-flag-actions">
<span class="flag-content">
<% if show_flag_action? proposal %>
<a id="flag-expand-proposal-<%= proposal.id %>" data-toggle="flag-drop-proposal-<%= proposal.id %>" title="<%= t('shared.flag') %>">
@@ -17,3 +18,4 @@
</div>
<% end %>
</span>
</span>

View File

@@ -49,14 +49,15 @@
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="icon-comments"></span>&nbsp;
<%= link_to t("proposals.show.comments", count: @proposal.comments_count), "#comments" %>
<% if current_user %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="js-flag-actions">
<%= render 'proposals/flag_actions', proposal: @proposal %>
</span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="js-follow">
<%= render 'follows/followable_button', followable: @proposal %>
</span>
<% end %>
</div>
<br>

View File

@@ -329,6 +329,14 @@ feature 'Budget Investments' do
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
investment = create(:budget_investment, heading: heading)
visit budget_investment_path(budget, investment)

View File

@@ -61,6 +61,8 @@ feature 'Proposals' do
expect(page).to have_content I18n.l(proposal.created_at.to_date)
expect(page).to have_selector(avatar(proposal.author.name))
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
expect(page.all('a').count).to be(4) # Twitter, Facebook, Google+, Telegram