Hide incompatible and non-winner investments by default
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
<div class="small-12 medium-9 column <%= results_type == :compatible ? 'success' : 'js-discarded' %>" id="<%= results_type %>-container">
|
<div class="small-12 medium-9 column <%= results_type == :compatible ? 'success' : 'js-discarded' %>"
|
||||||
|
style="<%= results_type != :compatible ? 'display: none' : '' %>"
|
||||||
|
id="<%= results_type %>-container">
|
||||||
|
|
||||||
<h3 class="inline-block">
|
<h3 class="inline-block">
|
||||||
<%= title %>
|
<%= title %>
|
||||||
@@ -28,7 +30,9 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<% amount_available = heading_price %>
|
<% amount_available = heading_price %>
|
||||||
<% investments.each do |investment| %>
|
<% investments.each do |investment| %>
|
||||||
<tr id="<%= dom_id(investment) %>" class="budget-investments <%= investment.winner? ? 'success' : 'js-discarded' %>">
|
<tr id="<%= dom_id(investment) %>"
|
||||||
|
class="budget-investments <%= investment.winner? ? 'success' : 'js-discarded' %>"
|
||||||
|
style="<%= investment.winner? ? '' : 'display: none' %>">
|
||||||
<td>
|
<td>
|
||||||
<% if investment.winner? %>
|
<% if investment.winner? %>
|
||||||
<span class="icon-check">
|
<span class="icon-check">
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span class="float-right"><%= link_to t("budgets.results.hide_discarded_link"), "#", class: "js-toggle-link button hollow margin-bottom", data: {'toggle-selector' => '.js-discarded', 'toggle-text' => t("budgets.results.show_all_link")} %></span>
|
<span class="float-right"><%= link_to t("budgets.results.show_all_link"), "#", class: "js-toggle-link button hollow margin-bottom", data: {'toggle-selector' => '.js-discarded', 'toggle-text' => t("budgets.results.hide_discarded_link")} %></span>
|
||||||
|
|
||||||
|
|
||||||
<%= render 'results_table', results_type: :compatible,
|
<%= render 'results_table', results_type: :compatible,
|
||||||
|
|||||||
@@ -17,6 +17,21 @@ feature 'Results' do
|
|||||||
visit budget_path(budget)
|
visit budget_path(budget)
|
||||||
click_link "See results"
|
click_link "See results"
|
||||||
|
|
||||||
|
within("#budget-investments-compatible") do
|
||||||
|
expect(page).to have_content investment1.title
|
||||||
|
expect(page).to have_content investment2.title
|
||||||
|
expect(page).not_to have_content investment3.title
|
||||||
|
expect(page).not_to have_content investment4.title
|
||||||
|
|
||||||
|
expect(investment1.title).to appear_before(investment2.title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Show non winner & incomaptible investments", :js do
|
||||||
|
visit budget_path(budget)
|
||||||
|
click_link "See results"
|
||||||
|
click_link "Show all"
|
||||||
|
|
||||||
within("#budget-investments-compatible") do
|
within("#budget-investments-compatible") do
|
||||||
expect(page).to have_content investment1.title
|
expect(page).to have_content investment1.title
|
||||||
expect(page).to have_content investment2.title
|
expect(page).to have_content investment2.title
|
||||||
@@ -31,21 +46,6 @@ feature 'Results' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Displays non winner investments", :js do
|
|
||||||
visit budget_path(budget)
|
|
||||||
click_link "See results"
|
|
||||||
click_link "Hide discarded"
|
|
||||||
|
|
||||||
within("#budget-investments-compatible") do
|
|
||||||
expect(page).to have_content investment1.title
|
|
||||||
expect(page).to have_content investment2.title
|
|
||||||
expect(page).not_to have_content investment3.title
|
|
||||||
expect(page).not_to have_content investment4.title
|
|
||||||
|
|
||||||
expect(investment1.title).to appear_before(investment2.title)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "If budget is in a phase different from finished results can't be accessed" do
|
scenario "If budget is in a phase different from finished results can't be accessed" do
|
||||||
budget.update phase: (Budget::PHASES - ["finished"]).sample
|
budget.update phase: (Budget::PHASES - ["finished"]).sample
|
||||||
visit budget_path(budget)
|
visit budget_path(budget)
|
||||||
|
|||||||
Reference in New Issue
Block a user