-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
138 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<h2 class="inline-block"><%= t("valuation.budgets.index.title") %></h2> | ||
|
||
<% if budgets.any? %> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th><%= t("valuation.budgets.index.table_name") %></th> | ||
<th><%= t("valuation.budgets.index.table_phase") %></th> | ||
<th><%= t("valuation.budgets.index.table_assigned_investments_valuation_open") %></th> | ||
<th><%= t("valuation.budgets.index.table_actions") %></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%= render Valuation::Budgets::RowComponent.with_collection(budgets) %> | ||
</tbody> | ||
</table> | ||
<% else %> | ||
<div class="callout primary clear"> | ||
<%= t("valuation.budgets.index.no_budgets") %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Valuation::Budgets::IndexComponent < ApplicationComponent | ||
attr_reader :budgets | ||
|
||
def initialize(budgets) | ||
@budgets = budgets | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<tr id="<%= dom_id(budget) %>" class="budget"> | ||
<td> | ||
<%= budget.name %> | ||
</td> | ||
<td> | ||
<%= budget.current_phase.name %> | ||
</td> | ||
<td class="investments-count"> | ||
<%= investments.count %> | ||
</td> | ||
<td> | ||
<% if investments.any? && budget.valuating? %> | ||
<%= link_to t("valuation.budgets.index.evaluate"), | ||
valuation_budget_budget_investments_path(budget_id: budget.id), | ||
class: "button hollow expanded" %> | ||
<% end %> | ||
</td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class Valuation::Budgets::RowComponent < ApplicationComponent | ||
attr_reader :budget | ||
with_collection_parameter :budget | ||
|
||
delegate :current_user, to: :helpers | ||
|
||
def initialize(budget:) | ||
@budget = budget | ||
end | ||
|
||
def investments | ||
return Budget::Investment.none unless budget.valuating? | ||
|
||
budget.investments.visible_to_valuators.by_valuator(current_user.valuator).valuation_open | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1 @@ | ||
<h2 class="inline-block"><%= t("valuation.budgets.index.title") %></h2> | ||
|
||
<% if @budget.present? %> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th><%= t("valuation.budgets.index.table_name") %></th> | ||
<th><%= t("valuation.budgets.index.table_phase") %></th> | ||
<th><%= t("valuation.budgets.index.table_assigned_investments_valuation_open") %></th> | ||
<th><%= t("valuation.budgets.index.table_actions") %></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr id="<%= dom_id(@budget) %>" class="budget"> | ||
<td> | ||
<%= @budget.name %> | ||
</td> | ||
<td> | ||
<%= @budget.current_phase.name %> | ||
</td> | ||
<td> | ||
<%= @investments.count %> | ||
</td> | ||
<td> | ||
<%= link_to t("valuation.budgets.index.evaluate"), | ||
valuation_budget_budget_investments_path(budget_id: @budget.id), | ||
class: "button hollow expanded" %> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<% else %> | ||
<div class="callout primary clear"> | ||
<%= t("valuation.budgets.index.no_budgets") %> | ||
</div> | ||
<% end %> | ||
<%= render Valuation::Budgets::IndexComponent.new(@budgets) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters