diff --git a/app/components/users/budget_investment_table_actions_component.html.erb b/app/components/users/budget_investment_table_actions_component.html.erb new file mode 100644 index 000000000..45674e2b2 --- /dev/null +++ b/app/components/users/budget_investment_table_actions_component.html.erb @@ -0,0 +1,9 @@ +<% if can? :update, investment %> + <%= link_to t("shared.edit"), edit_budget_investment_path(investment.budget, investment), + class: "button hollow" %> +<% end %> +<% if can? :destroy, investment %> + <%= link_to t("shared.delete"), budget_investment_path(investment.budget, investment), + method: :delete, class: "button hollow alert", + data: { confirm: t("users.show.delete_alert") } %> +<% end %> diff --git a/app/components/users/budget_investment_table_actions_component.rb b/app/components/users/budget_investment_table_actions_component.rb new file mode 100644 index 000000000..9628a4383 --- /dev/null +++ b/app/components/users/budget_investment_table_actions_component.rb @@ -0,0 +1,8 @@ +class Users::BudgetInvestmentTableActionsComponent < ApplicationComponent + attr_reader :investment + use_helpers :can? + + def initialize(investment) + @investment = investment + end +end diff --git a/app/views/users/_budget_investment.html.erb b/app/views/users/_budget_investment.html.erb index 7c9dc0fec..81377519c 100644 --- a/app/views/users/_budget_investment.html.erb +++ b/app/views/users/_budget_investment.html.erb @@ -3,14 +3,6 @@ <%= link_to budget_investment.title, budget_investment_path(budget_investment.budget, budget_investment) %>