Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport] Budgets unselected message #3033

Merged
merged 1 commit into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 35 additions & 34 deletions app/views/budgets/investments/_investment_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -142,42 +142,43 @@
</div>
</div>
<% end %>
<% end %>

<% if investment.unfeasible? %>
<div class="callout warning">
<%= t("budgets.investments.show.project_unfeasible_html") %>
</div>
<% elsif investment.winner? %>
<div class="callout success">
<strong><%= t("budgets.investments.show.project_winner") %></strong>
</div>
<% elsif investment.selected? %>
<div class="callout success">
<%= t("budgets.investments.show.project_selected_html") %>
</div>
<% elsif !investment.selected? && @budget.balloting_or_later? %>
<div class="callout warning">
<%= t("budgets.investments.show.project_not_selected_html") %>
</div>
<% else %>
<% if investment.unfeasible? %>
<div class="callout warning">
<%= t("budgets.investments.show.project_unfeasible_html") %>
</div>
<% elsif investment.winner? %>
<div class="callout success">
<strong><%= t("budgets.investments.show.project_winner") %></strong>
</div>
<% elsif investment.selected? %>
<div class="callout success">
<%= t("budgets.investments.show.project_selected_html") %>
</div>
<% elsif !investment.selected? %>
<div class="callout warning">
<%= t("budgets.investments.show.project_not_selected_html") %>
</div>
<% else %>
<br>
<div class="float-right">
<span class="label-budget-investment float-left">
<%= t("budgets.investments.show.title") %>
</span>
<span class="icon-budget"></span>
</div>
<% end %>
<% if investment.should_show_price? %>
<div class="sidebar-divider"></div>
<h2><%= t("budgets.investments.show.price") %></h2>
<div class="supports text-center">
<p class="investment-project-amount">
<%= investment.formatted_price %>
</p>
</div>
<% end %>
<br>
<div class="float-right">
<span class="label-budget-investment float-left">
<%= t("budgets.investments.show.title") %>
</span>
<span class="icon-budget"></span>
</div>
<% end %>
<% if investment.should_show_price? %>
<div class="sidebar-divider"></div>
<h2><%= t("budgets.investments.show.price") %></h2>
<div class="supports text-center">
<p class="investment-project-amount">
<%= investment.formatted_price %>
</p>
</div>
<% end %>

<%= render partial: 'shared/social_share', locals: {
share_title: t("budgets.investments.show.share"),
title: investment.title,
Expand Down
4 changes: 2 additions & 2 deletions spec/features/budgets/investments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ def investments_order
end

scenario "Show (not selected budget investment)" do
budget.update(phase: 'balloting')
user = create(:user)
login_as(user)

Expand All @@ -1055,8 +1056,7 @@ def investments_order
:finished,
budget: budget,
group: group,
heading: heading,
unfeasibility_explanation: 'Local government is not competent in this matter')
heading: heading)

visit budget_investment_path(budget_id: budget.id, id: investment.id)

Expand Down