reverts hide tags on index views

This commit is contained in:
decabeza
2017-06-08 13:30:12 +02:00
parent 0625b2093c
commit 3d6f75bb59
8 changed files with 121 additions and 24 deletions

View File

@@ -519,6 +519,17 @@
} }
} }
.debate-content, .proposal-content,
.investment-project-content, .budget-investment-content {
margin: 0;
min-height: rem-calc(180);
position: relative;
.tags {
display: block;
}
}
.icon-debates, .icon-proposals, .icon-budget { .icon-debates, .icon-proposals, .icon-budget {
font-size: rem-calc(18); font-size: rem-calc(18);
line-height: $line-height; line-height: $line-height;

View File

@@ -36,6 +36,7 @@
<p><%= investment.description %></p> <p><%= investment.description %></p>
<div class="truncate"></div> <div class="truncate"></div>
</div> </div>
<%= render "shared/tags", taggable: investment, limit: 5 %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@@ -42,6 +42,7 @@
<%= debate.description %> <%= debate.description %>
<div class="truncate"></div> <div class="truncate"></div>
</div> </div>
<%= render "shared/tags", taggable: debate, limit: 5 %>
</div> </div>
</div> </div>

View File

@@ -45,6 +45,7 @@
<p><%= proposal.summary %></p> <p><%= proposal.summary %></p>
<div class="truncate"></div> <div class="truncate"></div>
</div> </div>
<%= render "shared/tags", taggable: proposal, limit: 5 %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@@ -7,18 +7,44 @@ feature 'Tags' do
let(:group) { create(:budget_group, name: "Health", budget: budget) } let(:group) { create(:budget_group, name: "Health", budget: budget) }
let!(:heading) { create(:budget_heading, name: "More hospitals", group: group) } let!(:heading) { create(:budget_heading, name: "More hospitals", group: group) }
scenario 'Does not show on index' do scenario 'Index' do
earth = create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') earth = create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente')
money = create(:budget_investment, heading: heading, tag_list: 'Economía') money = create(:budget_investment, heading: heading, tag_list: 'Economía')
visit budget_investments_path(budget, heading_id: heading.id) visit budget_investments_path(budget, heading_id: heading.id)
within "#budget_investment_#{earth.id}" do within "#budget_investment_#{earth.id}" do
expect(page).to_not have_content "Medio Ambiente" expect(page).to have_content "Medio Ambiente"
end end
within "#budget_investment_#{money.id}" do within "#budget_investment_#{money.id}" do
expect(page).to_not have_content "Economía" expect(page).to have_content "Economía"
end
end
scenario 'Index shows 3 tags with no plus link' do
tag_list = ["Medio Ambiente", "Corrupción", "Fiestas populares"]
create :budget_investment, heading: heading, tag_list: tag_list
visit budget_investments_path(budget, heading_id: heading.id)
within('.budget-investment .tags') do
tag_list.each do |tag|
expect(page).to have_content tag
end
expect(page).not_to have_content '+'
end
end
scenario 'Index shows up to 5 tags per proposal' do
create_featured_proposals
tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"]
create :budget_investment, heading: heading, tag_list: tag_list
visit budget_investments_path(budget, heading_id: heading.id)
within('.budget-investment .tags') do
expect(page).to have_content '1+'
end end
end end
@@ -114,18 +140,21 @@ feature 'Tags' do
end end
context "Filter" do context "Filter" do
scenario "Does not from index" do
scenario "From index" do
investment1 = create(:budget_investment, heading: heading, tag_list: 'Education') investment1 = create(:budget_investment, heading: heading, tag_list: 'Education')
investment2 = create(:budget_investment, heading: heading, tag_list: 'Health') investment2 = create(:budget_investment, heading: heading, tag_list: 'Health')
visit budget_investments_path(budget, heading_id: heading.id) visit budget_investments_path(budget, heading_id: heading.id)
within "#budget_investment_#{investment1.id}" do within "#budget_investment_#{investment1.id}" do
expect(page).to_not have_link('Education') click_link "Education"
end end
within "#budget_investment_#{investment2.id}" do within("#budget-investments") do
expect(page).to_not have_link('Health') expect(page).to have_css('.budget-investment', count: 1)
expect(page).to have_content(investment1.title)
end end
end end

View File

@@ -2,18 +2,43 @@ require 'rails_helper'
feature 'Tags' do feature 'Tags' do
scenario 'Does not show on index' do scenario 'Index' do
earth = create(:debate, tag_list: 'Medio Ambiente') earth = create(:debate, tag_list: 'Medio Ambiente')
money = create(:debate, tag_list: 'Economía') money = create(:debate, tag_list: 'Economía')
visit debates_path visit debates_path
within "#debate_#{earth.id}" do within "#debate_#{earth.id}" do
expect(page).to_not have_content "Medio Ambiente" expect(page).to have_content "Medio Ambiente"
end end
within "#debate_#{money.id}" do within "#debate_#{money.id}" do
expect(page).to_not have_content "Economía" expect(page).to have_content "Economía"
end
end
scenario 'Index shows up to 5 tags per proposal' do
tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"]
create :debate, tag_list: tag_list
visit debates_path
within('.debate .tags') do
expect(page).to have_content '1+'
end
end
scenario 'Index shows 3 tags with no plus link' do
tag_list = ["Medio Ambiente", "Corrupción", "Fiestas populares"]
create :debate, tag_list: tag_list
visit debates_path
within('.debate .tags') do
tag_list.each do |tag|
expect(page).to have_content tag
end
expect(page).not_to have_content '+'
end end
end end
@@ -126,18 +151,19 @@ feature 'Tags' do
context "Filter" do context "Filter" do
scenario "Does not from index" do scenario "From index" do
debate1 = create(:debate, tag_list: 'Education') debate1 = create(:debate, tag_list: 'Education')
debate2 = create(:debate, tag_list: 'Health') debate2 = create(:debate, tag_list: 'Health')
visit debates_path visit debates_path
within "#debate_#{debate1.id}" do within "#debate_#{debate1.id}" do
expect(page).to_not have_link('Education') click_link "Education"
end end
within "#debate_#{debate2.id}" do within("#debates") do
expect(page).to_not have_link('Health') expect(page).to have_css('.debate', count: 1)
expect(page).to have_content(debate1.title)
end end
end end

View File

@@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Tags' do feature 'Tags' do
scenario 'Does not show on index' do scenario 'Index' do
create_featured_proposals create_featured_proposals
earth = create(:proposal, tag_list: 'Medio Ambiente') earth = create(:proposal, tag_list: 'Medio Ambiente')
money = create(:proposal, tag_list: 'Economía') money = create(:proposal, tag_list: 'Economía')
@@ -10,11 +10,23 @@ feature 'Tags' do
visit proposals_path visit proposals_path
within "#proposal_#{earth.id}" do within "#proposal_#{earth.id}" do
expect(page).to_not have_content "Medio Ambiente" expect(page).to have_content "Medio Ambiente"
end end
within "#proposal_#{money.id}" do within "#proposal_#{money.id}" do
expect(page).to_not have_content "Economía" expect(page).to have_content "Economía"
end
end
scenario 'Index shows up to 5 tags per proposal' do
create_featured_proposals
tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"]
create :proposal, tag_list: tag_list
visit proposals_path
within('.proposal .tags') do
expect(page).to have_content '1+'
end end
end end
@@ -28,6 +40,21 @@ feature 'Tags' do
expect(page).to_not have_selector('#featured-proposals') expect(page).to_not have_selector('#featured-proposals')
end end
scenario 'Index shows 3 tags with no plus link' do
create_featured_proposals
tag_list = ["Medio Ambiente", "Corrupción", "Fiestas populares"]
create :proposal, tag_list: tag_list
visit proposals_path
within('.proposal .tags') do
tag_list.each do |tag|
expect(page).to have_content tag
end
expect(page).not_to have_content '+'
end
end
scenario 'Show' do scenario 'Show' do
proposal = create(:proposal, tag_list: 'Hacienda, Economía') proposal = create(:proposal, tag_list: 'Hacienda, Economía')
@@ -169,7 +196,7 @@ feature 'Tags' do
context "Filter" do context "Filter" do
scenario "Does not from index" do scenario "From index" do
create_featured_proposals create_featured_proposals
proposal1 = create(:proposal, tag_list: 'Education') proposal1 = create(:proposal, tag_list: 'Education')
proposal2 = create(:proposal, tag_list: 'Health') proposal2 = create(:proposal, tag_list: 'Health')
@@ -177,11 +204,12 @@ feature 'Tags' do
visit proposals_path visit proposals_path
within "#proposal_#{proposal1.id}" do within "#proposal_#{proposal1.id}" do
expect(page).to_not have_link('Education') click_link "Education"
end end
within "#proposal_#{proposal2.id}" do within("#proposals") do
expect(page).to_not have_link('Health') expect(page).to have_css('.proposal', count: 1)
expect(page).to have_content(proposal1.title)
end end
end end

View File

@@ -2,18 +2,18 @@ require 'rails_helper'
feature 'Tags' do feature 'Tags' do
scenario 'Does not show on Index' do scenario 'Index' do
earth = create(:debate, tag_list: 'Medio Ambiente') earth = create(:debate, tag_list: 'Medio Ambiente')
money = create(:debate, tag_list: 'Economía') money = create(:debate, tag_list: 'Economía')
visit debates_path visit debates_path
within "#debate_#{earth.id}" do within "#debate_#{earth.id}" do
expect(page).to_not have_content "Medio Ambiente" expect(page).to have_content "Medio Ambiente"
end end
within "#debate_#{money.id}" do within "#debate_#{money.id}" do
expect(page).to_not have_content "Economía" expect(page).to have_content "Economía"
end end
end end