Move table actions partial to a component
This partial was going to get too complex since in some places we've got different texts, different URLs or different confirmation messages. While we should probably try to be more consistent and that would make the partial work in most cases, there'll always be some exceptions, and using a partial (with, perhaps, some helper methods) will become messy really quickly.
This commit is contained in:
8
app/components/admin/table_actions_component.rb
Normal file
8
app/components/admin/table_actions_component.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class Admin::TableActionsComponent < ApplicationComponent
|
||||
attr_reader :record, :actions
|
||||
|
||||
def initialize(record, actions: [:edit, :destroy])
|
||||
@record = record
|
||||
@actions = actions
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user