forked from consuldemocracy/consuldemocracy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_investment_show.html.erb
153 lines (131 loc) · 5.6 KB
/
_investment_show.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<% provide :social_media_meta_tags do %>
<%= render "shared/social_media_meta_tags",
social_url: budget_investments_path(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) %>
<% end %>
<section class="budget-investment-show" id="<%= dom_id(investment) %>">
<div class="row">
<div class="small-12 medium-9 column">
<%= back_link_to budget_investments_path(investment.budget, heading_id: investment.heading) %>
<% if can_destroy_image?(investment) %>
<%= link_to t("images.remove_image"),
image_path(investment.image, from: request.url),
method: :delete,
class: 'button hollow float-right' %>
<% end %>
<h1><%= investment.title %></h1>
<div class="budget-investment-info">
<%= render '/shared/author_info', resource: investment %>
<span class="bullet"> • </span>
<%= l investment.created_at.to_date %>
<span class="bullet"> • </span>
<%= investment.heading.name %>
</div>
<br>
<%= render_image(investment.image, :large, true) if investment.image.present? %>
<p id="investment_code">
<%= t("budgets.investments.show.code_html", code: investment.id) %>
</p>
<% if investment.location.present? %>
<p>
<%= t("budgets.investments.show.location_html", location: investment.location) %>
</p>
<% end %>
<% if investment.organization_name.present? %>
<p>
<%= t("budgets.investments.show.organization_name_html", name: investment.organization_name) %>
</p>
<% end %>
<%= render 'shared/tags', taggable: investment %>
<%= safe_html_with_links investment.description.html_safe %>
<% if feature?(:map) && map_location_available?(@investment.map_location) %>
<div class="margin">
<%= render_map(@investment.map_location, "budget_investment", false, nil) %>
</div>
<% end %>
<% if investment.external_url.present? %>
<div class="document-link">
<%= text_with_links investment.external_url %>
</div>
<% end %>
<% if investment.unfeasible? && investment.unfeasibility_explanation.present? %>
<h2><%= t('budgets.investments.show.unfeasibility_explanation') %></h2>
<p><%= investment.unfeasibility_explanation %></p>
<% end %>
<% if investment.should_show_price_info? %>
<h2><%= t('budgets.investments.show.price_explanation') %></h2>
<p><%= investment.price_explanation %></p>
<% end %>
</div>
<aside class="small-12 medium-3 column">
<% if investment.should_show_aside? %>
<% if investment.should_show_votes? %>
<div class="sidebar-divider"></div>
<h2><%= t("budgets.investments.show.supports") %></h2>
<div class="text-center">
<div id="<%= dom_id(investment) %>_votes">
<%= render partial: '/budgets/investments/votes', locals: {
investment: investment,
investment_votes: investment_votes,
vote_url: vote_budget_investment_path(investment.budget, investment, value: 'yes')
} %>
</div>
</div>
<% elsif investment.should_show_vote_count? %>
<div class="sidebar-divider"></div>
<h2><%= t("budgets.investments.show.supports") %></h2>
<div class="text-center">
<span class="total-supports">
<%= t("budgets.investments.investment.supports",
count: investment.total_votes) %>
</span>
</div>
<% elsif investment.should_show_ballots? %>
<div class="sidebar-divider"></div>
<h2><%= t("budgets.investments.show.votes") %></h2>
<div class="text-center">
<div id="<%= dom_id(investment) %>_ballot">
<%= render partial: 'ballot', locals: {
investment: investment,
investment_ids: investment_ids,
ballot: ballot,
} %>
</div>
</div>
<% end %>
<% else %>
<div class="float-right">
<span class="label-budget-investment float-left">
<%= t("budgets.investments.show.title") %>
</span>
<span class="icon-budget"></span>
</div>
<br>
<% 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,
image_url: image_absolute_url(investment.image, :thumb),
url: budget_investment_url(budget_id: investment.budget_id, id: investment.id)
} %>
<% if current_user %>
<div class="sidebar-divider"></div>
<p class="sidebar-title"><%= t("shared.follow") %></p>
<%= render 'follows/follow_button', follow: find_or_build_follow(current_user, investment) %>
<% end %>
<%= render 'communities/access_button', community: investment.community %>
</aside>
</div>
</section>