Allow custom URLs in links to actions
There were a couple of cases where these links didn't point to the default actions.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class Admin::TableActionsComponent < ApplicationComponent
|
||||
attr_reader :record, :options
|
||||
|
||||
def initialize(record, **options)
|
||||
def initialize(record = nil, **options)
|
||||
@record = record
|
||||
@options = options
|
||||
end
|
||||
@@ -16,7 +16,15 @@ class Admin::TableActionsComponent < ApplicationComponent
|
||||
options[:edit_text] || t("admin.actions.edit")
|
||||
end
|
||||
|
||||
def edit_path
|
||||
options[:edit_path] || admin_polymorphic_path(record, action: :edit)
|
||||
end
|
||||
|
||||
def destroy_text
|
||||
options[:destroy_text] || t("admin.actions.delete")
|
||||
end
|
||||
|
||||
def destroy_path
|
||||
options[:destroy_path] || admin_polymorphic_path(record)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user