This way we simplify the HTML, which had some `if...else` blocks that were hard to follow because there were opening tags inside these blocks while the closing tags were outside these blocks. We're also making the CSS container-dependent instead of window-dependent. Since there are between one and three elements inside the panel, we accomplish this by making the element with the content take its own line if the width of the panel is smaller than 35rem. Note we're trying to keep the layout similar to what it was; since we're no longer using negative margins (like the ones in the `.row` selector), the votes element now gets a width of 22.5% instead of 25%. Also note we're using the column-gap property for flexbox because the `flex-with-gap` mixin doesn't work so well with elements that have borders. Since the column-gap property for flexbox is now supperted by more than 98% of the browsers (which wasn't the case when we started using the `flex-with-gap` mixin), the `flex-with-gap` mixin has become obsolete. Finally, note we're removing the `max-width: 12rem` rule in the images. I'm not sure why we introduced this rule in the first place, and it didn't play so well to the new layout. I considered using code like `max-width: min(100%, 12rem)`, but, since I'm not sure why `12rem` was there in the first place, I'm not sure whether this approach was better, and it sure made things more complex.
57 lines
2.2 KiB
Plaintext
57 lines
2.2 KiB
Plaintext
<div id="<%= dom_id(investment) %>" class="budget-investment clear">
|
|
<div class="panel <%= ("with-image" if feature?(:allow_images) && investment.image.present?) %>">
|
|
|
|
<% if feature?(:allow_images) && investment.image.present? %>
|
|
<div class="panel-image">
|
|
<%= image_tag investment.image.variant(:thumb), alt: investment.image.title.unicode_normalize %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="budget-investment-content">
|
|
<% cache [locale_and_user_status(investment), "index", investment, investment.author] do %>
|
|
<h3><%= link_to investment.title, namespaced_budget_investment_path(investment) %></h3>
|
|
|
|
<%= render Budgets::Investments::InfoComponent.new(investment) %>
|
|
|
|
<div class="investment-project-description">
|
|
<%= wysiwyg(investment.description) %>
|
|
<div class="truncate"></div>
|
|
</div>
|
|
<%= render "shared/tags", taggable: investment, limit: 5 %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<% unless investment.unfeasible? %>
|
|
<% if investment.should_show_votes? %>
|
|
<div id="<%= dom_id(investment) %>_votes">
|
|
<%= render Budgets::Investments::VotesComponent.new(investment) %>
|
|
</div>
|
|
<% elsif investment.should_show_vote_count? %>
|
|
<div id="<%= dom_id(investment) %>_votes">
|
|
<div class="supports">
|
|
<span class="total-supports no-button">
|
|
<%= t("budgets.investments.investment.supports",
|
|
count: investment.total_votes) %>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<% elsif investment.should_show_ballots? && !management_controller? %>
|
|
<div id="<%= dom_id(investment) %>_ballot">
|
|
<%= render "/budgets/investments/ballot",
|
|
investment: investment,
|
|
investment_ids: investment_ids,
|
|
ballot: ballot %>
|
|
</div>
|
|
<% elsif investment.should_show_price? %>
|
|
<div id="<%= dom_id(investment) %>_price" class="supports">
|
|
<div class="supports">
|
|
<span class="total-supports no-button">
|
|
<%= investment.formatted_price %>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|