Allow different texts in links to actions

The texts were different for a few models, so the component needs to be
updated.
This commit is contained in:
Javi Martín
2020-06-09 16:51:02 +02:00
parent 10c095d821
commit 738646a565
13 changed files with 73 additions and 56 deletions

View File

@@ -1,8 +1,22 @@
class Admin::TableActionsComponent < ApplicationComponent
attr_reader :record, :actions
attr_reader :record, :options
def initialize(record, actions: [:edit, :destroy])
def initialize(record, **options)
@record = record
@actions = actions
@options = options
end
private
def actions
options[:actions] || [:edit, :destroy]
end
def edit_text
options[:edit_text] || t("admin.actions.edit")
end
def destroy_text
options[:destroy_text] || t("admin.actions.delete")
end
end