displays unfeasible budgets link from home
This commit is contained in:
@@ -2,7 +2,6 @@ class BudgetsController < ApplicationController
|
||||
include FeatureFlags
|
||||
feature_flag :budgets
|
||||
|
||||
|
||||
load_and_authorize_resource
|
||||
respond_to :html, :js
|
||||
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row margin-top">
|
||||
<% if params[:unfeasible] %>
|
||||
Propuestas inviables
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="row margin-top">
|
||||
<div id="select-district" class="small-12 medium-7 column select-district">
|
||||
<div class="row">
|
||||
@@ -16,7 +22,8 @@
|
||||
<span id="<%= dom_id(heading) %>"
|
||||
class="<%= css_for_ballot_heading(heading) %>">
|
||||
<%= link_to heading.name,
|
||||
budget_investments_path(heading_id: heading.id),
|
||||
budget_investments_path(heading_id: heading.id,
|
||||
unfeasible: params[:unfeasible]),
|
||||
data: { no_turbolink: true } %><br>
|
||||
</span>
|
||||
<% end %>
|
||||
@@ -29,3 +36,10 @@
|
||||
<%= image_tag "map.jpg" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if params[:unfeasible].blank? %>
|
||||
<div class="row margin-top">
|
||||
<%= link_to t("budgets.investments.index.sidebar.unfeasible"),
|
||||
budget_path(@budget, unfeasible: 1) %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= back_link_to budget_group_path(@budget, @heading.group) %>
|
||||
<%= back_link_to budget_group_path(@budget, @heading.group, unfeasible: params[:unfeasible]) %>
|
||||
|
||||
<% if can? :show, @ballot %>
|
||||
<%= link_to t("budgets.investments.header.check_ballot"),
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
<%= render "shared/tag_cloud", taggable: 'budget/investment' %>
|
||||
<%= render 'budgets/investments/categories' %>
|
||||
<%= render 'budgets/investments/feasibility_link' %>
|
||||
|
||||
<% if @heading && can?(:show, @ballot) %>
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
<table class="table-fixed">
|
||||
<thead>
|
||||
<th><%= t('budgets.show.group') %></th>
|
||||
<% if params[:unfeasible] %>
|
||||
Propuestas inviables
|
||||
<% end %>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @budget.groups.each do |group| %>
|
||||
@@ -48,10 +51,14 @@
|
||||
<td>
|
||||
<% if group.headings.count == 1 %>
|
||||
<%= link_to group.name,
|
||||
budget_investments_path(@budget, heading_id: group.headings.first.id),
|
||||
budget_investments_path(@budget,
|
||||
heading_id: group.headings.first.id,
|
||||
unfeasible: params[:unfeasible]),
|
||||
data: { no_turbolink: true } %>
|
||||
<% else %>
|
||||
<%= link_to group.name, budget_group_path(@budget, group) %>
|
||||
<%= link_to group.name,
|
||||
budget_group_path(@budget, group,
|
||||
unfeasible: params[:unfeasible]) %>
|
||||
<% end %>
|
||||
<br>
|
||||
</td>
|
||||
@@ -61,3 +68,10 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% unless params[:unfeasible] %>
|
||||
<div class="row margin-top">
|
||||
<%= link_to t("budgets.investments.index.sidebar.unfeasible"),
|
||||
budget_path(@budget, unfeasible: 1) %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -23,21 +23,6 @@ feature 'Budget Investments' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Feasibility links' do
|
||||
visit budget_investments_path(budget, heading_id: heading.id)
|
||||
expect(page).to_not have_content('Feasible projects')
|
||||
|
||||
within('#sidebar') do
|
||||
click_link 'Unfeasible projects'
|
||||
end
|
||||
expect(page).to have_current_path(budget_investments_path(budget, heading_id: heading.id, unfeasible: 1))
|
||||
|
||||
within('#sidebar') do
|
||||
click_link 'Feasible projects'
|
||||
end
|
||||
expect(page).to have_current_path(budget_investments_path(budget, heading_id: heading.id, unfeasible: nil))
|
||||
end
|
||||
|
||||
context("Search") do
|
||||
|
||||
scenario 'Search by text' do
|
||||
@@ -82,6 +67,34 @@ feature 'Budget Investments' do
|
||||
expect(page).to_not have_content(investment4.title)
|
||||
end
|
||||
end
|
||||
|
||||
scenario "by unfeasibilty link for group with one heading", :focus do
|
||||
group = create(:budget_group, name: 'All City', budget: budget)
|
||||
heading = create(:budget_heading, name: "Madrid", group: group)
|
||||
|
||||
visit budget_path(budget)
|
||||
click_link 'Unfeasible projects'
|
||||
|
||||
click_link "All City"
|
||||
|
||||
expected_path = budget_investments_path(budget, heading_id: heading.id, unfeasible: 1)
|
||||
expect(page).to have_current_path(expected_path)
|
||||
end
|
||||
|
||||
scenario "by unfeasibilty link for group with many headings", :focus do
|
||||
group = create(:budget_group, name: 'Districts', budget: budget)
|
||||
heading1 = create(:budget_heading, name: 'Carabanchel', group: group)
|
||||
heading2 = create(:budget_heading, name: 'Barajas', group: group)
|
||||
|
||||
visit budget_path(budget)
|
||||
click_link 'Unfeasible projects'
|
||||
|
||||
click_link 'Districts'
|
||||
click_link 'Carabanchel'
|
||||
|
||||
expected_path = budget_investments_path(budget, heading_id: heading1.id, unfeasible: 1)
|
||||
expect(page).to have_current_path(expected_path)
|
||||
end
|
||||
end
|
||||
|
||||
context("Orders") do
|
||||
|
||||
Reference in New Issue
Block a user