groups and headings navigation
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
<div class="row investment-projects-scope margin-bottom no-margin-top">
|
<div class="row investment-projects-scope margin-bottom no-margin-top">
|
||||||
<div id="select-district" class="small-12 medium-7 column select-district">
|
<div id="select-district" class="small-12 medium-7 column select-district">
|
||||||
<%# link_to participatory_budget_path, class: "back" do %>
|
<%= link_to budget_path(@budget), class: "back" do %>
|
||||||
<span class="icon-angle-left"></span>
|
<span class="icon-angle-left"></span>
|
||||||
<%= t('shared.back') %>
|
<%= t('shared.back') %>
|
||||||
<%# end %>
|
<% end %>
|
||||||
|
|
||||||
<h2><%# t("spending_proposals.welcome.districts") %></h2>
|
<h2><%# t("spending_proposals.welcome.districts") %></h2>
|
||||||
|
|
||||||
@@ -13,8 +13,9 @@
|
|||||||
<% slice.each do |heading| %>
|
<% slice.each do |heading| %>
|
||||||
<span id="<%= dom_id(heading) %>"
|
<span id="<%= dom_id(heading) %>"
|
||||||
class="<%= css_for_ballot_heading(heading) %>">
|
class="<%= css_for_ballot_heading(heading) %>">
|
||||||
<%= link_to heading.name, budget_investments_path(heading_id: heading.id),
|
<%= link_to heading.name,
|
||||||
data: { no_turbolink: true } %><br>
|
budget_investments_path(heading_id: heading.id),
|
||||||
|
data: { no_turbolink: true } %><br>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
<%= link_to @budget, class: "back" do %>
|
<%= link_to budget_group_path(@budget, @heading.group), class: "back" do %>
|
||||||
<i class="icon-angle-left"></i>
|
<i class="icon-angle-left"></i>
|
||||||
<%= t("shared.back") %>
|
<%= t("shared.back") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -22,11 +22,18 @@
|
|||||||
<% @budget.groups.each do |group| %>
|
<% @budget.groups.each do |group| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<%= link_to group.name, budget_group_path(@budget, group) %>
|
<% if group.headings.count == 1 %>
|
||||||
|
<%= link_to group.name,
|
||||||
|
budget_investments_path(@budget, heading_id: group.headings.first.id),
|
||||||
|
data: { no_turbolink: true } %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to group.name, budget_group_path(@budget, group) %>
|
||||||
|
<% end %>
|
||||||
|
<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -151,12 +151,105 @@ feature 'Ballots' do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "Group and Heading Navigation" do
|
||||||
|
|
||||||
|
scenario "Groups" do
|
||||||
|
city = create(:budget_group, budget: budget, name: "City")
|
||||||
|
districts = create(:budget_group, budget: budget, name: "Districts")
|
||||||
|
|
||||||
|
visit budget_path(budget)
|
||||||
|
|
||||||
|
expect(page).to have_link "City"
|
||||||
|
expect(page).to have_link "Districts"
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Headings" do
|
||||||
|
city = create(:budget_group, budget: budget, name: "City")
|
||||||
|
districts = create(:budget_group, budget: budget, name: "Districts")
|
||||||
|
|
||||||
|
city_heading1 = create(:budget_heading, group: city, name: "Investments Type1")
|
||||||
|
city_heading2 = create(:budget_heading, group: city, name: "Investments Type2")
|
||||||
|
district_heading1 = create(:budget_heading, group: districts, name: "District 1")
|
||||||
|
district_heading2 = create(:budget_heading, group: districts, name: "District 2")
|
||||||
|
|
||||||
|
visit budget_path(budget)
|
||||||
|
click_link "City"
|
||||||
|
|
||||||
|
expect(page).to have_link "Investments Type1"
|
||||||
|
expect(page).to have_link "Investments Type2"
|
||||||
|
|
||||||
|
click_link "Go back"
|
||||||
|
click_link "Districts"
|
||||||
|
|
||||||
|
expect(page).to have_link "District 1"
|
||||||
|
expect(page).to have_link "District 2"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Investments" do
|
||||||
|
city = create(:budget_group, budget: budget, name: "City")
|
||||||
|
districts = create(:budget_group, budget: budget, name: "Districts")
|
||||||
|
|
||||||
|
city_heading1 = create(:budget_heading, group: city, name: "Investments Type1")
|
||||||
|
city_heading2 = create(:budget_heading, group: city, name: "Investments Type2")
|
||||||
|
district_heading1 = create(:budget_heading, group: districts, name: "District 1")
|
||||||
|
district_heading2 = create(:budget_heading, group: districts, name: "District 2")
|
||||||
|
|
||||||
|
city_investment1 = create(:budget_investment, :feasible, :finished, heading: city_heading1)
|
||||||
|
city_investment2 = create(:budget_investment, :feasible, :finished, heading: city_heading1)
|
||||||
|
district1_investment1 = create(:budget_investment, :feasible, :finished, heading: district_heading1)
|
||||||
|
district1_investment2 = create(:budget_investment, :feasible, :finished, heading: district_heading1)
|
||||||
|
district2_investment1 = create(:budget_investment, :feasible, :finished, heading: district_heading2)
|
||||||
|
|
||||||
|
visit budget_path(budget)
|
||||||
|
click_link "City"
|
||||||
|
click_link "Investments Type1"
|
||||||
|
|
||||||
|
expect(page).to have_css(".budget-investment", count: 2)
|
||||||
|
expect(page).to have_content city_investment1.title
|
||||||
|
expect(page).to have_content city_investment2.title
|
||||||
|
|
||||||
|
click_link "Go back"
|
||||||
|
click_link "Go back"
|
||||||
|
|
||||||
|
click_link "Districts"
|
||||||
|
click_link "District 1"
|
||||||
|
|
||||||
|
expect(page).to have_css(".budget-investment", count: 2)
|
||||||
|
expect(page).to have_content district1_investment1.title
|
||||||
|
expect(page).to have_content district1_investment2.title
|
||||||
|
|
||||||
|
click_link "Go back"
|
||||||
|
click_link "District 2"
|
||||||
|
|
||||||
|
expect(page).to have_css(".budget-investment", count: 1)
|
||||||
|
expect(page).to have_content district2_investment1.title
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Redirect to first heading if there is only one", :focus do
|
||||||
|
city = create(:budget_group, budget: budget, name: "City")
|
||||||
|
districts = create(:budget_group, budget: budget, name: "Districts")
|
||||||
|
|
||||||
|
city_heading = create(:budget_heading, group: city, name: "City")
|
||||||
|
district_heading1 = create(:budget_heading, group: districts, name: "District 1")
|
||||||
|
district_heading2 = create(:budget_heading, group: districts, name: "District 2")
|
||||||
|
|
||||||
|
city_investment = create(:budget_investment, :feasible, :finished, heading: city_heading)
|
||||||
|
|
||||||
|
visit budget_path(budget)
|
||||||
|
click_link "City"
|
||||||
|
|
||||||
|
expect(page).to have_content city_investment.title
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
#Break up or simplify with helpers
|
#Break up or simplify with helpers
|
||||||
context "Balloting in multiple headings" do
|
context "Balloting in multiple headings" do
|
||||||
|
|
||||||
scenario "Independent progress bar for headings", :js do
|
scenario "Independent progress bar for headings", :js do
|
||||||
city = create(:budget_group, budget: budget)
|
city = create(:budget_group, budget: budget, name: "City")
|
||||||
districts = create(:budget_group, budget: budget)
|
districts = create(:budget_group, budget: budget, name: "Districts")
|
||||||
|
|
||||||
city_heading = create(:budget_heading, group: city, name: "All city", price: 10000000)
|
city_heading = create(:budget_heading, group: city, name: "All city", price: 10000000)
|
||||||
district_heading1 = create(:budget_heading, group: districts, name: "District 1", price: 1000000)
|
district_heading1 = create(:budget_heading, group: districts, name: "District 1", price: 1000000)
|
||||||
|
|||||||
Reference in New Issue
Block a user