Extract budget investment's info to a component
This commit is contained in:
24
app/components/budgets/investments/info_component.html.erb
Normal file
24
app/components/budgets/investments/info_component.html.erb
Normal file
@@ -0,0 +1,24 @@
|
||||
<p class="investment-project-info">
|
||||
<%= l investment.created_at.to_date %>
|
||||
|
||||
<% if investment.author.hidden? || investment.author.erased? %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="author">
|
||||
<%= t("budgets.investments.show.author_deleted") %>
|
||||
</span>
|
||||
<% else %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="author">
|
||||
<%= investment.author.name %>
|
||||
</span>
|
||||
<% if investment.author.official? %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="label round level-<%= investment.author.official_level %>">
|
||||
<%= investment.author.official_position %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<span class="bullet"> • </span>
|
||||
<%= investment.heading.name %>
|
||||
</p>
|
||||
7
app/components/budgets/investments/info_component.rb
Normal file
7
app/components/budgets/investments/info_component.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class Budgets::Investments::InfoComponent < ApplicationComponent
|
||||
attr_reader :investment
|
||||
|
||||
def initialize(investment)
|
||||
@investment = investment
|
||||
end
|
||||
end
|
||||
@@ -21,30 +21,8 @@
|
||||
<% cache [locale_and_user_status(investment), "index", investment, investment.author] do %>
|
||||
<h3><%= link_to investment.title, namespaced_budget_investment_path(investment) %></h3>
|
||||
|
||||
<p class="investment-project-info">
|
||||
<%= l investment.created_at.to_date %>
|
||||
<%= render Budgets::Investments::InfoComponent.new(investment) %>
|
||||
|
||||
<% if investment.author.hidden? || investment.author.erased? %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="author">
|
||||
<%= t("budgets.investments.show.author_deleted") %>
|
||||
</span>
|
||||
<% else %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="author">
|
||||
<%= investment.author.name %>
|
||||
</span>
|
||||
<% if investment.author.official? %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="label round level-<%= investment.author.official_level %>">
|
||||
<%= investment.author.official_position %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<span class="bullet"> • </span>
|
||||
<%= investment.heading.name %>
|
||||
</p>
|
||||
<div class="investment-project-description">
|
||||
<%= wysiwyg(investment.description) %>
|
||||
<div class="truncate"></div>
|
||||
|
||||
Reference in New Issue
Block a user