Skip to content

Commit

Permalink
Shows unselected message only on balloting or later phase
Browse files Browse the repository at this point in the history
This commit also removes custom investment show view avoiding duplicated all content for only two different lines on social media tags.
  • Loading branch information
decabeza committed Nov 9, 2018
1 parent a753c82 commit 1b296e2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 244 deletions.
74 changes: 37 additions & 37 deletions app/views/budgets/investments/_investment_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
social_url: budget_investment_url(investment.budget, investment),
social_title: investment.title,
social_description: investment.description,
twitter_image_url: (investment.image.present? ? investment.image_url(:thumb) : nil),
og_image_url: (investment.image.present? ? investment.image_url(:thumb) : nil) %>
twitter_image_url: (investment.image.present? ? investment.image_url(:thumb) : "social_media_budgets_2018_balloting_twitter.png"),
og_image_url: (investment.image.present? ? investment.image_url(:thumb) : "social_media_budgets_2018_balloting.png") %>
<% end %>
<% cache [locale_and_user_status(investment),
investment,
investment.author,
Expand Down Expand Up @@ -146,42 +145,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
205 changes: 0 additions & 205 deletions app/views/custom/budgets/investments/_investment_show.html.erb

This file was deleted.

4 changes: 2 additions & 2 deletions spec/features/budgets/investments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@ def investments_order
end

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

Expand All @@ -1053,8 +1054,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

0 comments on commit 1b296e2

Please sign in to comment.